ID:144644
 
Code:
New()
spawn(1)AI(src)
proc/AI()
while(src)
sleep(10)
for(var/mob/M in oview(4))
target = /mob/newgame
if(istype(M,/mob/newgame))
if(M in oview(5)) //baisicly saying if I come on the screen start walking around
walk_rand(src,10)
if(M in oview(3))
walk_to(src,M,0,10)
if(M in oview(1))
walk(src,0)
else
walk(src,0) //If im not on the screen then stop walking


Problem description:It all seems to work ok but when I go out of view. The mobs still walk around. This is a very simple Ai code I know, but it will become more envolved as I continue to code.

mob/proc/AI(var/mob/M)
while(z!=0)
if(M in oview(src,9))
if(M.client)
step_rand(src)
sleep(rand(10,40))
break
else
sleep(rand(10,40))
for(M in oview(src,9))
if(M.client)
break
spawn() AI()

    New()
..()
spawn() src.AI()