ID:151088
 
i have this health meter that pops up over the thing you attack in life story showing how much health they have left. the problem is that i cant get it to disapear.heres some code
obj/life
icon = 'metero.dmi'
icon_state = "0" //that's zero, not ( ) or O
var/num = 0
var/icon_states = 30
proc/Update()
src.icon_state = "[round(src.num)]"
mob
var
obj/life/life


New()
..()
src.life = new /obj/life

mob/proc/hurt()
src.overlays += src.life
src.life.num = (src.health/src.maxhealth)*src.life.icon_states
src.life.Update()

mob/proc/hurt()
src.overlays += src.life
src.life.num = (src.health/src.maxhealth)*src.life.icon_states
src.life.Update()

It looks to me like you are adding a new overlay every time you call <code>hurt()</code>. When you do that, it essentially takes a snapshot of the object at that moment in time and turns it into an overlay. You are probably ending up with a big stack of overlays as a result.

Try something like this:

mob/proc/hurt()
   overlays -= life  //remove old snapshot
   life.num = //blah
   life.Update()
   overlays += life  //add a new snapshot