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

[GUI] How to trigger actions upon the activation of an offensive passive

I needed a way to trigger for offensive passive abilities. There are some here and there, but I figured I'd post a Tutorial of how to create the one I produced. I made this in only a few minutes and so it is possible that it may have an unwanted side-effect, but I doubt it.

The Skeleton of the Trigger

Step 1: Creating the ability and buff. First, the passive ability should be given a buff. As the buff will not actually stay on the target, it will be best to make a custom buff with the name of your ability. Make sure to give your ability a duration time, so that the buff will last on the target for triggering's sake.
Step 2: Triggering for the Event. There are many damage detection systems, but this is a simple way to trigger for the Event. As the passive is offensive, it would be activated when a unit is attacked.
  • Events
    • Unit - A unit Is attacked
Step 3: Triggering the condition
Next, you would need to make the trigger check the attacked unit to see if it has the buff. This would ensure that your ability has been activated upon the target, even if it is a % chance ability.
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (((Attacked unit) has buff Bash ) Equal to True)
Step 4: Adding your action, and patching it up. You would then have the trigger remove the buff, so that the trigger is not triggered every time the unit is attacked, before the buff has expired.
  • If - Conditions
    • ((Attacked unit) has buff Bash ) Equal to True
  • Then - Actions
    • -------- Desired Effect --------
    • Unit - Remove Bash buff from (Attacked unit)
  • Else - Actions
  • Bash
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set AttackedUnit = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Attacked unit) has buff Bash ) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Bash Effect for (Triggering unit)) Equal to 0
            • Then - Actions
              • Unit - Add Bash Effect to AttackedUnit
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • (Level of Bash Effect for AttackedUnit) Greater than or equal to 1
                      • (Level of Bash Effect for AttackedUnit) Less than 10
                • Then - Actions
                  • Unit - Increase level of Bash Effect for AttackedUnit
                • Else - Actions
                  • Do nothing
          • Unit - Remove Bash buff from AttackedUnit
          • Wait 2.00 game-time seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Bash Effect for AttackedUnit) Greater than 1
            • Then - Actions
              • Unit - Decrease level of Bash Effect for AttackedUnit
            • Else - Actions
              • Unit - Remove Bash Effect from AttackedUnit
        • Else - Actions
Now, if the target is attacked and it has the bash buff (meaning that it has been bashed), then it will be given this ability to slow it down. The ability will reduce in effect every 2 seconds.

How to make an ability deal damage based on statistics:
To do this, you must simply make a trigger action to make the attacking unit deal a specific amount of damage to the attacked unit. Since you now know how to create the events and conditions, you would only have to change what action you have the trigger perform. You can also customize the damage type, and whether or not to deal damage based on the base stats, or to include additions from abilities and items.
  • Actions
    • Unit - Cause (Attacking unit) to damage (Triggering unit), dealing (Real((Strength of (Attacking unit) (Include bonuses)))) damage of attack type Hero and damage type Normal
Now, you could change what to deal the damage based on; it could deal damage based on your hero's level or stats, the current health of the attacking or targetted unit, the % mana, a set variable, the duration of an ability, or many other things.

For more effects, simply check out other threads about triggering active abilities and use the triggering in this section to have your passive ability be triggered.
 
Last edited:
Level 17
Joined
Jun 17, 2007
Messages
1,433
  • Remove the Do Nothing action.
  • Use triggering unit instead of attacked unit.
  • Store triggering unit in a variable since you reference it so much.
  • Unit- a unit is attacked can be abused since it doesn't fire when the unit is hit by the attack.
  • Remove your signature.
  • A demo map would be a good addition, since it may not be clear on how to use this effectively.
 
Top