mob/test
icon='test.dmi'
New()
for(var/mob/M in oview(1))
NPCAttack()
proc
NPCAttack()
for(var/mob/M in oview(1))
M.HP-=1
There is my code...and it won't attack can someone please explain this to me?
ID:267170
Dec 27 2002, 2:30 am
|
|
var/active = 0
proc/AILoop()
for(var/mob/M in oview(src,20)) //Remember src in oview()
if(M != src)
step_to(src,M)
if(get_dist(src,M <= 1))
spawn() attack(M)
spawn(4) AILoop() //The spawn() is very important, unless if you want your game to crash.
return
active = 0 //This won't be reached if any mobs are found
proc/attack(mob/M)
M << "[src] attacks you!"
M.hp -= rand(1,10)
mob
PC
Move()
for(var/mob/NPC/N in oview(src,20))
if(!N.active)
N.active = 1
spawn() N.AILoop()
..()