ID:166851
 
Hi ppls long time no see, been working on school lately so i havent been able to code.

any ways, i was wondering how I would go about checking for a specific obj in a turf whenever a mob moves. I know I should know how to do this by now, but like i said, i havent touch BYOND in a while.
thanks
~~~Albire
The turf their moving to or what?
Like this?
turf/Entered(mob/M)
for(atom/A in oview(0)
if(istype(A, /obj/theObj))
...
else
...


--Vito
In response to Vito Stolidus
turf/Entered()
var/obj/whatever/o = locate() in src
if(o) do_whatever(o)
..()


Better.
In response to PirateHead
ok, thank you both for your help, though I have run into a new issue. I took what you gave me and made a code, it worked, but had a bug in it that i had to fix. so I morphed it into a move proc and got this, but the screen is black when it starts up. any ideas?

mob
icon = 'ppl.dmi'
proc/Fall()
sleep(6)
if(src.jmping == 0)
src.loc = locate(x,y-1,z)

mob/Move(mob/m as mob)
var/obj/grass/o = locate() in oview(0)
if(o)

else
src.Fall(src)

thanks again
~~Albire
In response to Albire
mob
icon = 'ppl.dmi'
proc/Fall()
sleep(6)
if(!src.jmping)
src.loc = locate(src.x,src.y-1,src.z)

mob/Move()
..()
var/obj/grass/o = locate() in oview(0)
if(!o)
src.Fall()


Better. You forgot the ..() which is why the screen was blank. Also fixed up a bit more. You can see using if(!o) is better then using if(o) then an else if you have nothing to do if o is there.
In response to Albire
You might also want to use step(src,SOUTH) instead of the loc = locate() statement. If somebody already at the bottom of the map "falls", they will fall into a null location since their y will be 0.

Always remember to fit the ..() procedure into built-in procs in any case where it should work as usual. ..() means "do what usually happens".
In response to PirateHead
perfect, that fixed the issue and allowed me to morph it one last time to do just what i want it to. thanks to all of you

~~Albire