• 🏆 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 Text (GUI)

Status
Not open for further replies.
Level 5
Joined
Jun 28, 2010
Messages
110
I wonder how to create a permanent floating text and remove it manually.
The system i want just like this:
Show up hit point of a unit (i call it just only for a BOSS).
For e.g, it has 200000 HP. the floating text 200000/200000 should be show up right above the normal hit point bar of the BOSS.
However, when it take damage (for example is 15700), the floating text immediately change to the value 184300/200000 and so ....
When the boss is dead, the floating text would show up 0/200000 for 10 seconds and then disappear (with fading).

***: The seconds one is the percentage of the BOSS Hit point, like above. 200000 = 100%, when it lost 10000 HP -> it should be 90% and so. But this floating text is above the Value floating text:
---------------Percentage Text-------------------
---------------Hit Point Value ---------------------
---------------Normal Hit Point Bar ----------------

For example:
------------------100%---------------------
------------200000/200000------------------
------------Normal Hit Point Bar--------------

Picture below for more information :)
 

Attachments

  • DotA-Mana-bars.JPG
    DotA-Mana-bars.JPG
    76 KB · Views: 197
Level 29
Joined
Oct 24, 2012
Messages
6,543
You have to repeatedly create a new floating text to update the string / position of it.

The white bars would need to be a texture / unit or something.

You use a DDS. (Unit attacked event trigger may work) If that fires before damage is taken you need DDS.
When the damaged unit with conditions and check if it is the unit you want.
Then create floating text above unit.
For percent you can use the percent of life to display the value.
For the health use string = unit life + / + unit max life.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
creating permanent text is easy, sadly you need to update the variables so that makes it a little harder.

I'd try something like this.
  • Actions
    • Set your_unit_variable = (Triggering unit)
    • Set your_location_variable = (Position of your_unit_variable)
    • Floating Text - Destroy text1
    • Floating Text - Destroy text2
    • Floating Text - Create floating text that reads (String((Life of your_unit_variable))) at (your_location_variable offset by 50.00 towards 90.00 degrees) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
    • Set text1 = (Last created floating text)
    • Floating Text - Create floating text that reads (String((Percentage life of your_unit_variable))) at (your_location_variable offset by 50.00 towards 90.00 degrees) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
    • Set text2 = (Last created floating text)
    • Custom script: call RemoveLocation(udg_your_location_variable)
 
Status
Not open for further replies.
Top