• 🏆 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] Defend ability with bonus armor when active

Status
Not open for further replies.
Level 6
Joined
Jul 22, 2021
Messages
50
Hello,

so as title says I want the "Defend" ability to activate bonus armor when it's active.

What I did to make it work:
  • added "Armor Bonus" ability based on Devotion Aura (but works only on self);
  • disabled said ability at the start of the game;
  • when Defend is being used it enables Armor Bonus ability;
  • if Defend is being used again it disables armor ability.
Below you can find the triggers I did:
  • Defend On
    • Events
      • Unit - Footman Scout (Melee Stance) 0022 <gen> Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Defend
    • Actions
      • Player - Enable Armor Bonus for Player 2 (Blue)
      • Trigger - Turn off (This trigger)
      • Trigger - Turn on Defend Off <gen>
  • Defend Off
    • Events
      • Unit - Footman Scout (Melee Stance) 0022 <gen> Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Defend
    • Actions
      • Player - Disable Armor Bonus for Player 2 (Blue)
      • Trigger - Turn off (This trigger)
      • Trigger - Turn on Defend On <gen>
I'm not sure what I do wrong, I tried a few variations but can't find the way to do it right.
 
Level 7
Joined
Jun 1, 2009
Messages
104
I have a similar function in my map and it works fine via A unit is issued an order function. Yours should be like:

  • Defend
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player number of (Owner of (Ordered unit))) Equal to 2
          • (Unit-type of (Ordered unit)) Equal to Footman Scout
        • Then - Actions
          • -------- Order: defend --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(defend))
            • Then - Actions
              • Player - Enable Armor Bonus for Player 2 (Blue)
            • Else - Actions
          • -------- Order: undefend --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(undefend))
            • Then - Actions
              • Player - Disable Armor Bonus for Player 2 (Blue)
            • Else - Actions
      • Else - Actions
It is possible to add\remove different spells for different players and unit types by the same order defend\undefend. Just add proper conditions.
 
Last edited:

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,887
Google is your friend.
 
Level 6
Joined
Jul 22, 2021
Messages
50
I have a similar function in my map and it works fine via A unit is issued an order function. Yours should be like:

  • Defend
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player number of (Owner of (Ordered unit))) Equal to 2
          • (Unit-type of (Ordered unit)) Equal to Footman Scout
        • Then - Actions
          • -------- Order: defend --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(defend))
            • Then - Actions
              • Player - Enable Armor Bonus for Player 2 (Blue)
            • Else - Actions
          • -------- Order: undefend --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(undefend))
            • Then - Actions
              • Player - Disable Armor Bonus for Player 2 (Blue)
            • Else - Actions
      • Else - Actions
It is possible to add\remove different spells for different players and unit types by the same order defend\undefend. Just add proper conditions.
Thanks, based on your trigger I managed to make it work. Actually changed the base ability for Armor Bonus from Devotion Aura to Item Armor. Works just as I wanted.
For anyone interested you can find the working trigger in the spoiler below.

  • Defend
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Triggering unit) Equal to Footman Scout (Melee Stance) 0022 <gen>
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(defend))
        • Then - Actions
          • Unit - Add Armor Bonus to Footman Scout (Melee Stance) 0022 <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(undefend))
        • Then - Actions
          • Unit - Remove Armor Bonus from Footman Scout (Melee Stance) 0022 <gen>
        • Else - Actions

@Wrda thanks for linking resources, will look them up. Didn't googled good enough so I couldn't find those.
 
Status
Not open for further replies.
Top