Spawn Issue in Developer Help
|
|
Code:
Start() if(length(Players) >= 1) world << "A new battle has begun!" while(length(Players) > 0) var/mob/A = pick(Players) for(var/mob/M in world) if(M == A) Players -= A M.loc = locate(13,13,2) var/list/L = list() for(var/turf/T in locate(/area/Spawn) in view(M)) L += T M.Move(locate(pick(L))) M.icon = 'Boats.dmi' M.HUDAdd() Turn = 1 return else src << "There must be at least 2 People to start!" return
|
Problem description:
For some reason, the M.Move(locate(pick(L))) doesn't work. I think I may have coded the list or adding things to the list wrong, but I can't see the error.
|
If you're storing the mob references into the list directly, you don't need the for() loop anymore. You can just act on 'A' (although you might want to check it's not null, in case someone logs out. Just make sure to remove it from the list either way to avoid infinite loops).
Also, you want to move the player to one of the turfs in L, so you don't need to run locate() on the turf returned by pick().