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-11-12 23:53:16 -05:00
|
|
|
function TeamBalanceNotify( %game, %client, %respawn )
|
2018-06-28 14:34:52 -04:00
|
|
|
{
|
2018-11-04 16:59:10 -05:00
|
|
|
if( $CurrentMissionType !$= "LakRabbit" && $TotalTeamPlayerCount !$= 0 && $Host::EnableTeamBalanceNotify )
|
|
|
|
|
{
|
2018-11-10 19:56:13 -05:00
|
|
|
//variables
|
|
|
|
|
%Team1Difference = $PlayerCount[1] - $PlayerCount[2];
|
|
|
|
|
%Team2Difference = $PlayerCount[2] - $PlayerCount[1];
|
2019-01-01 13:34:41 -05:00
|
|
|
//Make Global
|
|
|
|
|
$Team1Difference = %Team1Difference;
|
|
|
|
|
$Team2Difference = %Team2Difference;
|
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-11 01:38:18 -05:00
|
|
|
$BalancedMsgPlayed = 0;
|
2018-11-10 19:56:13 -05:00
|
|
|
|
|
|
|
|
if( %Team1Difference >= 2 || %Team2Difference >= 2 )
|
|
|
|
|
{
|
2018-11-11 01:38:18 -05:00
|
|
|
if( $UnbalancedMsgPlayed !$= 1 && %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.
|
2018-11-11 01:38:18 -05:00
|
|
|
$UnbalancedMsgPlayed = 1;
|
2018-11-10 19:56:13 -05:00
|
|
|
//Reset Stats.
|
2018-11-11 01:38:18 -05:00
|
|
|
$StatsMsgPlayed = 0;
|
2019-01-01 13:34:41 -05:00
|
|
|
//Called in 30 secs with sound
|
|
|
|
|
schedule(30000, 0, "UnbalancedSound");
|
2018-11-10 19:56:13 -05:00
|
|
|
}
|
|
|
|
|
//Stats Aspect. 3 or more difference gets a stats notify.
|
2018-11-11 01:38:18 -05:00
|
|
|
else if( $StatsMsgPlayed !$= 1)
|
2018-11-10 19:56:13 -05:00
|
|
|
{
|
2019-01-01 15:58:03 -05:00
|
|
|
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0It is currently %1 vs %2 with %3 observers.', $PlayerCount[1], $PlayerCount[2], $PlayerCount[0] );
|
|
|
|
|
//Run once.
|
|
|
|
|
$StatsMsgPlayed = 1;
|
|
|
|
|
//Called in 30 secs with sound
|
|
|
|
|
schedule(30000, 0, "StatsUnbalanceSound");
|
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-11 01:38:18 -05:00
|
|
|
else if( $PlayerCount[1] == $PlayerCount[2] && $TotalTeamPlayerCount !$= 0 && $BalancedMsgPlayed !$= 1 )
|
2018-11-10 19:56:13 -05:00
|
|
|
{
|
2019-01-01 13:34:41 -05:00
|
|
|
//messageAll('MsgTeamBalanceNotify', '\c1Teams are balanced.');
|
2018-11-10 19:56:13 -05:00
|
|
|
//Once per cycle.
|
2018-11-11 01:38:18 -05:00
|
|
|
$BalancedMsgPlayed = 1;
|
2018-11-10 19:56:13 -05:00
|
|
|
//Reset unbalanced.
|
2018-11-11 01:38:18 -05:00
|
|
|
$UnbalancedMsgPlayed = 0;
|
2018-11-10 19:56:13 -05:00
|
|
|
//Reset Stats.
|
2018-11-11 01:38:18 -05:00
|
|
|
$StatsMsgPlayed = 0;
|
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()
|
|
|
|
|
{
|
2019-01-01 13:34:41 -05:00
|
|
|
//$UnbalancedMsgPlayed = 0;
|
|
|
|
|
//$StatsMsgPlayed = 0;
|
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
|
|
|
|
|
|
|
|
}
|
2019-01-01 13:34:41 -05:00
|
|
|
|
|
|
|
|
//Unbalance with sound
|
|
|
|
|
//Called every 30 secs
|
|
|
|
|
//2 difference
|
|
|
|
|
function UnbalancedSound()
|
|
|
|
|
{
|
|
|
|
|
if( $Team2Difference == 2 || $Team1Difference == 2 )
|
|
|
|
|
{
|
2019-01-01 15:58:03 -05:00
|
|
|
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced.~wfx/misc/bounty_objrem2.wav');
|
|
|
|
|
//Called in 30 secs with sound
|
|
|
|
|
schedule(30000, 0, "UnbalancedSound");
|
2019-01-01 13:34:41 -05:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Stats with Sound
|
|
|
|
|
//Called every 30 seconds
|
|
|
|
|
//3 or more difference
|
|
|
|
|
function StatsUnbalanceSound()
|
|
|
|
|
{
|
|
|
|
|
if( $Team1Difference >= 3 || $Team2Difference >= 3 )
|
2019-01-01 15:58:03 -05:00
|
|
|
{
|
|
|
|
|
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0It is currently %1 vs %2 with %3 observers.~wfx/misc/bounty_objrem2.wav', $PlayerCount[1], $PlayerCount[2], $PlayerCount[0] );
|
|
|
|
|
//Called in 30 secs with sound
|
|
|
|
|
schedule(30000, 0, "StatsUnbalanceSound");
|
|
|
|
|
}
|
2019-01-01 13:34:41 -05:00
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
}
|