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

Detecting damage and then creating floating text

Status
Not open for further replies.
Level 6
Joined
May 8, 2010
Messages
150
Basically, i need a trigger..

I want the trigger to display floating text above a unit and then dissapear.
But i want it to be automatically created when a unit is attacked, and the floating text to show how much damage was dealt in the floating text.

But the unit may be spawned, so you cant use event response - damage taken.

If you understand me?

ive tried for hours trying to make this work.. but ive given up and now asking for help.

USEFUL HELP = +REP
 
You mean you want it whenever a summoned unit attacks the damage to be displayed? If so,
  • One
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Three <gen> the event (Unit - (Picked unit) Takes damage)
  • Two
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to Three <gen> the event (Unit - (Triggering unit) Takes damage)
  • Three
    • Events
    • Conditions
      • ((Damage source) is Summoned) Equal to True
    • Actions
      • Set Damage = (Damage taken)
      • Floating Text - Create floating text that reads (String((Integer(Damage)))) above (Triggering unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
View attachment Damage and Floating Text.w3x

In the test-map, summon the Water Elemental; you will realize that only when the elemental attacks the damage is displayed and not when the Archmage attacks.
 
Level 16
Joined
Sep 26, 2005
Messages
1,088
Yeap, you can. First of all, create a trigger with no event and action:

  • One
    • Events
    • Conditions
    • Actions
      • set Point = (Position of (Triggering unit))
      • Floating text - Create floating text that reads (integer(Event Response - Damage taken)) at (position of (triggering unit)) using font size 8, color (100%, 100%, 100%), and 0% transparency
      • Floating Text - Set velocity of (Last created floating text) to 64 towards 90 degrees
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
      • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
      • Custom script: call RemoveLocation (udg_Point)
and another one:

  • Two
    • Events
      • Unit - A unit enter (Playable map area)
    • Conditions
      • ((Triggering unit) is in TextGroup) Not equal to True
    • Actions
      • Trigger - Add to One <gen> the event (Unit - (Triggering unit) takes damage)
      • Unit Group - Add (Triggering unit) to TextGroup)
and this one:

  • Three
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set TempGrp = (Units in (Playable map area))
      • Unit Group - Pick every unit in TempGrp and do (Actions)
        • Unit Group - Add (picked unit) to TextGroup
      • Custom Script: call DestroyGroup(udg_TempGrp)
And tell me if it works.
 
Level 6
Joined
May 8, 2010
Messages
150
You mean you want it whenever a summoned unit attacks the damage to be displayed? If so,
  • One
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Three <gen> the event (Unit - (Picked unit) Takes damage)
  • Two
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to Three <gen> the event (Unit - (Triggering unit) Takes damage)
  • Three
    • Events
    • Conditions
      • ((Damage source) is Summoned) Equal to True
    • Actions
      • Set Damage = (Damage taken)
      • Floating Text - Create floating text that reads (String((Integer(Damage)))) above (Triggering unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
View attachment 85344

In the test-map, summon the Water Elemental; you will realize that only when the elemental attacks the damage is displayed and not when the Archmage attacks.

I mean like.. in a respawn system.

But il use what youve created an adapt :)



+ Tested and finished.
Thankyou once again pharoah!
 
Last edited:
Status
Not open for further replies.
Top