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

[Trigger] Half damage taken in mana?

Status
Not open for further replies.
Level 4
Joined
Jun 22, 2009
Messages
63
Im creating an ability called Reversal Armor. it's supposed to give half the damage you take in mana. But i cant find any way to detect the damage taken.
 
Level 10
Joined
Oct 31, 2009
Messages
352
Never done this before but try:

  • Reversal Armor Learn
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Reversal Armor
    • Actions
      • Trigger - Add to Reversal Armor Cast <gen> the event (Unit - (Learning Hero) Takes damage)
      • Trigger - Turn off (This trigger)
  • Reversal Armor Cast
    • Events
    • Conditions
    • Actions
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + ((Damage taken) x 0.50))
 
Level 11
Joined
Aug 25, 2006
Messages
971
Ok what you want is actually fairly simple, however it can only be detected by the Unit Specific Unit takes damage event. You can't use a Unit Generic Unit Event.

So basically you have to register the event on every unit that learns that ability. Yes this does leak if the heroes are disposable, but usually heroes tend not to be.

  • Set Up
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Reversal Armor
    • Actions
      • Trigger - Add to DoReversal <gen> the event (Unit - (Learning Hero) Takes damage)
  • DoReversal
    • Events
    • Conditions
    • Actions
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + ((Damage taken) x 0.50))
Tested, it works hehe
 
Level 5
Joined
Nov 22, 2009
Messages
181
you could if you used custom script: set udg_unit = GetTriggerUnit()
where udg_unit is a global variable called unit then just use unit whenever referring to the attacked unit.
 
Status
Not open for further replies.
Top