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

Shorten This Trigger

Status
Not open for further replies.
Hey im making a game and i just made my own Hero Wisp Selection And i was wondering is this rite or can i make it smaller, Oh by the way they all start in different places when i place down Regions.

  • Expert Marksman Copy
    • Events
      • Unit - A unit enters Expert Marksman <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Unit - Remove (Triggering unit) from the game
          • Unit - Create 1 Expert Marksman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
            • Then - Actions
              • Unit - Remove (Triggering unit) from the game
              • Unit - Create 1 Expert Marksman for Player 2 (Blue) at (Center of (Playable map area)) facing Default building facing degrees
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of (Triggering unit)) Equal to Player 3 (Teal)
                • Then - Actions
                  • Unit - Remove (Triggering unit) from the game
                  • Unit - Create 1 Expert Marksman for Player 3 (Teal) at (Center of (Playable map area)) facing Default building facing degrees
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
                    • Then - Actions
                      • Unit - Remove (Triggering unit) from the game
                      • Unit - Create 1 Expert Marksman for Player 4 (Purple) at (Center of (Playable map area)) facing Default building facing degrees
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
                        • Then - Actions
                          • Unit - Remove (Triggering unit) from the game
                          • Unit - Create 1 Expert Marksman for Player 5 (Yellow) at (Center of (Playable map area)) facing Default building facing degrees
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
                            • Then - Actions
                              • Unit - Remove (Triggering unit) from the game
                              • Unit - Create 1 Expert Marksman for Player 6 (Orange) at (Center of (Playable map area)) facing Default building facing degrees
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Owner of (Triggering unit)) Equal to Player 7 (Green)
                                • Then - Actions
                                  • Unit - Remove (Triggering unit) from the game
                                  • Unit - Create 1 Expert Marksman for Player 7 (Green) at (Center of (Playable map area)) facing Default building facing degrees
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Owner of (Triggering unit)) Equal to Player 8 (Pink)
                                    • Then - Actions
                                      • Unit - Remove (Triggering unit) from the game
                                      • Unit - Create 1 Expert Marksman for Player 8 (Pink) at (Center of (Playable map area)) facing Default building facing degrees
                                    • Else - Actions
                                      • Do nothing
                                • Else - Actions
                                  • Do nothing
                            • Else - Actions
                              • Do nothing
                        • Else - Actions
                          • Do nothing
                    • Else - Actions
                      • Do nothing
                • Else - Actions
                  • Do nothing
            • Else - Actions
              • Do nothing
        • Else - Actions
          • Do nothing
 
Level 4
Joined
Aug 9, 2004
Messages
70
There you go.
For each.. means that change Integer A with numbers between 1 to 8.
Tell me if you have any problems with it.

  • Events
    • Unit - A unit enters Expert Marksman <gen>
  • Conditions
  • Actions
    • For each (Integer A) from 1 to 8, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Triggering unit) is in (Units owned by (Player((Integer A))))) Equal to True
          • Then - Actions
            • Unit - Remove (Triggering unit) from the game
            • Unit - Create 1 Expert Marksman for Player((Integer A)) at (Center of (Playable map area)) facing Default building facing degrees
          • Else - Actions
 
Level 4
Joined
Aug 9, 2004
Messages
70
If you want them to go different places and make your trigger short, then you can follow this.

Create another trigger, or just go one of the triggers that has an event of Map Initialization.
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Set startingPosition[1] = (Center of startPos1 <gen>)
    • Set startingPosition[2] = (Center of startPos2 <gen>)
    • Set startingPosition[3] = (Center of startPos3 <gen>)
    • Set startingPosition[4] = (Center of startPos4 <gen>)
    • Set startingPosition[5] = (Center of startPos5 <gen>)
    • Set startingPosition[6] = (Center of startPos6 <gen>)
    • Set startingPosition[7] = (Center of startPos7 <gen>)
    • Set startingPosition[8] = (Center of startPos8 <gen>)
startingPosition is an array point variable which you can define from Variables(ctrl-b in trigger editor.) just create a new variable, set the type to point and check the array box.

Lastly, you need to change the trigger like this.

  • Unit - Create 1 Expert Marksman for Player((Integer A)) at (startingPosition[Integer A]) facing Default building facing degrees
This may come you that it's bigger than yours but if you have lots of triggers like Expert Marksman, you're gonna need it.
 
Status
Not open for further replies.
Top