ID:144796
 
Code:
for(var/obj/GotoWood/GW in block(locate(src.x+200,src.y+200,z),locate(src.x-200,src.y-200,1)))


Problem description:


Anyone know why the src is not detecting the GW in 200 sqaures view of src??
block(sw,ne) you're doing it the other way
In response to Xx Dark Wizard xX (#1)
ah I see, do I need to set maxx maxy maxz or anything to make it search the block?
In response to Ginseng (#2)
block() works for turfs only, unfortunately. You can easily make your own procedure to check for mobs, objs, and areas, though.
In response to Popisfizzy (#3)
I think I will use

for(var/obj/GotoWood/GW in world)

although when I do it makes the mob go for the GW thats the furthest away >.< any idea how to make it just go for the closest?
In response to Ginseng (#2)
Bugh, when I said use block() I meant use it to access the contents of the turfs it returns.
In response to Ginseng (#4)
var/obj/GotoWood/closest
var/dist
for(var/obj/GotoWood/GW in world)
if(!closest) //set the first obj
closest = GW
dist = get_dist(src,GW)
else
if(get_dist(src,GW)<dist) //if the current GW is closer than the one we previously had
closest = GW //make the current GW our closest one
dist = get_dist(src,GW)


What the above does is it loops through every /obj/GotoWood in the world. The first obj it finds it automatically sets as the closest. When it finds another obj, it checks if the distance between src and the new obj is less than the distance between src and the closest obj. If it is, then the current obj now is our closest obj. If it isn't, then it continues looping through all the /obj/GotoWood in the world.

Ask, with very specific questions, if you don't understand.