This commit is contained in:
ChocoTaco1 2020-08-23 03:20:42 -04:00
parent b2af77f9de
commit 81c80b0ef1

View file

@ -41,25 +41,9 @@ function Autobalance( %game, %AutobalanceSafetynetTrys )
//Toggle for All Mode //Toggle for All Mode
//If a team is behind pick anyone, not just a low scoring player //If a team is behind pick anyone, not just a low scoring player
if( $TeamScore[%bigTeam] > ($TeamScore[%littleTeam] + $AllModeThreshold)) if( $TeamScore[%bigTeam] > ($TeamScore[%littleTeam] + $AllModeThreshold))
%UseAllMode = 1;
if(%UseAllMode)
{ {
//We need to find out how many people are on a team holding flags and in vehicles to make the proper exceptions in the loop %UseAllMode = 1;
for(%i = 0; %i < ClientGroup.getCount(); %i++) %autobalanceRandom = getRandom(1,($TeamRank[%bigTeam, count] - 1));
{
%client = ClientGroup.getObject(%i);
%team = %client.team;
if(%team $= %bigTeam)
{
//Holding flag? In a Vehicle?
if(%client.player.holdingFlag !$= "" || isObject(%client.vehicleMounted))
%exceptioncount++;
}
}
%autobalanceRandom = getRandom(1,($TeamRank[%bigTeam, count] - %exceptioncount));
} }
//Pick a client for autobalance //Pick a client for autobalance
@ -70,8 +54,8 @@ function Autobalance( %game, %AutobalanceSafetynetTrys )
if(%team $= %bigTeam) if(%team $= %bigTeam)
{ {
//Holding flag? In a Vehicle? //Holding flag?
if(%client.player.holdingFlag !$= "" || isObject(%client.vehicleMounted)) if(%client.player.holdingFlag !$= "")
continue; continue;
if(%UseAllMode) if(%UseAllMode)
@ -84,6 +68,7 @@ function Autobalance( %game, %AutobalanceSafetynetTrys )
} }
else else
{ {
//Normal circumstances
//Try to pick a low scoring player //Try to pick a low scoring player
if(%client.score < %lastclient[%team].score || %lastclient[%team] $= "") if(%client.score < %lastclient[%team].score || %lastclient[%team] $= "")
%teamcanidate[%team] = %client; %teamcanidate[%team] = %client;
@ -92,27 +77,6 @@ function Autobalance( %game, %AutobalanceSafetynetTrys )
} }
} }
//A situation where the whole team is in vehicles or holding a flag
//Pick anyone
if(%teamcanidate[%bigTeam] $= "")
{
//Pick a client for autobalance
for(%i = 0; %i < ClientGroup.getCount(); %i++)
{
%client = ClientGroup.getObject(%i);
%team = %client.team;
if(%team $= %bigTeam)
{
//Try to pick a low scoring player
if(%client.score < %lastclient[%team].score || %lastclient[%team] $= "")
%teamcanidate[%team] = %client;
%lastclient[%team] = %client;
}
}
}
//Debug //Debug
if( %AutobalanceDebug ) if( %AutobalanceDebug )
AutobalanceDebug(%teamcanidate1, %teamcanidate2, %team1difference, %team2difference, %bigTeam, %AutobalanceSafetynetTrys, %UseAllMode); AutobalanceDebug(%teamcanidate1, %teamcanidate2, %team1difference, %team2difference, %bigTeam, %AutobalanceSafetynetTrys, %UseAllMode);