obj
health
icon = 'meter_01.dmi'
layer = MOB_LAYER+100
icon_state = "100"
New()
var/mob/O = src.Gowner
var/percent=round(O.health/O.maxhealth*100,10)
if(percent>100) percent=100
if(percent<0) percent=0
for(var/obj/health/o)
o.icon_state=num2text(percent)
spawn(20)
del(src)
thats how i tried but kept getting errors. The bar appears and i can see it on te npc but doesnt go away and it has that error.
runtime error: Cannot read null.health
proc name: New (/obj/health/New)
usr: Mike (/mob)
src: the health (/obj/health)
call stack:
the health (/obj/health): New(the grass (42,89,1) (/turf/Turf/grass))
Mike (/mob): Attack()