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

Rebalancing Teams?

Status
Not open for further replies.
Level 4
Joined
Jan 23, 2009
Messages
74
Hi i've been trying to make a trigger to even out the teams on my map via swapping a leaver for a player
i've searched nonstop on the net to find one but found none

so i tried to wing it This is what i did so far,:

1st trigger to set player #'s
Set players
Events
Map initialization
Conditions
Actions
Set Players[10] = Player 12 (Brown)
Set Players[9] = Player 11 (Dark Green)
Set Players[8] = Player 10 (Light Blue)
Set Players[7] = Player 9 (Gray)
Set Players[6] = Player 8 (Pink)
Set Players[5] = Player 6 (Orange)
Set Players[4] = Player 5 (Yellow)
Set Players[3] = Player 4 (Purple)
Set Players[2] = Player 3 (Teal)
Set Players[1] = Player 2 (Blue)
then i started the re balance trigger but thus far i am stumpped
rebalance
Events
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 2 (Blue)), (Player number of Player 8 (Pink)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 2 (Blue)), (Player number of Player 9 (Gray)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 2 (Blue)), (Player number of Player 10 (Light Blue)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 2 (Blue)), (Player number of Player 11 (Dark Green)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 2 (Blue)), (Player number of Player 12 (Brown)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 3 (Teal)), (Player number of Player 8 (Pink)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 3 (Teal)), (Player number of Player 9 (Gray)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 3 (Teal)), (Player number of Player 10 (Light Blue)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 3 (Teal)), (Player number of Player 11 (Dark Green)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 3 (Teal)), (Player number of Player 12 (Brown)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 4 (Purple)), (Player number of Player 8 (Pink)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 4 (Purple)), (Player number of Player 9 (Gray)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 4 (Purple)), (Player number of Player 10 (Light Blue)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 4 (Purple)), (Player number of Player 11 (Dark Green)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 4 (Purple)), (Player number of Player 12 (Brown)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 5 (Yellow)), (Player number of Player 8 (Pink)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 5 (Yellow)), (Player number of Player 9 (Gray)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 5 (Yellow)), (Player number of Player 10 (Light Blue)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 5 (Yellow)), (Player number of Player 11 (Dark Green)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 5 (Yellow)), (Player number of Player 12 (Brown)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 6 (Orange)), (Player number of Player 8 (Pink)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 6 (Orange)), (Player number of Player 9 (Gray)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 6 (Orange)), (Player number of Player 10 (Light Blue)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 6 (Orange)), (Player number of Player 11 (Dark Green)))) as A substring
Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 6 (Orange)), (Player number of Player 12 (Brown)))) as A substring
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of players in (All allies of Player 1 (Red))) Not equal to (Number of players in (All allies of Player 7 (Green)))
Then - Actions
Else - Actions


Can any one help me?
 
Level 4
Joined
Jan 23, 2009
Messages
74
  • Set players
  • Events
  • Map initialization
  • Conditions
  • Actions
  • Set Players[10] = Player 12 (Brown)
  • Set Players[9] = Player 11 (Dark Green)
  • Set Players[8] = Player 10 (Light Blue)
  • Set Players[7] = Player 9 (Gray)
  • Set Players[6] = Player 8 (Pink)
  • Set Players[5] = Player 6 (Orange)
  • Set Players[4] = Player 5 (Yellow)
  • Set Players[3] = Player 4 (Purple)
  • Set Players[2] = Player 3 (Teal)
  • Set Players[1] = Player 2 (Blue)
  • rebalance
  • Events
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 2 (Blue)), (Player number of Player 8 (Pink)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 2 (Blue)), (Player number of Player 9 (Gray)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 2 (Blue)), (Player number of Player 10 (Light Blue)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 2 (Blue)), (Player number of Player 11 (Dark Green)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 2 (Blue)), (Player number of Player 12 (Brown)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 3 (Teal)), (Player number of Player 8 (Pink)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 3 (Teal)), (Player number of Player 9 (Gray)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 3 (Teal)), (Player number of Player 10 (Light Blue)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 3 (Teal)), (Player number of Player 11 (Dark Green)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 3 (Teal)), (Player number of Player 12 (Brown)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 4 (Purple)), (Player number of Player 8 (Pink)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 4 (Purple)), (Player number of Player 9 (Gray)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 4 (Purple)), (Player number of Player 10 (Light Blue)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 4 (Purple)), (Player number of Player 11 (Dark Green)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 4 (Purple)), (Player number of Player 12 (Brown)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 5 (Yellow)), (Player number of Player 8 (Pink)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 5 (Yellow)), (Player number of Player 9 (Gray)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 5 (Yellow)), (Player number of Player 10 (Light Blue)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 5 (Yellow)), (Player number of Player 11 (Dark Green)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 5 (Yellow)), (Player number of Player 12 (Brown)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 6 (Orange)), (Player number of Player 8 (Pink)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 6 (Orange)), (Player number of Player 9 (Gray)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 6 (Orange)), (Player number of Player 10 (Light Blue)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 6 (Orange)), (Player number of Player 11 (Dark Green)))) as A substring
  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 6 (Orange)), (Player number of Player 12 (Brown)))) as A substring
  • Conditions
  • Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Number of players in (All allies of Player 1 (Red))) Not equal to (Number of players in (All allies of Player 7 (Green)))
  • Then - Actions
  • Else - Actions
 
Level 2
Joined
Jun 25, 2009
Messages
19
First of all, you are doing the events wrong. Substring(string, number, number) gives the string between the two numbers. So the first thing you have to do is change

  • Player - Player 2 (Blue) types a chat message containing (Substring(-switch, (Player number of Player 2 (Blue)), (Player number of Player 8 (Pink)))) as A substring
to

  • Player - Player 2 (Blue) types a chat message containing (-switch 2 8) as A substring
Second, instead of adding one event for each combination of player numbers, you can just use

  • Player - Player 2 (Blue) types a chat message containing (-switch) as A substring
and then use substring functions to get the numbers out of it, like this:

  • Set player1 = (Integer((Substring((Entered chat string), 7, 7))))
  • Set player2 = (Integer((Substring((Entered chat string), 9, 9))))

But that just improves the events. For the team switching:

  • Player Group - Pick every player in (All allies of (Player(player1))) and do (Actions)
    • Loop - Actions
      • Player Group - Add (Picked player) to group1
  • Player Group - Pick every player in (All allies of (Player(player2))) and do (Actions)
    • Loop - Actions
      • Player Group - Add (Picked player) to group2
  • Player Group - Pick every player in group1 and do (Actions)
    • Loop - Actions
      • Player - Make (Player(player1)) treat (Picked player) as an Enemy
      • Player - Make (Player(player2)) treat (Picked player) as an Ally with shared vision
  • Player Group - Pick every player in group2 and do (Actions)
    • Loop - Actions
      • Player - Make (Player(player1)) treat (Picked player) as an Ally with shared vision
      • Player - Make (Player(player2)) treat (Picked player) as an Enemy
 
Level 9
Joined
Jun 7, 2008
Messages
440
Well. Check if the player is playing. If it isnt go to the next player. Then have all other players on that team treat the new player as an ally with shared/not shared vision. You could also make it a periodic event so as no one has to type anything. If you need more of an explanation pm me. I could give you a hand with it. Im sorta doing the same thing on my map.
 
Level 9
Joined
Jun 7, 2008
Messages
440
You could make it a periodic event, or have the trigger fire when the player leaves
  • Events
    • Player X (color) leaves the game
  • Conditions
  • Actions
    • //Your actions here.
You already have the array which sets the players. Keep it. Did you want a random player to switch or have a set player. If you want a random player add all players of one side to a group and select a random player from that group. You have to make sure that the alliances change too.
  • Actions
  • Player Group - Pick every player in (Team) and do (Player - Make (Picked player) treat ((NewHero) as an Ally with shared vision)
  • Player Group - Pick every player in (OtherTeam) and do (Player - Make (Picked player) treat ((SwappingHero) as an Enemy)
Another Thing as well. What if there is an odd number of players? Just a side thought really. As well. Make sure you (if your going with the playerGroup idea) Remove the leaving player from the group.
 
Status
Not open for further replies.
Top