mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-07-15 08:04:39 +00:00
Scorebased Autobalance canidates
This commit is contained in:
parent
d389424033
commit
a958bfddab
1 changed files with 17 additions and 10 deletions
|
|
@ -38,23 +38,30 @@ function GetTeamCounts( %game, %client, %respawn )
|
||||||
//Get teamcounts
|
//Get teamcounts
|
||||||
if( $GetCountsClientTeamChange && $countdownStarted && $MatchStarted )
|
if( $GetCountsClientTeamChange && $countdownStarted && $MatchStarted )
|
||||||
{
|
{
|
||||||
//Generate random to get random client for autobalance
|
|
||||||
%team1random = getRandom(1,$PlayerCount[1]); if(%team1random $= 0 || %team1random > $PlayerCount[1]) %team1random = 1;
|
|
||||||
%team2random = getRandom(1,$PlayerCount[2]); if(%team2random $= 0 || %team2random > $PlayerCount[2]) %team2random = 1;
|
|
||||||
//echo("team1random " @ %team1random); echo("team2random " @ %team2random);
|
|
||||||
|
|
||||||
//Team Count code by Keen
|
//Team Count code by Keen
|
||||||
$PlayerCount[0] = 0;
|
$PlayerCount[0] = 0;
|
||||||
$PlayerCount[1] = 0;
|
$PlayerCount[1] = 0;
|
||||||
$PlayerCount[2] = 0;
|
$PlayerCount[2] = 0;
|
||||||
|
|
||||||
|
//For autobalance
|
||||||
|
%lastclient1 = "";
|
||||||
|
%lastclient2 = "";
|
||||||
|
|
||||||
for(%i = 0; %i < ClientGroup.getCount(); %i++)
|
for(%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||||
{
|
{
|
||||||
%client = ClientGroup.getObject(%i);
|
%client = ClientGroup.getObject(%i);
|
||||||
|
|
||||||
//Pick a random client for autobalance
|
//Pick a client for autobalance
|
||||||
if( %client.team == 1 && %team1random == $PlayerCount[1] ) $team1canidate = %client;
|
if( %client.team == 1)
|
||||||
if( %client.team == 2 && %team2random == $PlayerCount[2] ) $team2canidate = %client;
|
{
|
||||||
|
if(%client.score <= %lastclient1.score || %lastclient1 $= "") $team1canidate = %client;
|
||||||
|
%lastclient1 = %client;
|
||||||
|
}
|
||||||
|
if( %client.team == 2)
|
||||||
|
{
|
||||||
|
if(%client.score <= %lastclient2.score || %lastclient2 $= "") $team2canidate = %client;
|
||||||
|
%lastclient2 = %client;
|
||||||
|
}
|
||||||
|
|
||||||
//Check ver
|
//Check ver
|
||||||
if(!%client.isAIControlled()) //No bots
|
if(!%client.isAIControlled()) //No bots
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue