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

[Solved] Best dummy ability to trigger "A unit Finishes casting an ability" with an attack?

Level 3
Joined
Apr 10, 2023
Messages
11
Hi,
i'm looking for a way to start a trigger by having a unit cast an effect on an enemy unit via it's attack (I tried to use EnvenomedWeapons, but it seems trigger can't be activated by casting passive abilities). All abilities i found with the necessary criteria (effect for the enemy unit over a specified amount of time, triggered by a unit's attack & autocast/autoapply) seemed to be passive abilities. I'm not that familiar with abilities in this game, so I'm kind of stuck :(
Any help will be highly appreciated :D
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
You can use this Event:
  • Events
    • Unit - A unit is attacked
This happens when the attack launches, prior to hitting the enemy. It's more suited for preventing an attack than creating a custom attack-based ability.

To detect when an attack actually strikes the opponent you can use the Damage Events:
  • Events
    • Unit - A unit Takes damage
    • Unit - A unit About to take damage
These generic ones are only available in patch 1.31+ I believe.

Here's an example:
  • Damage Ability Example
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Level of Critical Strike for (Damage source)) Greater than or equal to 1
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 50
        • Then - Actions
          • Unit - Kill (Damage Target)
          • Game - Display to (All players) for 5.00 seconds the text: Super crit!
        • Else - Actions
This trigger gives any unit with the Critical Strike ability a 50% chance to instantly kill the unit it damages. Note that I haven't added any Conditions to check the type of damage, so these Actions will run from spell damage and other sources of damage that our unit may have. There are a bunch of Damage Event related functions at your disposal to manage this.

There's also Bribe's Damage Engine which has you covered on pretty much any patch.
It gives you far greater control and helps prevent things like creating infinite damage loops.
 
Level 3
Joined
Apr 10, 2023
Messages
11
Thank you :D I still used EnvenomedWeapons as dummy effect for timing the desired effect but changing the event for the trigger to "A Unit is attacked" in combination with some conditions worked perfectly!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
Thank you :D I still used EnvenomedWeapons as dummy effect for timing the desired effect but changing the event for the trigger to "A Unit is attacked" in combination with some conditions worked perfectly!
Keep in mind this attack Event is highly exploitable. Simply ordering your unit to attack, stop, attack in rapid succession will fire the Event over and over again. A user privy to this could easily make the trigger run 20 times per second.

I remember back in DotA 1 that's how Spiritbreaker's Bash was triggered. It was fun permastunning people with that :p

Damage Engine or the "new" Damage Events are almost always the way to go.
 
Level 3
Joined
Apr 10, 2023
Messages
11
Keep in mind this attack Event is highly exploitable. Simply ordering your unit to attack, stop, attack in rapid succession will fire the Event over and over again. A user privy to this could easily make the trigger run 20 times per second.

I remember back in DotA 1 that's how Spiritbreaker's Bash was triggered. It was fun permastunning people with that :p

Damage Engine or the "new" Damage Events are almost always the way to go.
Oh :D Welp I guess I'm trying this with Damage Engine then ^^
 
Level 3
Joined
Apr 10, 2023
Messages
11
Also, unrelated to this but I don't want to spam the forum with a lot of post, could you help me with this trigger? It is supposed to give a unit a chance of inflicting splash damage and giving this ability to the unit was easy enough. However, I wanted it to remove the ability once the unit had attacked a second time (Unit has buff true/false in the trigger) but the ability doesn't get removed.
  • SplashChanceAbility
    • Events
      • Unit - A unit is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) = SplashUnit1
          • (Unit-type of (Attacking unit)) = SplashUnit2
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • (Owner of (Attacking unit)) = Player 1 (Red)
        • 'THEN'-Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Conditions
              • ((Attacking unit) has buff SplashChanceAbility ) = False
            • 'THEN'-Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Conditions
                  • (Random integer number between 1 and 100) Less than or equal to SplashChangeBuildingVariableP1
                • 'THEN'-Actions
                  • Unit - Add SplashChanceAbility to (Attacking unit)
                • 'ELSE'-Actions
            • 'ELSE'-Actions
              • Einheit - Remove SplashChanceAbility from (Attacking unit)
        • 'ELSE'-Actions
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
Where does the buff come from?

I think it'd make more sense to check for ability level anyway:
  • SplashChanceAbility
    • Events
      • Unit - A unit is attacked
    • Conditions
      • (Owner of (Attacking unit)) = Player 1 (Red)
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) = SplashUnit1
          • (Unit-type of (Attacking unit)) = SplashUnit2
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • (Level of SplashChanceAbility for (Attacking unit)) Equal to 0
        • 'THEN'-Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Conditions
              • (Random integer number between 1 and 100) Less than or equal to SplashChangeBuildingVariableP1
            • 'THEN'-Actions
              • Unit - Add SplashChanceAbility to (Attacking unit)
            • 'ELSE'-Actions
        • 'ELSE'-Actions
          • Unit - Remove SplashChanceAbility from (Attacking unit)
Also, I removed the unnecessary If Then Else and moved the Player condition to the Conditions block up above.
 
Top