• 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.

[REQ] Trigger - Random Teams [GUI]

Status
Not open for further replies.
Level 14
Joined
Jul 28, 2009
Messages
1,086
Hey guys,
im really in the need of a trigger that will place you randomly on a team with someone.

lets say, if red types:
-teams
all players from 1 - 12 will be placed 6 and 6 on each team but completly random. Just so no one can cheat with their teammates and maybe end up fighting eachother.

example:
Players: 1 2 3 4 5 6 7 8 9 10 11 12

Player red types: -teams

Teams: 1 3 4 6 8 11 | 2 5 7 9 10 12

Capiche? :p
and it has too be in [GUI]!

- Thanks :D
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
This does exactly that.


Just for testing:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Melee Game - Use melee time of day (for all players)
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Player Group - Add (Player((Integer A))) to tempgroup
Just for testing:
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Cinematic - Clear the screen of text messages for Player Group - Player 1 (Red)
      • Player Group - Pick every player in Group1 and do (Actions)
        • Loop - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: (String((Player number of (Picked player))))
          • Player Group - Remove (Picked player) from Group1
      • Game - Display to Player Group - Player 1 (Red) the text: ===
      • Player Group - Pick every player in Group2 and do (Actions)
        • Loop - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: (String((Player number of (Picked player))))
          • Player Group - Remove (Picked player) from Group2
  • Divide Teams
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set int1 = 0
      • Set int2 = 0
      • Set int3 = 0
      • Set int4 = 0
      • Player Group - Pick every player in tempgroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • True Equal to True
              • ((Picked player) controller) Equal to User // Disabled for testing
              • ((Picked player) slot status) Equal to Is playing // Disabled for testing
            • Then - Actions
              • Set int4 = (int4 + 1)
              • Player Group - Add (Picked player) to Group1
            • Else - Actions
      • Player Group - Pick every player in Group1 and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (int4 - int3) Greater than (Abs((int1 - int2)))
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Random integer number between 1 and 2) Equal to 2
                • Then - Actions
                  • Player Group - Remove (Picked player) from Group1
                  • Player Group - Add (Picked player) to Group2
                  • Set int2 = (int2 + 1)
                • Else - Actions
                  • Set int1 = (int1 + 1)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • int1 Greater than int2
                • Then - Actions
                  • Player Group - Remove (Picked player) from Group1
                  • Player Group - Add (Picked player) to Group2
                  • Set int2 = (int2 + 1)
                • Else - Actions
                  • Set int1 = (int1 + 1)
          • Set int3 = (int3 + 1)
      • Trigger - Run Untitled Trigger 001 <gen> (ignoring conditions)


When applying to your map, remove the true == true condition and enable the two disabled conditions. Pick players in All Players, not in temp group. You can delete the tempgroup variable.

Press ESC to test. You can change the amount of players in the for loop for testing purposes. Don't go over 12 though :)

http://www.hiveworkshop.com/forums/pastebin.php?id=q3gpwx
 
Status
Not open for further replies.
Top