mob/var
tmp/updatehp()
obj/bars
lifebar
icon='healthbar.dmi'
icon_state="30"
pixel_y=32
layer=50
var/obj/bars/lifebar/A = new
mob/proc/updatehp()
var/percentbar=round(src.health/src.maxhealth*30,1)
if(percentbar>30) percentbar=30
if(percentbar<0) percentbar=0
src.overlays += /obj/bars/lifebar
A.icon_state=num2text(percentbar)
src.overlays+= A
sleep(2)
src.updatehp()
while(src)
if(percentbar!=round(src.health/src.maxhealth*30,1))
percentbar=round(src.health/src.maxhealth*30,1)
if(percentbar>30)percentbar=30
if(percentbar<0) percentbar=0
A.icon_state=num2text(percentbar)
sleep(2)
mob/verb/Attack()
set category=null
if(src.canattack)
if(usr.wieldingsword)
flick("Sword Slash1",usr)
else
flick("punch",usr)
for(var/mob/M in get_step(usr,usr.dir))
var/damage=round(src.strength-src.defence)
if(damage>=0)
M.health-=damage
M.effectdamage(damage,"y")
M.updatehp()
if(M.enemy)
usr.hollowprotection=1
usr.canattack=1
return
usr.Death(M)
mob/login
spawn(-1) src.updatehp()//even when this is taken out it still happen.
Problem description:
Kinda still need to still need to add sleep on attack but the problem is when i attack an npc its talking about overlooping something thing then game crash.