var/mob/PC/P
if (P in oview(4))
step_towards(src,P)
I currently have this code for determining if a pc is in range, problem is i want it to change targets to whoever is closer to it. Any way I can do this?
-Tazor
ID:173480
Dec 27 2003, 4:31 pm
|
|
In response to Polatrite
|
|
Nope, the view and range procs return things in a seemingly random order (I'm sure they're not random; probably go by internal ID number or something; but they don't go in a very useful order).
Oh, and you shouldn't need those if(P) lines. |
In response to Crispy
|
|
I believe it's in the same order that DM places the turfs (or possibly the reverse direction). I think it's west to east, south to north.
|
var/mob/M
var/mob/P
for(P in oview(4))
if(P)
M = P
for(P in oview(3))
if(P)
M = P
for(P in oview(2))
if(P)
M = P
-etc.-
However, I was always under the impression oview spiraled outwards. Checking the tiles around the ref, then the tiles around those, and so on.
~Polatrite~