ID:296636
 
(See the best response by Forum_account.)
Just see this video to understand my problem:
http://youtu.be/5WUAZjovTuw

Here is the ai for my mob:
        proc
Watching()
for(var/mob/m in oview())
if(m.client)
target = m
AI()
while(src)
stop()
if(target)
dir = get_dir(src,target)
if(bounds_dist(src,target) > 8)
move_to(target)
else
target << "OK"
stop()
sleep(4)
else
Watching()
sleep(5)


The worst part is the line they make in the video. The mob disappears if walk outside the map but I just need to make a black dense turf and countour my map.
Maybe the library's pathfinding is dumb or my code is too simple, idk...
Help!
Best response
It looks like the slow_down proc isn't getting called. I'd also make this piggyback on the action() proc instead of creating an additional loop for all mobs.

mob
enemy
action()
if(target)
dir = get_dir(src, target)
if(bounds_dist(src, target) > 8)
move_to(target)
else
target << "OK"
stop()
slow_down()
else
Watching()
In response to Forum_account
Thanks for answering me.

The action wasn't working, so I made some small changes, but now it's the move_to(target) that isn't working...
        proc
Watching()
for(var/mob/m in oview(src))
if(m.client)
target = m
break
action()
if(target)
dir = get_dir(src,target)
if(bounds_dist(src,target) > 4)
move_to(target)
else
target << "OK"
stop()
slow_down()
else
Watching()


The weirdest part it's that I checked and the proc is returning 1, but he's not moving. Just look in my direction.
but now it's the move_to(target) that isn't working...

Put ..() at the end of the action() proc.

Also, if you don't want the AI to run every tick (your AI loop had a delay of 5 at the end) you can do this:

mob
enemy
// t is the number of ticks
action(t)

// every 5th tick...
if(t % 5 == 0)
// ... run the AI code

..()
Thanks!
Now everything works fine!