EDIT: However just to clarify, I still want my ai smart enough to not get stuck behind walls and always try to find a path to the user! :p
|
| My current AI code.
V
mob
var
target
delaytime=3 //minimum
proc
ai()
for()
sleep(src.delaytime)
var/templist[]=new
for(var/mob/m in world)
sleep()
if(m.playing)
templist+=m
var/playersfound
for(var/a in templist)
playersfound=1
if(!playersfound) //no targets found.
return
src.target=pick(templist)
var/mob/n=src.target
while(n.playing)
sleep(src.delaytime)
if(get_dist(n,src)<2)
step_towards(src,src.target)
else
step_to(src,src.target) //HERE.
src.target=n