2018-11-04 16:59:10 -05:00
|
|
|
//Enable or Disable
|
|
|
|
|
//$Host::EnableTeamBalanceNotify = 1;
|
|
|
|
|
//
|
2018-06-28 14:34:52 -04:00
|
|
|
//Give the client a notification on the current state of balancing.
|
2018-11-10 19:56:13 -05:00
|
|
|
//This function is in GetTeamCounts.cs
|
2018-06-28 14:34:52 -04:00
|
|
|
function TeamBalanceNotify::AtSpawn( %game, %client, %respawn )
|
|
|
|
|
{
|
2018-11-04 16:59:10 -05:00
|
|
|
if( $CurrentMissionType !$= "LakRabbit" && $TotalTeamPlayerCount !$= 0 && $Host::EnableTeamBalanceNotify )
|
|
|
|
|
{
|
2018-11-10 19:56:13 -05:00
|
|
|
//variables
|
2018-06-28 14:34:52 -04:00
|
|
|
|
2018-11-10 19:56:13 -05:00
|
|
|
%Team1Difference = $PlayerCount[1] - $PlayerCount[2];
|
|
|
|
|
%Team2Difference = $PlayerCount[2] - $PlayerCount[1];
|
2018-06-28 14:34:52 -04:00
|
|
|
|
|
|
|
|
|
2018-11-10 19:56:13 -05:00
|
|
|
//echo ("%Team1Difference " @ %Team1Difference);
|
|
|
|
|
//echo ("%Team2Difference " @ %Team2Difference);
|
|
|
|
|
|
|
|
|
|
if( $PlayerCount[1] !$= $PlayerCount[2] )
|
|
|
|
|
{
|
|
|
|
|
//Uneven. Reset Balanced.
|
2018-11-10 23:11:00 -05:00
|
|
|
$BalancedMsgPlayed = false;
|
2018-11-10 19:56:13 -05:00
|
|
|
|
|
|
|
|
if( %Team1Difference >= 2 || %Team2Difference >= 2 )
|
|
|
|
|
{
|
2018-11-10 23:11:00 -05:00
|
|
|
if( !$UnbalancedMsgPlayed && %Team2Difference == 2 || %Team1Difference == 2 )
|
2018-11-10 19:56:13 -05:00
|
|
|
{
|
2018-07-17 13:03:37 -04:00
|
|
|
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced.');
|
2018-11-10 23:11:00 -05:00
|
|
|
//Once per cycle.
|
|
|
|
|
$UnbalancedMsgPlayed = true;
|
2018-11-10 19:56:13 -05:00
|
|
|
//Reset Stats.
|
2018-11-10 23:11:00 -05:00
|
|
|
$StatsMsgPlayed = false;
|
2018-11-10 19:56:13 -05:00
|
|
|
}
|
|
|
|
|
//Stats Aspect. 3 or more difference gets a stats notify.
|
2018-11-10 23:11:00 -05:00
|
|
|
else if( !$StatsMsgPlayed )
|
2018-11-10 19:56:13 -05:00
|
|
|
{
|
|
|
|
|
messageAll('MsgTeamBalanceNotify', '\c1It is currently %1 vs %2 with %3 observers.', $PlayerCount[1], $PlayerCount[2], $PlayerCount[0] );
|
2018-11-10 23:11:00 -05:00
|
|
|
$StatsMsgPlayed = true;
|
2018-11-10 19:56:13 -05:00
|
|
|
}
|
2018-06-28 14:34:52 -04:00
|
|
|
}
|
|
|
|
|
}
|
2018-11-10 19:56:13 -05:00
|
|
|
//If teams are balanced and teams dont equal 0.
|
2018-11-10 23:11:00 -05:00
|
|
|
else if( $PlayerCount[1] == $PlayerCount[2] && $TotalTeamPlayerCount !$= 0 && !$BalancedMsgPlayed )
|
2018-11-10 19:56:13 -05:00
|
|
|
{
|
|
|
|
|
messageAll('MsgTeamBalanceNotify', '\c1Teams are balanced.');
|
|
|
|
|
//Once per cycle.
|
2018-11-10 23:11:00 -05:00
|
|
|
$BalancedMsgPlayed = true;
|
2018-11-10 19:56:13 -05:00
|
|
|
//Reset unbalanced.
|
2018-11-10 23:11:00 -05:00
|
|
|
$UnbalancedMsgPlayed = false;
|
2018-11-10 19:56:13 -05:00
|
|
|
//Reset Stats.
|
2018-11-10 23:11:00 -05:00
|
|
|
$StatsMsgPlayed = false;
|
2018-06-28 14:34:52 -04:00
|
|
|
}
|
2018-11-04 16:59:10 -05:00
|
|
|
}
|
2018-06-28 14:34:52 -04:00
|
|
|
}
|
|
|
|
|
|
2018-09-16 11:07:47 -04:00
|
|
|
//Called in CTFGame::flagCap in evo CTFGame.ovl
|
|
|
|
|
//Allows for another unbalanced notification everytime the flag is capped.
|
2018-06-28 14:34:52 -04:00
|
|
|
function ResetUnbalancedNotifyPerCap()
|
|
|
|
|
{
|
2018-11-10 23:11:00 -05:00
|
|
|
$UnbalancedMsgPlayed = false;
|
|
|
|
|
$StatsMsgPlayed = false;
|
2018-06-28 14:34:52 -04:00
|
|
|
}
|
|
|
|
|
|
2018-09-16 11:07:47 -04:00
|
|
|
//Reset Notify at defaultgame::gameOver in evo defaultgame.ovl
|
2018-11-10 19:56:13 -05:00
|
|
|
function ResetTeamBalanceNotifyGameOver( %game )
|
|
|
|
|
{
|
|
|
|
|
//Reset All TeamBalance Variables
|
|
|
|
|
$BalancedMsgPlayed = -1;
|
|
|
|
|
$UnbalancedMsgPlayed = -1;
|
|
|
|
|
$StatsMsgPlayed = -1;
|
2018-06-28 14:34:52 -04:00
|
|
|
|
|
|
|
|
}
|