• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Life percentage window

Status
Not open for further replies.
Level 14
Joined
Jul 12, 2011
Messages
1,371
Hey people!
I'm trying to make a window which displays the percentage of a units health (or the remaining HP if no way around) like a timer is shown (in a small windows top right corner of the screen), but I don't know how?
Any ideas?
 
Level 11
Joined
Jun 2, 2013
Messages
613
Hmm, I'd probably go with a GetLocalPlayer mulitboard that updates every few seconds. Just set a real variable to your unit's health percentage and update your multiboard with that or something along those lines. If you want to get real crazy with it, you could convert that to a string so say you Create an 'I' for every 5 or 10% of that units health; so at max health it looks like IIIIIIIIIIIIII, if you wanted to use something like that instead.
 
Level 12
Joined
May 22, 2015
Messages
1,051
There is a GUI function get a unit's % life, I'm pretty sure.

Anyway, it is easy to calculate like:
current health / max health * 100 = percent health remaining

You can display this number the same way you display the timer. Update it each second or whatever and display the timer and the % life.

EDIT:
I thought you wanted it inside a multiboard with other stuff.

A multiboard might be the best way to do it.
 
Status
Not open for further replies.
Top