• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Floating Texts Health+Mana Bars

Status
Not open for further replies.
Level 11
Joined
May 26, 2009
Messages
760
Greetings,

I wish to request assistance in making some triggers for a map of mine (my only uploaded map) that I cannot make myself. I need health and mana bars which updates and follows units frequently like in the illustration below.

healthmanabars.png

This picture is an illustration of how the end results would preferably look.

In this map there are 4 players, and 4 unit types will have bars over them. 2 of these units have no mana and thus do not require a mana bar, only the health bar. I would much prefer if showing health and mana or just health and no mana would be easily customizable because I have future ideas of adding more unit types.

The picture uses one hundred | of these vertical bars and could act as percent. When mana is used the rest of the bar is simply grayed out in the picture. However, I would much like it if the health bar also grayed out like the mana bar but at the same time faded into a yellowish and then redder and redder color (would help the healer a lot).

Additionally I can say that it is only 1 unit that uses this per player so it only has to be MPI if you find it easier. Also let me know if you need more information.

I highly appreciate the help!
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
At first I though it didn't work because I couldn't see the bar. I turned out the floating text size was too small for 1920x1080 resolution. I increased it to 4 and it was okay then.

A few notes:
*You have Key(PickedUnit) in AddAdditionalAdd.
*No need to save the handle in the looping trigger.
*You don't need separate point variables for health and mana, use the same for both.
*When you clear the parent hashtable, the system won't work for units that are created after that.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
I know about points, I just used them to clearly see what is going on.

Yeah saving while looping in uneeded, and that mistake with picked unit :|
I forgot about issue with clearning hashtable, thanks Maker.

EDIT Fixed. Map above.
By the way, why you have problem with size of bars? For me they are small, smooth bars and everything was okey.
Although my computer is 11 years old, meaby thats why..
 
Level 11
Joined
May 26, 2009
Messages
760
I was on a MacBook Pro from this very year when I tested and had to set text size to 6 for it to work. All other numbers work fine on my PC at home. Has nothing to do with this specific map though.

Dare I ask you the courtesy of considering to add the "green>yellow>red" transition to the health? Similar to how the health of a unit looks like. It would be much appreciated.

Thank you so far tho!
 
Last edited:

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Map updated, added colors of strings. You can easily customize them changing the value in string variables. Use Warcraft model editor or Pyritie's colorizer for getting strings. Tip: while pasting new value into string variable remove last '|r' part.

EDIT: Sorry for forgetting about uploading new version. Should be oket now.
 
Last edited:
Level 11
Joined
May 26, 2009
Messages
760
Map updated, added colors of strings. You can easily customize them changing the value in string variables. Use Warcraft model editor or Pyritie's colorizer for getting strings. Tip: while pasting new value into string variable remove last '|r' part.

After some tinkering I must admit I do not fully understand how to use this in order to get the effect I desire?

Anyways I implemented the triggers and it looks great (except for the little thing about it not getting redder). Thanks a bunch anyway I really do appreciate it!
 
Status
Not open for further replies.
Top