From f7eea7f3617ec56aa695355d9601444a2c937f0e Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Mon, 4 Feb 2019 15:22:33 -0500 Subject: [PATCH] Added Autobalance items --- Classic/scripts/autoexec/GetTeamCounts.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Classic/scripts/autoexec/GetTeamCounts.cs b/Classic/scripts/autoexec/GetTeamCounts.cs index 5e48a7e..38b7e74 100644 --- a/Classic/scripts/autoexec/GetTeamCounts.cs +++ b/Classic/scripts/autoexec/GetTeamCounts.cs @@ -38,6 +38,13 @@ function GetTeamCounts( %game, %client, %respawn ) //Get teamcounts if( $GetCountsClientTeamChange && $countdownStarted && $MatchStarted ) { + //Generate random to get random client for autobalance + %team1random = 1; + %team2random = 1; + + %team1random = getRandom(1,$PlayerCount[1]); + %team2random = getRandom(1,$PlayerCount[2]); + //Team Count code by Keen $PlayerCount[0] = 0; $PlayerCount[1] = 0; @@ -47,6 +54,16 @@ function GetTeamCounts( %game, %client, %respawn ) { %client = ClientGroup.getObject(%i); + //Pick a random client for autobalance + if( %client.team == 1 && %team1random == $PlayerCount[1] ) + $team1canidate = %client; + else if( $team1canidate $= "" && %client.team == 1 ) + $team1canidate = %client; + if( %client.team == 2 && %team2random == $PlayerCount[2] ) + $team2canidate = %client; + else if( $team2canidate $= "" && %client.team == 2 ) + $team2canidate = %client; + //if(!%client.isAIControlled()) $PlayerCount[%client.team]++; }