diff --git a/Classic/scripts/autoexec/AntiPack.cs b/Classic/scripts/autoexec/AntiPack.cs index a8bd290..1994616 100644 --- a/Classic/scripts/autoexec/AntiPack.cs +++ b/Classic/scripts/autoexec/AntiPack.cs @@ -18,7 +18,7 @@ $AntiPackIncludeShield = 0; function CheckAntiPack( %game ) { //CTF only - if( $Host::AntiPackEnable && $CurrentMissionType $= "CTF" && !$Host::TournamentMode ) + if( $Host::AntiPackEnable ) { //echo("TotalTeamPlayerCount " @ $TotalTeamPlayerCount); //echo("AntiPackPlayerCount " @ $AntiPackPlayerCount); diff --git a/Classic/scripts/autoexec/Autobalance.cs b/Classic/scripts/autoexec/Autobalance.cs index fb82209..0a57f12 100644 --- a/Classic/scripts/autoexec/Autobalance.cs +++ b/Classic/scripts/autoexec/Autobalance.cs @@ -9,7 +9,7 @@ // How far behind littleTeam must be to use All Mode. // Meaning picking from a pool of all players on the bigTeam instead of just the lowest scoring player. // 400 equals 400 points. 4 caps behind. -$AllModeThreshold = 400; +$AllModeThreshold = 300; // Run from TeamBalanceNotify.cs via UnbalancedSound( %game ) @@ -28,18 +28,13 @@ function Autobalance( %game, %AutobalanceSafetynetTrys ) %team1difference = $TeamRank[1, count] - $TeamRank[2, count]; %team2difference = $TeamRank[2, count] - $TeamRank[1, count]; - //If even, stop. - if( %team1difference == 1 || %team2difference == 1 || $TeamRank[1, count] == $TeamRank[2, count] ) - { - //Reset TBN - ResetTBNStatus(); - return; - } //Determine bigTeam - else if( %team1difference >= 2 ) + if( %team1difference >= 2 ) %bigTeam = 1; else if( %team2difference >= 2 ) %bigTeam = 2; + else + return; %littleTeam = ( %bigTeam == 1 ) ? 2 : 1; diff --git a/Classic/scripts/autoexec/GetTeamCounts.cs b/Classic/scripts/autoexec/GetTeamCounts.cs index 36c2d3e..2e0f8c1 100644 --- a/Classic/scripts/autoexec/GetTeamCounts.cs +++ b/Classic/scripts/autoexec/GetTeamCounts.cs @@ -70,12 +70,15 @@ function GetTeamCounts( %game, %client, %respawn ) %team1difference = $PlayerCount[1] - $PlayerCount[2]; %team2difference = $PlayerCount[2] - $PlayerCount[1]; - //Start Base Rape Notify - schedule(500, 0, "NBRStatusNotify", %game); - //Start Team Balance Notify - schedule(1000, 0, "TeamBalanceNotify", %game, %team1difference, %team2difference); - //Start AntiCloak - schedule(1500, 0, "CheckAntiPack", %game); + if( !$Host::TournamentMode ) + { + if( $CurrentMissionType $= "CTF" ) + { + NBRStatusNotify(%game); + CheckAntiPack(%game); + } + TeamBalanceNotify(%game, %team1difference, %team2difference); + } //Set so counter wont run when it doesnt need to. $GetCountsStatus = "IDLE"; diff --git a/Classic/scripts/autoexec/NoBaseRape.cs b/Classic/scripts/autoexec/NoBaseRape.cs index e93b61a..a0d8460 100644 --- a/Classic/scripts/autoexec/NoBaseRape.cs +++ b/Classic/scripts/autoexec/NoBaseRape.cs @@ -1,27 +1,26 @@ package NoBaseRape { -//From Evolution MOD -//Modified for our needs +// From Evolution MOD +// Modified for our needs function StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType) { //echo( %targetObject.getDataBlock().getClassName() ); //echo( %targetObject.getDataBlock().getName() ); - + %targetname = %targetObject.getDataBlock().getName(); - + //Used on some maps to make invs invincible if( %targetObject.invincible && %targetname $= "StationInventory" ) return; - + if(!$Host::TournamentMode && $Host::NoBaseRapeEnabled && $Host::NoBaseRapePlayerCount > $TotalTeamPlayerCount) - { + { if( %targetname $= "GeneratorLarge" || %targetname $= "StationInventory" || %targetname $= "SolarPanel" ) { //Notify only if asset is on other team if( %targetObject.team !$= %sourceObject.team ) - NBRAssetSound( %game, %sourceObject ); - + NBRAssetMessage(%sourceObject); return; } } @@ -33,4 +32,19 @@ function StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %pos // Prevent package from being activated if it is already if (!isActivePackage(NoBaseRape)) - activatePackage(NoBaseRape); \ No newline at end of file + activatePackage(NoBaseRape); + + +// Message when a player hits a protected enemy asset +function NBRAssetMessage(%sourceObject) +{ + if($CurrentMissionType $= "CTF" && $Host::EnableNoBaseRapeNotify ) + { + %timeDif = getSimTime() - %sourceObject.NBRTime; + if(%timeDif > 10000 || !%sourceObject.NBRTime) + { + messageClient(%sourceObject.client, 'MsgNoBaseRapeNotify', '\c2No Base Rape is enabled until %1 players.', $Host::NoBaseRapePlayerCount ); + %sourceObject.NBRTime = getSimTime(); + } + } +} diff --git a/Classic/scripts/autoexec/NoBaseRapeNotify.cs b/Classic/scripts/autoexec/NoBaseRapeNotify.cs index fc7542c..82dfaf5 100644 --- a/Classic/scripts/autoexec/NoBaseRapeNotify.cs +++ b/Classic/scripts/autoexec/NoBaseRapeNotify.cs @@ -9,7 +9,7 @@ // Called in GetTeamCounts.cs function NBRStatusNotify( %game ) { - if( $CurrentMissionType $= "CTF" && $Host::EnableNoBaseRapeNotify && !$Host::TournamentMode && $Host::NoBaseRapeEnabled ) + if( $Host::EnableNoBaseRapeNotify && $Host::NoBaseRapeEnabled ) { //On if( $Host::NoBaseRapePlayerCount > $TotalTeamPlayerCount ) @@ -59,22 +59,3 @@ if (!isActivePackage(ResetNBRNotify)) activatePackage(ResetNBRNotify); -// This function is at StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType) in the staticshape.ovl in evoClassic.vl2 -// Plays a sound when a player hits a protected enemy asset -function NBRAssetSound( %game, %sourceObject ) -{ - //Wont play again until the schedule is done - if(!isEventPending(%sourceObject.NBRAssetSoundSchedule) && $CurrentMissionType $= "CTF" && $Host::EnableNoBaseRapeNotify && !$Host::TournamentMode && $Host::NoBaseRapeEnabled ) - { - messageClient(%sourceObject.client, 'MsgNoBaseRapeNotify', '\c2No Base Rape is enabled until %1 players.', $Host::NoBaseRapePlayerCount ); - %sourceObject.NBRAssetSoundSchedule = schedule(10000, 0, "ResetNBRAssetSound", %sourceObject ); - } -} -// Reset -function ResetNBRAssetSound( %sourceObject ) -{ - if(isEventPending(%sourceObject.NBRAssetSoundSchedule)) - cancel(%sourceObject.NBRAssetSoundSchedule); -} - - diff --git a/Classic/scripts/autoexec/TeamBalanceNotify.cs b/Classic/scripts/autoexec/TeamBalanceNotify.cs index 01200f9..462555f 100644 --- a/Classic/scripts/autoexec/TeamBalanceNotify.cs +++ b/Classic/scripts/autoexec/TeamBalanceNotify.cs @@ -14,7 +14,7 @@ // Called in GetTeamCounts.cs function TeamBalanceNotify( %game, %team1difference, %team2difference ) { - if( Game.numTeams > 1 && $TotalTeamPlayerCount !$= 0 && !$Host::TournamentMode ) + if( Game.numTeams > 1 && $TotalTeamPlayerCount !$= 0 ) { //echo ("%Team1Difference " @ %Team1Difference); //echo ("%Team2Difference " @ %Team2Difference); @@ -28,7 +28,7 @@ function TeamBalanceNotify( %game, %team1difference, %team2difference ) $TBNStatus = "UNBALANCED"; } else - //Means teams arnt even, but arnt so uneven to do anything about. Meaning a team is a man down. 6vs7, 4vs3 etc + //Man down. 6vs7, 4vs3 etc $TBNStatus = "UNEVEN"; } //Teams are even @@ -63,49 +63,32 @@ function NotifyUnbalanced( %game ) { if(isEventPending($NotifySchedule)) cancel($NotifySchedule); + + if( $TBNStatus !$= "NOTIFY" ) //If Status has changed to EVEN or anything else (GameOver reset). + return; + + //Difference Variables + %team1difference = $TeamRank[1, count] - $TeamRank[2, count]; + %team2difference = $TeamRank[2, count] - $TeamRank[1, count]; - if( $TBNStatus $= "NOTIFY" ) //If Status has changed to EVEN or anything else. - { - //Team Count code by Keen - $PlayerCount[0] = 0; - $PlayerCount[1] = 0; - $PlayerCount[2] = 0; - - for(%i = 0; %i < ClientGroup.getCount(); %i++) + if( %team1difference >= 2 || %team2difference >= 2 ) + { + //Autobalance Warning + if( $Host::EnableAutobalance ) { - %client = ClientGroup.getObject(%i); - - //if(!%client.isAIControlled()) - $PlayerCount[%client.team]++; + messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0Autobalance Initializing.~wgui/vote_nopass.wav'); + $AutoBalanceSchedule = schedule(30000, 0, "Autobalance", %game ); } - - //Difference Variables - %team1difference = $PlayerCount[1] - $PlayerCount[2]; - %team2difference = $PlayerCount[2] - $PlayerCount[1]; - - if( %team1difference == 1 || %team2difference == 1 || $PlayerCount[1] == $PlayerCount[2] ) - { - ResetTBNStatus(); - return; - } - //Continue - else if( %team1difference >= 2 || %team2difference >= 2 ) - { - //Autobalance Warning - if( $Host::EnableAutobalance ) - { - messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0Autobalance Initializing.~wgui/vote_nopass.wav'); - $AutoBalanceSchedule = schedule(30000, 0, "Autobalance", %game ); - } - //If Autobalance is disabled, message only. - else if( $Host::EnableTeamBalanceNotify ) - { - messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0%1 vs %2 with %3 observers.~wgui/vote_nopass.wav', $PlayerCount[1], $PlayerCount[2], $PlayerCount[0] ); - schedule(13000, 0, "ResetTBNStatus"); - schedule(15000, 0, "ResetGetCountsStatus"); - } + //If Autobalance is disabled, message only. + else if( $Host::EnableTeamBalanceNotify ) + { + messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0%1 vs %2 with %3 observers.~wgui/vote_nopass.wav', $PlayerCount[1], $PlayerCount[2], $PlayerCount[0] ); + schedule(13000, 0, "ResetTBNStatus"); + schedule(15000, 0, "ResetGetCountsStatus"); } } + else + ResetTBNStatus(); } // Reset TBNStatus