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

Any way to make this trigger work?

Status
Not open for further replies.
Level 3
Joined
Jan 11, 2018
Messages
23
  • EndBattle
    • Events
      • Unit - A unit Dies
    • Conditions
      • CurrentWarZone Greater than 0
    • Actions
      • For each (Integer A) from 1 to CurrentWarZone, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Number of units in (Units in WarZone[(Integer A)] matching ((((Matching unit) is alive) Equal to True) and ((Owner of (Matching unit)) Equal to (Player(((Player number of (Owner of DefendingArmy[(Integer A)])) + 1))))))) Less than 1
            • Then - Actions
              • Game - Display to (All players) the text: It's over!
              • Set VictoryPosition = (Position of AttackingArmy[WriteIndex])
              • Camera - Pan camera for (Owner of AttackingArmy[WriteIndex]) to VictoryPosition over 0.00 seconds
              • Camera - Pan camera for (Owner of DefendingArmy[WriteIndex]) to VictoryPosition over 0.00 seconds
              • Unit - Unhide AttackingArmy[WriteIndex]
              • Unit - Unhide DefendingArmy[WriteIndex]
              • Unit - Kill DefendingArmy[WriteIndex]
              • Floating Text - Create floating text that reads ((Name of (Owner of AttackingArmy[WriteIndex])) + victory!) at VictoryPosition with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
              • Animation - Play AttackingArmy[WriteIndex]'s attack animation
              • Unit - Create 1 SkullPile for Neutral Passive at VictoryPosition facing Default building facing degrees
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in (Units in WarZone[(Integer A)] matching ((((Matching unit) is alive) Equal to True) and ((Owner of (Matching unit)) Equal to (Player(((Player number of (Owner of AttackingArmy[(Integer A)])) + 1))))))) Less than 1
                • Then - Actions
                  • Game - Display to (All players) the text: It's over!
                  • Set VictoryPosition = (Position of DefendingArmy[WriteIndex])
                  • Camera - Pan camera for (Owner of AttackingArmy[WriteIndex]) to VictoryPosition over 0.00 seconds
                  • Camera - Pan camera for (Owner of DefendingArmy[WriteIndex]) to VictoryPosition over 0.00 seconds
                  • Unit - Unhide AttackingArmy[WriteIndex]
                  • Unit - Unhide DefendingArmy[WriteIndex]
                  • Unit - Kill AttackingArmy[WriteIndex]
                  • Floating Text - Create floating text that reads ((Name of (Owner of DefendingArmy[WriteIndex])) + victory!) at VictoryPosition with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
                  • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
                  • Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
                  • Animation - Play DefendingArmy[WriteIndex]'s attack animation
                  • Unit - Create 1 SkullPile for Neutral Passive at VictoryPosition facing Default building facing degrees
                • Else - Actions
I know I forgot to remove the victory position leak, but that's not the point. The point is making this trigger work for multiple instances of battles ending. It just acts weird, eg. when there are no units in battlefield 1 and an unit in battlefield 2 dies, the trigger will still fire. Any way to fix it?
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,892
1. Why is there "Or -Any conditions" there if you only use one?
2. you also leak unit groups on that condition (Units in WarZone....) creates a group
3. Why you make "Integer A +1", and what is WriteIndex?
Hard to know what's wrong when you dont give us enough information about what the trigger is supposed to do and at what point of the trigger doesn't work.
The point is making this trigger work for multiple instances of battles ending.
what does that even mean? Multiple endings for the same battle?
 
Level 3
Joined
Jan 11, 2018
Messages
23
Thanks ned that worked out, and Wrda ty to u too for hinting out the group leak. The integer a + 1 is because the units in the combat zone are owned by player 2 for player 1, player 4 for player 3 etc.
 
Status
Not open for further replies.
Top