• 🏆 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!

[General] When unit is damaged?

Status
Not open for further replies.
Level 3
Joined
Oct 7, 2010
Messages
30
Hey, I want to make a floating text appear above a unit telling how much damage was taken, and I've also based the damage dealt on a trigger.
Atm it basically looks like this (I do have more to remove the text but that isn't important for my question):
  • Set Damage[(Player number of (Owner of (Attacking unit)))] = (1 + ((Agility of (Attacking unit) (Exclude bonuses)) x ((Agility of (Attacking unit) (Include bonuses)) / 50)))
  • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (Real(Damage[(Player number of (Owner of (Attacking unit)))])) damage of attack type Normal and damage type Normal
  • Floating Text - Create floating text that reads (String(Damage[(Player number of (Owner of (Attacking unit)))])) above (Attacked unit) with Z offset 5.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency

My problem is that I want this action to take place once the unit is hit, not when it is attacked, but the only event action I could find to suit what I want is:
  • Unit - A unit Is attacked
So, is there any fancy way that I could fix this up so that the text and damage will both happen once the unit actually takes damage, not when an attack is initiated?


(The main problem is that in cases where the triggered damage 1hits the target, the hero never actually attacks before the other units dies, so the hero with just spin around at super speed without attacking and everything will die)


EDIT:
Ok, so I've worked out the damage detection, but now a can't have a damage action in the trigger or the event will loop itself >.< Is there any solution for this?
 
Last edited:
Level 12
Joined
Sep 11, 2011
Messages
1,176
use a Damage Detection System

GUI-Friendly Damage Detection v1.2.1

import the system to your map and you can detect the attack with this

  • Events
    • Game - GDD_Event becomes Equal to 0.00
just read the explanation on the system and you'll get everything you need.

EDIT : and if you want to create a floating text telling how much damage was taken, use GDD_Damage as the replacement of 'Damage Taken'

Additional :
Attacking Unit = GDD_DamageSource
Attacked Unit = GDD_DamagedUnit
 
Level 3
Joined
Oct 7, 2010
Messages
30
use a Damage Detection System

GUI-Friendly Damage Detection v1.2.1

import the system to your map and you can detect the attack with this

  • Events
    • Game - GDD_Event becomes Equal to 0.00
just read the explanation on the system and you'll get everything you need.

EDIT : and if you want to create a floating text telling how much damage was taken, use GDD_Damage as the replacement of 'Damage Taken'

Additional :
Attacking Unit = GDD_DamageSource
Attacked Unit = GDD_DamagedUnit
Thanks, this seems to work well mostly, but I've run into 1 problem

in the notes it says: "A common problem when using any damage detection system occurs when you try to cause the damage source to damage the damaged unit from a damage event - for example, if triggering bonus damage. This causes the unit to repeatedly damage the target, because dealing damage in the trigger causes that trigger to run again, and again in turn, infinitely. One solution is to add the action Turn off (This trigger) before dealing damage and add the action Turn on (This trigger) afterward."
This definitely applys to me, but i'm not entirely sure about the solution, it seems to just disable the bonus damage all-together atm


So, I guess my question has now become, "How can I deal damage with a damage detection event?"
 
Last edited:
Level 12
Joined
Sep 11, 2011
Messages
1,176
before you deal the damage, you need to turn off the trigger and turn it on afterwards, so it will be like this.

  • Damage Detection
    • Events
      • Game - GDD_Event becomes equal to 0.00
    • Conditions
    • Actions
      • Trigger - Turn off (this trigger)
      • Unit - Cause GDD_DamagedUnit to attack GDD_DamageSource, dealing 500.00 damage of attack type Spells and damage type Normal
      • Trigger - Turn on (this trigger)
      • //any other actions....//
 
Status
Not open for further replies.
Top