• 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.

[Trigger] Hero Damage Text Indicator

Status
Not open for further replies.
Level 3
Joined
Sep 14, 2008
Messages
9
Hi all,

I am new to the forum and have been looking for an easy way to show damage being done to a "unit" (in this case a unit variable containing my hero). So keep in mind that this is my first attempt.

While this GUI trigger is not perfect it doesn't leak and seems to work with a small margin for error (the error being that if your hero is regenerating life it is factored into the output)

I have seen some other ways of doing a % life floating text but I wanted just the life loss to be shown.

--variables--
Hero (Unit, set to my hero unit in another trigger)
Life1 (Integer, set to the current life of "Hero" before the wait)
Damage (Integer, set to the difference between "Life1" and current life of "Hero" after the wait)
damgtext (Floating Text, set to the text created in this trigger)

  • Damage indicator
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Floating Text - Destroy damgtext
      • Set Life1 = (Integer((Life of Hero)))
      • Wait 0.50 seconds
      • Set Damage = ((Integer((Life of Hero))) - Life1)
      • Floating Text - Create floating text that reads (String(Damage)) above Hero with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
      • Set damgtext = (Last created floating text)
      • Wait 0.50 seconds
      • Floating Text - Destroy damgtext
      • Trigger - Turn on (This trigger)
Please let me know if there is a better way of doing this (with the GUI). I also welcome any suggestions on how to make this trigger better.

-Eamon
 
Level 3
Joined
Sep 14, 2008
Messages
9
With this map as it is now you "buy" your hero from a building and do not start with one...

That trigger was my first choice but I have not found a way to select my hero using that event trigger.

The "unit takes damage" Event Trigger is only available under the "Specific Unit Event" category and is not listed under the "Player-Owned Unit Event" or "Generic Unit Event" categories. As my Hero unit dose not stat on the map... I can not select it as a Specific Unit... also the Unit Variable I made to hold my hero is likewise not selectable.

-Eamon
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
To add variables to that event you will need to add it from another trigger using the "Add Event" action.

If you want this to be global (works for every unit), you will need to register a new event for each unit that enters the map.
Do notice that this will leak one event per unit that can die/be removed, but the only option without leaking is using Jass and I don't think you know Jass :p
 
Status
Not open for further replies.
Top