ID:149484
 
Here is my ai code....
mob
enemy
icon = 'enemies.dmi'
Skeleton
icon_state = "Skell"
HP = 2
HTP = 1
CLIENT = 0
var/mob/PC/P
New()
.=..()
spawn(1)
Walk()
proc/Walk()
while(src)
if(P in oview(5))
step_towards(src,P,)
else
step_rand(src)
for(P in view(src))
break
sleep(10)
spawn(40)
Walk()
Bump(mob/M)
if(M.CLIENT == 1)
var/damage = src.HTP - usr.DP
if(damage<=0)
P<<"You block the monsters attack!"
if(damage>=1)
P.HP-=damage
P<<"Skelleton does [damage] damage to you."
if(P.HP<=0)
P<<"You have died"
P.Move(locate(1,1,1))
P.HP = P.MHP
sleep(20)
if(M.CLIENT == 0)
return 0
It compiles with no runtime errors, but the problem is when it bumps the player it attacks 1 time the first bump, the second bumb it attack twice, the third bump it attackes 4 times, and so on. Could anyone see if you can find a problem that would cuase this?