ID:268088
 
How do you make a hud that has a bar of health on the top of your screen? Thanks!

Non-PC
Demos. Libraries.
In response to Ease
I looked in there and I found a couple. But, sadly not what I wanted. I want the health in a retangeled bar on the top fo the screen. I can make the bar, but I have troubplewith the coding. Help will be appereciated!

I'm willing to pay 5 dimes for help!
Thanks!

Non-PC
In response to Non-PC
This is the way I did it in my game.

proc/Update_Status(mob/M as mob)
if(M.client)
for(var/obj/hud/health/H in M.client.screen)
H.icon_state = num2text(round(M.HP/M.MAX_HP,0.1)*100)
for(var/obj/hud/mana/H in M.client.screen)
H.icon_state = num2text(round(M.MP/M.MAX_MP,0.1)*100)
spawn(2)
if(M) Update_Status(M)

mob
Login()
Update_Status(src)
..()
In response to Non-PC
if you dont like the bars in the demos make your own that you like. Once youve made your bar change the width to the number of states in your bar icon.
In response to Nogboi
Wow, I can't think of any possible way you could do that any worse. Unless if you didn't use spawn(). Why do you need to update their health and mana every 1/5 of a second? Just update it when their health or mana changes! And why not store the health and mana HUD objects in a variable?
In response to Garthor
Garthor wrote:
Wow, I can't think of any possible way you could do that any worse. Unless if you didn't use spawn(). Why do you need to update their health and mana every 1/5 of a second? Just update it when their health or mana changes! And why not store the health and mana HUD objects in a variable?

Andhow exactly would you store it in a variable?
In response to Non-PC
mob
var/obj/healthHUD
var/obj/manaHUD
Login()
manaHUD = new /obj/manabar
healthHUD = new /obj/healthbar
client.screen += manaHUD
client.screen = new healthHUD
In response to Garthor
Garthor wrote:
> mob
> var/obj/healthHUD
> var/obj/manaHUD
> Login()
> manaHUD = new /obj/manabar
> healthHUD = new /obj/healthbar
> client.screen += manaHUD
> client.screen = new healthHUD
>


Garthor, I have one more question. Say if the user beats a monster, and there health increases. Will I need to enlarge the size of the bar? And if not, how do you create a code that it subtracts from the bar whenever you get hit?

I've been trying to code this for a while, but this time I came to the forum.

[Edit]

I logged in to 'Dragonball Zeta' and found what I wanted. Displays the PL in a bar on top of the screen. And when you gain PL, the number just changes, without enlarging. And no, I am not making a DBZ game.

Thanks!

Non-PC
In response to Non-PC
none of that well work lol you got to tell it when it is half way done quarter or full 3 quarters that stuff wont work dude i would help you but i am looking for the exact same stuff sry
In response to Legendary Kai
I've seen it in many games. Looks like I'm getting the help that I need yet. Hopefully, I'll get some help on the forum like I usuallly do....:\

Non-PC
In response to Non-PC
why dont you just ask the owners of those games?
In response to N1ghtW1ng
Ive tried asking the owners for help coding and every single one of them said no... I suggest a chatters game. They usually have good info.