mob
var
hp = 100
icon = 'icons.dmi'
client
New()
..()
new/obj/healthbar(src) // create the healthbar object, in the clients screen
obj
healthbar
icon = 'bar.dmi'
icon_state = "10"
New(client/C)
screen_loc="2,1" // where it should appear on the screen
C.screen+=src
turf
grass
icon = 'icons.dmi'
icon_state = "grass"
mob
verb
Add_Hp()
if(usr.hp == 8) // if the user's HP is 8..
return// dont do anything
else //if not..
for(var/obj/healthbar/H in usr.client.screen)
var/is = 0
is = text2num(H.icon_state) //make the var "is" the number equivilant to H's icon state
is += 1 //add one to "is"
H.icon_state = num2text(is) //make H's icon state the text equivilant of is
usr.hp += 1 // add hp.
Subtract_Hp()
if(usr.hp == 0)
return
else
for(var/obj/healthbar/H in usr.client.screen)
var/is = 0
is = text2num(H.icon_state) //make the var "is" the number equivilant to H's icon state
is -= 1//subtract one from "is"
H.icon_state = num2text(is)//make H's icon state the text equivilant of is
usr.hp -= 1 //subtract HP
I put the hp on 100, and i put the subtract health var to - one. Shouldn't it take 100 hits on the subtract verb to empty the health bar? Apparently it doesn't. It takes ten. Any help?
It is subtracting 1 for each /obj/healthbar on the screen. Outdent that last line.