ID:261696
 
mob
var hp= 50
mob/proc
HPRefresh() // The hp proc. Call this whenever hp adds and or subtratcs
for(var/obj/hpnumber/H in client.screen) // For var/hpnumber/N in client.screen
H.icon_state = "[copytext(num2text(round(hp),50),H.position,H.position+1)]"// Changes the icon state to what's needed
//The hud. AKA. Objects
obj
hpnumber
layer = MOB_LAYER+55
icon = 'Numbers.dmi'
screen_loc = "5,5"
pixel_y = 16
var/position = 0
New(client/C,num_position)
position = num_position
screen_loc = "2:[(position-1)*8],11"
C.screen+=src
hpicon
layer=MOB_LAYER+56
icon='hud.dmi'
icon_state="hp"
New(client/C) screen_loc = "1,11", C.screen+=src
black
icon='hud.dmi'
icon_state="black"
New(client/C) screen_loc = "1,11 to 11,11", C.screen+=src

//Login, inwhich will call the HPRefresh. Call the src.HPRefresh() wherever the character gets or looses HP.




//The client/New(), simply displays the hud on the client.
client
New()
new/obj/black(src)
new/obj/hpicon(src)
..()


That is my code for Health. But for some unknown reason, the HUD number just stays at 50. I've tried putting the var HP = [m.Health], and all that, but no dice. Then I tried putting m.hp into my attack verb. Still no dice. Erm, so, what exactly do I have to do to link the Health variable into this one? I'm extremely confused and I cannot think straight. Any help is appreciated.
Don't bother if you have no clue what the heck I am talking about. I, myself barely know what the heck I'm even trying to say.
In response to Dark-Xero
Well hmm Just at a glance I dont know Im stupid and no nothing but.
H.icon_state = "[copytext(num2text(round(hp),50),H.position,H.position+1)]"//
in that code this part round(hp),50)?? Whats up with the 50 cheack that out I think that might have somthing to do with the problem. Then again Like I say Im stupid and no nothing.
Dark-Xero wrote:
mob
var hp= 50
mob/proc
HPRefresh() // The hp proc. Call this whenever hp adds and or subtratcs
for(var/obj/hpnumber/H in client.screen) // For var/hpnumber/N in client.screen
H.icon_state = "[copytext(num2text(round(hp),50),H.position,H.position+1)]"// Changes the icon state to what's needed
//The hud. AKA. Objects
obj
hpnumber
layer = MOB_LAYER+55
icon = 'Numbers.dmi'
screen_loc = "5,5"
pixel_y = 16
var/position = 0
New(client/C,num_position)
position = num_position
screen_loc = "2:[(position-1)*8],11"
C.screen+=src
hpicon
layer=MOB_LAYER+56
icon='hud.dmi'
icon_state="hp"
New(client/C) screen_loc = "1,11", C.screen+=src
black
icon='hud.dmi'
icon_state="black"
New(client/C) screen_loc = "1,11 to 11,11", C.screen+=src

//Login, inwhich will call the HPRefresh. Call the src.HPRefresh() wherever the character gets or looses HP.




//The client/New(), simply displays the hud on the client.
client
New()
new/obj/black(src)
new/obj/hpicon(src)
..()


That is my code for Health. But for some unknown reason, the HUD number just stays at 50. I've tried putting the var HP = [m.Health], and all that, but no dice. Then I tried putting m.hp into my attack verb. Still no dice. Erm, so, what exactly do I have to do to link the Health variable into this one? I'm extremely confused and I cannot think straight. Any help is appreciated.

call the HPRefresh() proc wherever you gain/lose health.

RaeKwon
In response to RaeKwon
To keep from having to wait, just make it call in the stats panel, so it will auto call every so oftin, i suppose this could make lag, but its a easy way of doing it and not having to add it to every attack, posion, so on and so forth.
In response to RaeKwon
dont you have a demo like that raekwon?
In response to Zaltron
he is using rae demo if im not mistaken.
In response to Scoobert
Scoobert wrote:
he is using rae demo if im not mistaken.

he wrote "That is my code for Health. But for some unknown reason, the HUD number just stays at 50. I've tried putting the var HP = [m.Health], and all that, but no dice. Then I tried putting m.hp into my attack verb. Still no dice. Erm, so, what exactly do I have to do to link the Health variable into this one? I'm extremely confused and I cannot think straight. Any help is appreciated."

i'm not sure if hese saying he made that whole code or not. this is raekwon's coding i'm just wondering if hese trying to take credit for raekwons work.
In response to Zaltron
He said in another post(newbie central i think) that he was using rae's hub code and needed help.
In response to Scoobert
I never saw that post. My mistake.