ID:262711
 
Code:
mob
follow
wolf
var/mob/pc/owner
icon = 'person.dmi'
icon_state = "pet"
var/nomove = 0
New()
spawn()
wander()
proc/wander()
if(nomove == 0)
while(owner in oview(8,src))
step_to(src,owner,1)
sleep(5)
sleep(5)
if(owner in oview(2,src))
src.nomove = 10
else
nomove -= 1
if(nomove < 0)
nomove = 0
wander()


Problem description:
it works, but the nomove delay isnt happening

I prefer using walk_towards() instead of <code>step_to()</code>. "Why?" you ask? Well, here's a reason:

<code>walk_towards()</code> takes 3 arguements: A mob or object (In your case, the monster), An object on the map (In your case, the monsters target), and Lag (In your case, the nomove delay). If you stick those 3 together, it would look something like this:
mob/monster/slime
icon='slime.dmi'
New()
for(var/mob/M in oview(2))
walk_towards(src,M,4)
/*
src = the monster
M = A mob within 2 tiles of the monster
4 = How much time it takes before movement to the next tile in 1/10 second increments.*/

..()
In response to Mega fart cannon
That wouldn't work. Well it would but the game wouldn't. Add in ..() under New()
In response to ADT_CLONE
ADT_CLONE wrote:
That wouldn't work. Well it would but the game wouldn't. Add in ..() under New()

Something wrong with your eyes? He did add ..() under New() =P.

O-matic
In response to O-matic
eh ehm...
i need to be able to check if the players hide is = to 0 and i want the delay to only happen when the wolf is close to the player, not all the time.
In response to Rky_nick
never mind! I fixed it by making the while(owner in oview(8,src)) if(owner in oview(8,src))