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

[GUI]Randomly pick one player to another team

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
This is how I would do it. First make 2 Player group variables, and a player variable array, then make these triggers:

  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Add the players to team A --------
      • Player Group - Add Player 1 (Red) to TeamA
      • Player Group - Add Player 2 (Blue) to TeamA
      • Player Group - Add Player 3 (Teal) to TeamA
      • Player Group - Add Player 4 (Purple) to TeamA
      • -------- Add the players to team B --------
      • Player Group - Add Player 5 (Yellow) to TeamB
      • Player Group - Add Player 6 (Orange) to TeamB
      • Player Group - Add Player 7 (Green) to TeamB
      • Player Group - Add Player 8 (Pink) to TeamB
      • -------- Set the ally/enemy settings --------
      • Player Group - Make TeamA treat TeamA as an Ally with shared vision
      • Player Group - Make TeamA treat TeamB as an Enemy
      • Player Group - Make TeamB treat TeamB as an Ally with shared vision
      • Player Group - Make TeamB treat TeamA as an Enemy
  • Switch Teams
    • Events
      • Time - Elapsed game time is 10.00 seconds
    • Conditions
    • Actions
      • -------- Picks a random player from both teams --------
      • Set RandomPlayerSwitch[1] = (Random player from TeamA)
      • Set RandomPlayerSwitch[2] = (Random player from TeamB)
      • -------- Swop both players to either side's team --------
      • Player Group - Remove RandomPlayerSwitch[1] from TeamA
      • Player Group - Add RandomPlayerSwitch[1] to TeamB
      • Player Group - Remove RandomPlayerSwitch[2] from TeamB
      • Player Group - Add RandomPlayerSwitch[2] to TeamA
      • -------- Refresh the ally/enemy settings --------
      • Player Group - Make TeamA treat TeamA as an Ally with shared vision
      • Player Group - Make TeamA treat TeamB as an Enemy
      • Player Group - Make TeamB treat TeamB as an Ally with shared vision
      • Player Group - Make TeamB treat TeamA as an Enemy
You're trying to make a random player from both team's swop teams right? Or we're you trying to make 1 player switch, without being replaced? So 4v4 becomes 3v5?
 
Level 7
Joined
Feb 28, 2014
Messages
185
This is how I would do it. First make 2 Player group variables, and a player variable array, then make these triggers:

  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Add the players to team A --------
      • Player Group - Add Player 1 (Red) to TeamA
      • Player Group - Add Player 2 (Blue) to TeamA
      • Player Group - Add Player 3 (Teal) to TeamA
      • Player Group - Add Player 4 (Purple) to TeamA
      • -------- Add the players to team B --------
      • Player Group - Add Player 5 (Yellow) to TeamB
      • Player Group - Add Player 6 (Orange) to TeamB
      • Player Group - Add Player 7 (Green) to TeamB
      • Player Group - Add Player 8 (Pink) to TeamB
      • -------- Set the ally/enemy settings --------
      • Player Group - Make TeamA treat TeamA as an Ally with shared vision
      • Player Group - Make TeamA treat TeamB as an Enemy
      • Player Group - Make TeamB treat TeamB as an Ally with shared vision
      • Player Group - Make TeamB treat TeamA as an Enemy
  • Switch Teams
    • Events
      • Time - Elapsed game time is 10.00 seconds
    • Conditions
    • Actions
      • -------- Picks a random player from both teams --------
      • Set RandomPlayerSwitch[1] = (Random player from TeamA)
      • Set RandomPlayerSwitch[2] = (Random player from TeamB)
      • -------- Swop both players to either side's team --------
      • Player Group - Remove RandomPlayerSwitch[1] from TeamA
      • Player Group - Add RandomPlayerSwitch[1] to TeamB
      • Player Group - Remove RandomPlayerSwitch[2] from TeamB
      • Player Group - Add RandomPlayerSwitch[2] to TeamA
      • -------- Refresh the ally/enemy settings --------
      • Player Group - Make TeamA treat TeamA as an Ally with shared vision
      • Player Group - Make TeamA treat TeamB as an Enemy
      • Player Group - Make TeamB treat TeamB as an Ally with shared vision
      • Player Group - Make TeamB treat TeamA as an Enemy
You're trying to make a random player from both team's swop teams right? Or we're you trying to make 1 player switch, without being replaced? So 4v4 becomes 3v5?

The setting of the game is there has no team B. Then when the game start , system randomly pick one of the player from team a and make matching player become enemy with other player. During this process there will no replacement for any player. Something like Troll vs Elves .
 
Level 15
Joined
Aug 14, 2007
Messages
936
For the random stack, you can make it dynamic, it's all MATH. You can set the team first by adding existing players from each team, make a integer array to state the player number, example: 2,4,5. This number array then stores the player value in this case for the integer array memory it will be: index 1: 2, index 2: 4, index 3: 5. If you are a math genius you would already get it :p anyways from here random the integer array using the method. index [random from 1 to [max]] in this case max is 3, so it will be taking everything from the integer array hope it's not confusing!
 
Status
Not open for further replies.
Top