mob
var/previouspowerlevel = 0
var/tmp/obj/pl/pl = new // add the tmp var
proc/barupdate()
var/n = round((powerlevel / powerlevel_max) * 100, 10) // calculate the percent
if(n > 100)
n = 101
if(n < 0)
n = 0
pl.icon_state = "[n]" // set the icon state
Stat()
..()
if(previouspowerlevel != powerlevel)
previouspowerlevel = powerlevel
Stat()
..()
if(previouspowerlevel != powerlevel)
previouspowerlevel = powerlevel // set this so it doesn't update every tick
spawn()
barupdate() // update the bar
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
obj
pl
icon='Heallthbar(1).dmi'
layer = 100
pixel_y = -32
Problem description:
The Health Bar don't go up or down it just stay's Full, can someone tell me what i did wrong ?