ID:140943
 
Code:
client
New()
..()
new/obj/health1(src)
new/obj/health2(src)
new/obj/health3(src)
new/obj/health4(src)
new/obj/health5(src)
new/obj/health6(src)

obj
health1
icon='health bar base.dmi'
icon_state="1"
layer=5
New(client/C)
screen_loc="1,11"
C.screen+=src
health2
icon='health bar base.dmi'
icon_state="2"
layer=5
New(client/C)
screen_loc="2,11"
C.screen+=src
health3
icon='health bar base.dmi'
icon_state="3"
layer=5
New(client/C)
screen_loc="3,11"
C.screen+=src
health4
icon='health bar 1.dmi'
icon_state="13"
layer=5
New(client/C)
screen_loc="1,11"
C.screen+=src
health5
icon='health bar 2.dmi'
icon_state="6"
layer=5
New(client/C)
screen_loc="2,11"
C.screen+=src
health6
icon='health bar 3.dmi'
icon_state="1"
layer=5
New(client/C)
screen_loc="3,11"
C.screen+=src


mob
proc
check_hp()
if(usr.hp < (usr.maxhp * 1.00))
for(var/obj/health6/H in usr.client.screen)
H.icon_state="1"
for(var/obj/health5/H in usr.client.screen)
H.icon_state="full"
for(var/obj/health4/H in usr.client.screen)
H.icon_state="full"
if(usr.hp < (src.maxhp * 0.95))
for(var/obj/health6/H in usr.client.screen)
H.icon_state="2"
for(var/obj/health5/H in usr.client.screen)
H.icon_state="full"
for(var/obj/health4/H in usr.client.screen)
H.icon_state="full"
if(usr.hp < (usr.maxhp * 0.90))
for(var/obj/health6/H in usr.client.screen)
H.icon_state="3"
for(var/obj/health5/H in usr.client.screen)
H.icon_state="full"
for(var/obj/health4/H in usr.client.screen)
H.icon_state="full"
if(usr.hp < (usr.maxhp * 0.85))
for(var/obj/health6/H in usr.client.screen)
H.icon_state="4"
for(var/obj/health5/H in usr.client.screen)
H.icon_state="full"
for(var/obj/health4/H in usr.client.screen)
H.icon_state="full"
if(usr.hp < (usr.maxhp * 0.80))
for(var/obj/health6/H in usr.client.screen)
H.icon_state="5"
for(var/obj/health5/H in usr.client.screen)
H.icon_state="full"
for(var/obj/health4/H in usr.client.screen)
H.icon_state="full"
if(usr.hp < (usr.maxhp * 0.75))
for(var/obj/health6/H in usr.client.screen)
H.icon_state="6"
for(var/obj/health5/H in usr.client.screen)
H.icon_state="6"
for(var/obj/health4/H in usr.client.screen)
H.icon_state="full"
if(usr.hp < (usr.maxhp * 0.60))
for(var/obj/health6/H in usr.client.screen)
H.icon_state="7"
for(var/obj/health5/H in usr.client.screen)
H.icon_state="7"
for(var/obj/health4/H in usr.client.screen)
H.icon_state="full"
if(usr.hp < (usr.maxhp * 0.55))
for(var/obj/health6/H in usr.client.screen)
H.icon_state="8"
for(var/obj/health5/H in usr.client.screen)
H.icon_state="8"
for(var/obj/health4/H in usr.client.screen)
H.icon_state="full"
if(usr.hp < (usr.maxhp * 0.50))//problem starts about here
for(var/obj/health5/H in usr.client.screen)
H.icon_state="9"
for(var/obj/health4/H in usr.client.screen)
H.icon_state="full"
if(usr.hp < (usr.maxhp * 0.45))
for(var/obj/health5/H in usr.client.screen)
H.icon_state="10"
for(var/obj/health4/H in usr.client.screen)
H.icon_state="full"
if(usr.hp < (usr.maxhp * 0.40))
for(var/obj/health5/H in usr.client.screen)
H.icon_state="11"
for(var/obj/health4/H in usr.client.screen)
H.icon_state="full"
if(usr.hp < (usr.maxhp * 0.35))
for(var/obj/health5/H in usr.client.screen)
H.icon_state="12"
for(var/obj/health4/H in usr.client.screen)
H.icon_state="full"
if(usr.hp < (usr.maxhp * 0.30))
for(var/obj/health5/H in usr.client.screen)
H.icon_state="13"
for(var/obj/health4/H in usr.client.screen)
H.icon_state="13"
if(usr.hp < (usr.maxhp * 0.25))
for(var/obj/health5/H in usr.client.screen)
H.icon_state="14"
for(var/obj/health4/H in usr.client.screen)
H.icon_state="14"
if(usr.hp < (usr.maxhp * 0.20))
for(var/obj/health4/H in usr.client.screen)
H.icon_state="15"
for(var/obj/health4/H in usr.client.screen)
H.icon_state="15"
if(usr.hp < (usr.maxhp * 0.15))
for(var/obj/health4/H in usr.client.screen)
H.icon_state="16"
if(usr.hp < (usr.maxhp * 0.10))
for(var/obj/health4/H in usr.client.screen)
H.icon_state="17"
if(usr.hp < (usr.maxhp * 0.5))
for(var/obj/health4/H in usr.client.screen)
H.icon_state="18"


Problem description:
hp bar works until it hp reaches 50% and then part of bar disappears and doesn't appear until you die. i cant find what is wrong here
.... Please, don't do that. Name each icon state a percentage, than determine the percentage and name the icon state at that percentage using round, and the formula to calculate percentages (x/y*100).
In response to Demon_F0rce (#1)
thanks for help again:D
In response to Martys1103 (#2)
Just for reference to your original question (I didn't actually read it, I was too much "OMG how does that even compile?!" to care about it XD) you were accessing an icon state that didn't exist, so Dream Seeker followed accordingly. It just assumed that the icon state was equivalent to a null icon.
Let me point out: http://www.byond.com/developer/Jotdaniel/Multitilestatmeter

There are... better ways to do that.
In response to Demon_F0rce (#3)
I don't see why people don't use the Bar thingy in the skin sutff...yea

Bars are so much of an easier way to do it too =)

Take Howey's library/demo for an example ._. less coding, yet Works perfectly fine =)

I'm using his demo for EXP =D
In response to Toushiroa (#5)
I've seen it, and it's pretty good. However, some people prefer there interactive HUD-type thingies.