• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[Spell] When a unit is damaged while having a specific buff...

Status
Not open for further replies.
Level 3
Joined
Jul 4, 2013
Messages
35
I tried to make a trigger under the idea that a hero has a non-hero ability with multiple levels that places a buff on them, and when they are damaged by an attack while this buff is active, they will restore mana. At level 4, it will also damage the attacker.

Unfortunately, this is easier said than done. Sadly, there is no trigger event function that runs specifically on a damage event, and "Is attacked" is an exploitable function. Here is how it currently looks:

  • Barkskin Attacked
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacked unit) Equal to Hero
      • (Hero has buff Barkskin (Hero)) Equal to True
      • ((Attacking unit) belongs to an enemy of (Owner of Hero)) Equal to True
    • Actions
      • Unit - Set mana of Hero to ((Mana of Hero) + 2.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Barkskin for Hero) Equal to 4
        • Then - Actions
          • Unit - Cause Hero to damage (Attacking unit), dealing 5.00 damage of attack type Spells and damage type Normal
          • Special Effect - Create a special effect attached to the origin of (Attacking unit) using Abilities\Weapons\TreantMissile\TreantMissile.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
I'm posting this here rather than the Trigger help zone, as I'm asking how I can perform what I'm trying to accomplish in JASS, since it's beyond what GUI can easily do. I have never dabbled in JASS before and I am fully willing to learn how to try it out.
 
Level 24
Joined
Feb 9, 2009
Messages
1,786
I'd highly recommend Damage Detection, which will solve this easily:

  • Barkskin Attacked
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • DamageEventTarget Equal to Hero
      • ([U]Hero[/U] has buff Barkskin (Hero)) Equal to True
      • ((DamageEventSource) belongs to an enemy of (Owner of Hero)) Equal to True
    • Actions
      • Unit - Set mana of Hero to ((Mana of Hero) + 2.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Barkskin for Hero) Equal to 4
        • Then - Actions
          • Unit - Cause Hero to damage DamageEventSource , dealing 5.00 damage of attack type Spells and damage type Normal
          • Special Effect - Create a special effect attached to the origin of (Attacking unit) using Abilities\Weapons\TreantMissile\TreantMissile.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
You could even replace Hero with DamageEventTarget
 
Level 3
Joined
Jul 4, 2013
Messages
35
I will take a look at this, thank you. I'll let you know how the spell turns out after the fact.





EDIT: This is the solution I needed. Much appreciated, and will absolutely be looking into what more I can do with this tool.
 
Last edited:
Status
Not open for further replies.
Top