• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

(GUI) Team Shuffle

Status
Not open for further replies.
Level 7
Joined
Dec 26, 2010
Messages
401
I was wondering how to go about making a trigger to shuffle teams at the start of a game, to randomly pick players and assign them to a different team, instead of set teams so no one knows exactly who their team mates will be or what team they will be on?
 
  • Actions
    • Player Group - Pick every player in (All players) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Picked player) is in Force1) Equal to False
            • ((Picked player) is in Force2) Equal to False
          • Then - Actions
            • Set Integer = (Random integer number between 1 and 2)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Integer Equal to 1
              • Then - Actions
                • Player Group - Add (Picked player) to Force1
              • Else - Actions
                • Player Group - Add (Picked player) to Force2
          • Else - Actions
  • Player Group - Pick every player in Force1 and do (Actions)
    • Loop - Actions
      • Set Players1 = (Picked player)
      • Player Group - Pick every player in Force2 and do (Actions)
        • Loop - Actions
          • Set Players2 = (Picked player)
          • Player - Make Players2 treat Players1 as an Enemy
          • Player - Make Players1 treat Players2 as an Enemy
This could work.
 
Level 7
Joined
Dec 26, 2010
Messages
401
Okay, will this also work for what I need, I need three teams, two teams of five and one team of two, would I just have to put a second condition to check on the 3rd integer to make sure that the spots for team three are still open, if not, to repick between 1 and 2?
 
Level 7
Joined
Dec 26, 2010
Messages
401
I'm having an issue, there's a loophole somewhere, I'm not sure if it's in my teams or my alliances, but a lot of times I'm testing the game and it's only giving me either just one ally or none, once did it give me four others like it was supposed to.

Here's the team shuffle trigger.

  • Actions
    • Game - Display to (All players) the text: Players will now be...
    • Player Group - Pick every player in (All players) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Picked player) is in Archers_Team) Equal to False
            • ((Picked player) is in Catapult_Team) Equal to False
            • ((Picked player) is in Dwarf_Team) Equal to False
          • Then - Actions
            • Set Integer = (Random integer number between 1 and 3)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Integer Equal to 1
              • Then - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Number of players in Archers_Team) Less than 5
                  • Then - Actions
                    • Player Group - Add (Picked player) to Archers_Team
                  • Else - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (Number of players in Archers_Team) Equal to 5
                      • Then - Actions
                        • Set Integer = (Random integer number between 2 and 3)
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • Integer Equal to 2
                            • (Number of players in Dwarf_Team) Less than 5
                          • Then - Actions
                            • Player Group - Add (Picked player) to Dwarf_Team
                          • Else - Actions
                            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • If - Conditions
                                • (Number of players in Dwarf_Team) Equal to 5
                                • (Number of players in Catapult_Team) Less than 2
                              • Then - Actions
                                • Player Group - Add (Picked player) to Catapult_Team
                              • Else - Actions
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • Integer Equal to 3
                            • (Number of players in Catapult_Team) Less than 2
                          • Then - Actions
                            • Player Group - Add (Picked player) to Catapult_Team
                          • Else - Actions
                            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • If - Conditions
                                • (Number of players in Dwarf_Team) Less than 5
                                • (Number of players in Catapult_Team) Equal to 2
                              • Then - Actions
                                • Player Group - Add (Picked player) to Dwarf_Team
                              • Else - Actions
                      • Else - Actions
              • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Integer Equal to 2
              • Then - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Number of players in Dwarf_Team) Less than 5
                  • Then - Actions
                    • Player Group - Add (Picked player) to Dwarf_Team
                  • Else - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (Number of players in Dwarf_Team) Equal to 5
                      • Then - Actions
                        • Set Integer = (Random integer number between 1 and 3)
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • Integer Equal to 1
                            • (Number of players in Archers_Team) Less than 5
                          • Then - Actions
                            • Player Group - Add (Picked player) to Archers_Team
                          • Else - Actions
                            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • If - Conditions
                                • (Number of players in Archers_Team) Equal to 5
                                • (Number of players in Catapult_Team) Less than 2
                              • Then - Actions
                                • Player Group - Add (Picked player) to Catapult_Team
                              • Else - Actions
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • Integer Equal to 3
                            • (Number of players in Catapult_Team) Less than 2
                          • Then - Actions
                            • Player Group - Add (Picked player) to Catapult_Team
                          • Else - Actions
                            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • If - Conditions
                                • (Number of players in Archers_Team) Less than 5
                                • (Number of players in Catapult_Team) Equal to 2
                              • Then - Actions
                                • Player Group - Add (Picked player) to Archers_Team
                              • Else - Actions
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • Integer Equal to 2
                          • Then - Actions
                            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • If - Conditions
                                • (Number of players in Archers_Team) Less than 5
                                • (Number of players in Catapult_Team) Equal to 2
                              • Then - Actions
                                • Player Group - Add (Picked player) to Archers_Team
                              • Else - Actions
                                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                  • If - Conditions
                                    • (Number of players in Archers_Team) Equal to 5
                                    • (Number of players in Catapult_Team) Less than 2
                                  • Then - Actions
                                    • Player Group - Add (Picked player) to Catapult_Team
                                  • Else - Actions
                          • Else - Actions
                      • Else - Actions
              • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Integer Equal to 3
              • Then - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Number of players in Catapult_Team) Less than 2
                  • Then - Actions
                    • Player Group - Add (Picked player) to Catapult_Team
                  • Else - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (Number of players in Catapult_Team) Equal to 2
                      • Then - Actions
                        • Set Integer = (Random integer number between 1 and 2)
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • Integer Equal to 2
                            • (Number of players in Dwarf_Team) Less than 5
                          • Then - Actions
                            • Player Group - Add (Picked player) to Dwarf_Team
                          • Else - Actions
                            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • If - Conditions
                                • (Number of players in Dwarf_Team) Equal to 5
                                • (Number of players in Archers_Team) Less than 5
                              • Then - Actions
                                • Player Group - Add (Picked player) to Archers_Team
                              • Else - Actions
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • Integer Equal to 1
                            • (Number of players in Archers_Team) Less than 5
                          • Then - Actions
                            • Player Group - Add (Picked player) to Archers_Team
                          • Else - Actions
                            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • If - Conditions
                                • (Number of players in Dwarf_Team) Less than 5
                                • (Number of players in Archers_Team) Equal to 5
                              • Then - Actions
                                • Player Group - Add (Picked player) to Dwarf_Team
                              • Else - Actions
                      • Else - Actions
              • Else - Actions
          • Else - Actions
I've looked it up and down and I can't seem to find anything wrong with it, but I'm probably looking at it wrong.


Edit: Nevermind, I found out what I was doing wrong, I didn't have all the slots filled :ogre_rage:, thanks again Pharaoh_
 
Last edited:
Status
Not open for further replies.
Top