mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-04-04 19:25:04 +00:00
Scorebased Autobalance canidates
This commit is contained in:
parent
d389424033
commit
a958bfddab
1 changed files with 17 additions and 10 deletions
|
|
@ -31,30 +31,37 @@ if (!isActivePackage(StartTeamCounts))
|
|||
activatePackage(StartTeamCounts);
|
||||
|
||||
function GetTeamCounts( %game, %client, %respawn )
|
||||
{
|
||||
{
|
||||
//Run MissionTypeOptions
|
||||
MissionTypeOptions();
|
||||
|
||||
//Get teamcounts
|
||||
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
|
||||
$PlayerCount[0] = 0;
|
||||
$PlayerCount[1] = 0;
|
||||
$PlayerCount[2] = 0;
|
||||
|
||||
//For autobalance
|
||||
%lastclient1 = "";
|
||||
%lastclient2 = "";
|
||||
|
||||
for(%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%client = ClientGroup.getObject(%i);
|
||||
|
||||
//Pick a random client for autobalance
|
||||
if( %client.team == 1 && %team1random == $PlayerCount[1] ) $team1canidate = %client;
|
||||
if( %client.team == 2 && %team2random == $PlayerCount[2] ) $team2canidate = %client;
|
||||
//Pick a client for autobalance
|
||||
if( %client.team == 1)
|
||||
{
|
||||
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
|
||||
if(!%client.isAIControlled()) //No bots
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue