ID:264049
 
Code:
mob/Login()
..()
Players += 1
src.loc = locate(1,1,1)
src.client.view = 6
src.client.screen += new/obj/Health/meter1
src.client.screen += new/obj/Health/meter2
src.UpdateHP(src)
src.icon='Player.dmi'
mob/var
hp=100
mhp=100
stam=100
mstam=100
obj
var/num = 0 // This var is used later to help set the icon state
Health
layer = MOB_LAYER+2 // Sets it at a layer above the background.
meter1
icon = 'HP1.dmi'
icon_state = "0"
screen_loc="1,1"
meter2
icon = 'HP2.dmi'
icon_state = "0"
screen_loc="1,2"
mob
proc
UpdateHP()
for(var/obj/Health/H in src.client.screen)
H.num = round(src.hp/src.mhp*100/10)
H.icon_state = H.num


Problem description: My HUD wont show up, however with what I've seen through demos and libraries I'm sure I'm doing everything right.

try chaning
H.icon_state = H.num
to
H.icon_state = "[H.num]"
In response to Falacy
That's not making it appear... I don't even see how that would fix the problem.
In response to Demon_F0rce
first off
src.UpdateHP(src)

the src inside the () does nothing here

2nd off
the num variable on the HUD objects is completely useless, unless youre using it somewhere not shown here

Demon_F0rce wrote:
That's not making it appear... I don't even see how that would fix the problem.

icon states have to be set as text

other then that the code looks fine, another possible error is mis-named icon states
In response to Falacy
Nevermind, after looking at the demo more closely and changing a couple of things I've fixed it. Thanks for the help, though.