Hey, I have been working on this stat for my server on a new perk which +1 to the requirement after surviving a wave as the perk. For some reason, mine isn't working for every player, but only first player entering the server (I believe). I just can't seem to figure out what the problem is.
Code of the whole function in FsGametype (additional code is in red):
Code on it's own (without rest of the function):
Any ideas on to make this for all survivors of that wave?
Thanks in advance!
Code of the whole function in FsGametype (additional code is in red):
Code:
/** Addition for Survivor waves survived */
State MatchInProgress
{
function bool UpdateMonsterCount() // To avoid invasion errors.
{
local Controller C;
local int i,j;
For( C=Level.ControllerList; C!=None; C=C.NextController )
{
if( C.Pawn!=None && C.Pawn.Health>0 )
{
if( Monster(C.Pawn)!=None )
i++;
else j++;
}
}
NumMonsters = i;
Return (j>0);
}
function bool BootShopPlayers()
{
local int i,j;
local bool bRes;
j = ShopList.Length;
for( i=0; i<j; i++ )
{
if( ShopList[i].BootPlayers() )
bRes = True;
}
Return bRes;
}
function SelectShop()
{
local array<ShopVolume> TempShopList;
local int i;
local int SelectedShop;
// Can't select a shop if there aren't any
if ( ShopList.Length < 1 )
{
return;
}
for ( i = 0; i < ShopList.Length; i++ )
{
if ( ShopList[i].bAlwaysClosed )
continue;
TempShopList[TempShopList.Length] = ShopList[i];
}
SelectedShop = Rand(TempShopList.Length);
if ( TempShopList[SelectedShop] != KFGameReplicationInfo(GameReplicationInfo).CurrentShop )
{
KFGameReplicationInfo(GameReplicationInfo).CurrentShop = TempShopList[SelectedShop];
}
else if ( SelectedShop + 1 < TempShopList.Length )
{
KFGameReplicationInfo(GameReplicationInfo).CurrentShop = TempShopList[SelectedShop + 1];
}
else
{
KFGameReplicationInfo(GameReplicationInfo).CurrentShop = TempShopList[0];
}
}
function OpenShops()
{
local int i;
local Controller C;
bTradingDoorsOpen = True;
for( i=0; i<ShopList.Length; i++ )
{
if( ShopList[i].bAlwaysClosed )
continue;
if( ShopList[i].bAlwaysEnabled )
{
ShopList[i].OpenShop();
}
}
if ( KFGameReplicationInfo(GameReplicationInfo).CurrentShop == none )
{
SelectShop();
}
KFGameReplicationInfo(GameReplicationInfo).CurrentShop.OpenShop();
// Tell all players to start showing the path to the trader
For( C=Level.ControllerList; C!=None; C=C.NextController )
{
if( C.Pawn!=None && C.Pawn.Health>0 )
{
// Disable pawn collision during trader time
C.Pawn.bBlockActors = false;
if( KFPlayerController(C) !=None )
{
KFPlayerController(C).SetShowPathToTrader(true);
// Have Trader tell players that the Shop's Open
if ( WaveNum < FinalWave )
{
KFPlayerController(C).ClientLocationalVoiceMessage(C.PlayerReplicationInfo, none, 'TRADER', 2);
}
else
{
KFPlayerController(C).ClientLocationalVoiceMessage(C.PlayerReplicationInfo, none, 'TRADER', 3);
}
//Hints
KFPlayerController(C).CheckForHint(31);
HintTime_1 = Level.TimeSeconds + 11;
}
}
}
}
function CloseShops()
{
local int i;
local Controller C;
local Pickup Pickup;
bTradingDoorsOpen = False;
for( i=0; i<ShopList.Length; i++ )
{
if( ShopList[i].bCurrentlyOpen )
ShopList[i].CloseShop();
}
SelectShop();
foreach AllActors(class'Pickup', Pickup)
{
if ( Pickup.bDropped )
{
Pickup.Destroy();
}
}
// Tell all players to stop showing the path to the trader
for ( C = Level.ControllerList; C != none; C = C.NextController )
{
if ( C.Pawn != none && C.Pawn.Health > 0 )
{
// Restore pawn collision during trader time
C.Pawn.bBlockActors = C.Pawn.default.bBlockActors;
if ( KFPlayerController(C) != none )
{
KFPlayerController(C).SetShowPathToTrader(false);
KFPlayerController(C).ClientForceCollectGarbage();
if ( WaveNum < FinalWave - 1 )
{
// Have Trader tell players that the Shop's Closed
KFPlayerController(C).ClientLocationalVoiceMessage(C.PlayerReplicationInfo, none, 'TRADER', 6);
}
}
}
}
}
function Timer()
{
local Controller C;
local bool bOneMessage;
local Bot B;
Global.Timer();
if ( Level.TimeSeconds > HintTime_1 && bTradingDoorsOpen && bShowHint_2 )
{
for ( C = Level.ControllerList; C != None; C = C.NextController )
{
if( C.Pawn != none && C.Pawn.Health > 0 )
{
KFPlayerController(C).CheckForHint(32);
HintTime_2 = Level.TimeSeconds + 11;
}
}
bShowHint_2 = false;
}
if ( Level.TimeSeconds > HintTime_2 && bTradingDoorsOpen && bShowHint_3 )
{
for ( C = Level.ControllerList; C != None; C = C.NextController )
{
if( C.Pawn != None && C.Pawn.Health > 0 )
{
KFPlayerController(C).CheckForHint(33);
}
}
bShowHint_3 = false;
}
if ( !bFinalStartup )
{
bFinalStartup = true;
PlayStartupMessage();
}
if ( NeedPlayers() && AddBot() && (RemainingBots > 0) )
RemainingBots--;
ElapsedTime++;
GameReplicationInfo.ElapsedTime = ElapsedTime;
if( !UpdateMonsterCount() )
{
EndGame(None,"TimeLimit");
Return;
}
if( bUpdateViewTargs )
UpdateViews();
if (!bNoBots && !bBotsAdded)
{
if(KFGameReplicationInfo(GameReplicationInfo) != none)
if((NumPlayers + NumBots) < MaxPlayers && KFGameReplicationInfo(GameReplicationInfo).PendingBots > 0 )
{
AddBots(1);
KFGameReplicationInfo(GameReplicationInfo).PendingBots --;
}
if (KFGameReplicationInfo(GameReplicationInfo).PendingBots == 0)
{
bBotsAdded = true;
return;
}
}
if( bWaveBossInProgress )
{
// Close Trader doors
if( bTradingDoorsOpen )
{
CloseShops();
TraderProblemLevel = 0;
}
if( TraderProblemLevel<4 )
{
if( BootShopPlayers() )
TraderProblemLevel = 0;
else TraderProblemLevel++;
}
if( !bHasSetViewYet && TotalMaxMonsters<=0 && NumMonsters>0 )
{
bHasSetViewYet = True;
for ( C = Level.ControllerList; C != None; C = C.NextController )
if ( C.Pawn!=None && KFMonster(C.Pawn)!=None && KFMonster(C.Pawn).MakeGrandEntry() )
{
ViewingBoss = KFMonster(C.Pawn);
Break;
}
if( ViewingBoss!=None )
{
ViewingBoss.bAlwaysRelevant = True;
for ( C = Level.ControllerList; C != None; C = C.NextController )
{
if( PlayerController(C)!=None )
{
PlayerController(C).SetViewTarget(ViewingBoss);
PlayerController(C).ClientSetViewTarget(ViewingBoss);
PlayerController(C).bBehindView = True;
PlayerController(C).ClientSetBehindView(True);
PlayerController(C).ClientSetMusic(BossBattleSong,MTRAN_FastFade);
}
if ( C.PlayerReplicationInfo!=None && bRespawnOnBoss )
{
C.PlayerReplicationInfo.bOutOfLives = false;
C.PlayerReplicationInfo.NumLives = 0;
if ( (C.Pawn == None) && !C.PlayerReplicationInfo.bOnlySpectator && PlayerController(C)!=None )
C.GotoState('PlayerWaiting');
}
}
}
}
else if( ViewingBoss!=None && !ViewingBoss.bShotAnim )
{
ViewingBoss = None;
for ( C = Level.ControllerList; C != None; C = C.NextController )
if( PlayerController(C)!=None )
{
if( C.Pawn==None && !C.PlayerReplicationInfo.bOnlySpectator && bRespawnOnBoss )
C.ServerReStartPlayer();
if( C.Pawn!=None )
{
PlayerController(C).SetViewTarget(C.Pawn);
PlayerController(C).ClientSetViewTarget(C.Pawn);
}
else
{
PlayerController(C).SetViewTarget(C);
PlayerController(C).ClientSetViewTarget(C);
}
PlayerController(C).bBehindView = False;
PlayerController(C).ClientSetBehindView(False);
}
}
if( TotalMaxMonsters<=0 || (Level.TimeSeconds>WaveEndTime) )
{
// if everyone's spawned and they're all dead
if ( NumMonsters <= 0 )
DoWaveEnd();
}
else AddBoss();
}
else if(bWaveInProgress)
{
WaveTimeElapsed += 1.0;
// Close Trader doors
if (bTradingDoorsOpen)
{
CloseShops();
TraderProblemLevel = 0;
}
if( TraderProblemLevel<4 )
{
if( BootShopPlayers() )
TraderProblemLevel = 0;
else TraderProblemLevel++;
}
if(!MusicPlaying)
StartGameMusic(True);
if( TotalMaxMonsters<=0 )
{
if ( NumMonsters <= 5 /*|| Level.TimeSeconds>WaveEndTime*/ )
{
for ( C = Level.ControllerList; C != None; C = C.NextController )
if ( KFMonsterController(C)!=None && KFMonsterController(C).CanKillMeYet() )
{
C.Pawn.KilledBy( C.Pawn );
Break;
}
}
// if everyone's spawned and they're all dead
if ( NumMonsters <= 0 )
{
DoWaveEnd();
}
} // all monsters spawned
else if ( (Level.TimeSeconds > NextMonsterTime) && (NumMonsters+NextSpawnSquad.Length <= MaxMonsters) )
{
WaveEndTime = Level.TimeSeconds+160;
if( !bDisableZedSpawning )
{
AddSquad(); // Comment this out to prevent zed spawning
}
if(nextSpawnSquad.length>0)
{
NextMonsterTime = Level.TimeSeconds + 0.2;
}
else
{
NextMonsterTime = Level.TimeSeconds + CalcNextSquadSpawnTime();
}
}
}
else if ( NumMonsters <= 0 )
{
if ( WaveNum == FinalWave && !bUseEndGameBoss )
{
if( bDebugMoney )
{
log("$$$$$$$$$$$$$$$$ Final TotalPossibleMatchMoney = "$TotalPossibleMatchMoney,'Debug');
}
EndGame(None,"TimeLimit");
return;
}
else if( WaveNum == (FinalWave + 1) && bUseEndGameBoss )
{
if( bDebugMoney )
{
log("$$$$$$$$$$$$$$$$ Final TotalPossibleMatchMoney = "$TotalPossibleMatchMoney,'Debug');
}
EndGame(None,"TimeLimit");
return;
}
WaveCountDown--;
if ( !CalmMusicPlaying )
{
InitMapWaveCfg();
StartGameMusic(False);
}
// Open Trader doors
if ( WaveNum != InitialWave && !bTradingDoorsOpen )
{
OpenShops();
}
// Select a shop if one isn't open
if ( KFGameReplicationInfo(GameReplicationInfo).CurrentShop == none )
{
SelectShop();
}
KFGameReplicationInfo(GameReplicationInfo).TimeToNextWave = WaveCountDown;
if ( WaveCountDown == 30 )
{
for ( C = Level.ControllerList; C != None; C = C.NextController )
{
if ( KFPlayerController(C) != None )
{
// Have Trader tell players that they've got 30 seconds
KFPlayerController(C).ClientLocationalVoiceMessage(C.PlayerReplicationInfo, none, 'TRADER', 4);
}
}
}
else if ( WaveCountDown == 10 )
{
for ( C = Level.ControllerList; C != None; C = C.NextController )
{
if ( KFPlayerController(C) != None )
{
// Have Trader tell players that they've got 10 seconds
KFPlayerController(C).ClientLocationalVoiceMessage(C.PlayerReplicationInfo, none, 'TRADER', 5);
}
}
}
else if ( WaveCountDown == 5 )
{
KFGameReplicationInfo(Level.Game.GameReplicationInfo).MaxMonstersOn=false;
InvasionGameReplicationInfo(GameReplicationInfo).WaveNumber = WaveNum;
}
else if ( (WaveCountDown > 0) && (WaveCountDown < 5) )
{
if( WaveNum == FinalWave && bUseEndGameBoss )
{
BroadcastLocalizedMessage(class'KFMod.WaitingMessage', 3);
}
else
{
BroadcastLocalizedMessage(class'KFMod.WaitingMessage', 1);
}
}
else if ( WaveCountDown <= 1 )
{
bWaveInProgress = true;
KFGameReplicationInfo(GameReplicationInfo).bWaveInProgress = true;
// Randomize the ammo pickups again
if( WaveNum > 0 )
{
SetupPickups();
}
if( WaveNum == FinalWave && bUseEndGameBoss )
{
StartWaveBoss();
}
else
{
SetupWave();
for ( C = Level.ControllerList; C != none; C = C.NextController )
{
if ( PlayerController(C) != none )
{
PlayerController(C).LastPlaySpeech = 0;
if ( KFPlayerController(C) != none )
{
KFPlayerController(C).bHasHeardTraderWelcomeMessage = false;
}
}
if ( Bot(C) != none )
{
B = Bot(C);
InvasionBot(B).bDamagedMessage = false;
B.bInitLifeMessage = false;
if ( !bOneMessage && (FRand() < 0.65) )
{
bOneMessage = true;
if ( (B.Squad.SquadLeader != None) && B.Squad.CloseToLeader(C.Pawn) )
{
B.SendMessage(B.Squad.SquadLeader.PlayerReplicationInfo, 'OTHER', B.GetMessageIndex('INPOSITION'), 20, 'TEAM');
B.bInitLifeMessage = false;
}
}
}
}
}
}
}
}
// Use a sine wave to somewhat randomly increase/decrease the frequency (and
// also the intensity) of zombie squad spawning. This will give "peaks and valleys"
// the the intensity of the zombie attacks
function float CalcNextSquadSpawnTime()
{
local float NextSpawnTime;
local float SineMod;
SineMod = 1.0 - Abs(sin(WaveTimeElapsed * SineWaveFreq));
NextSpawnTime = KFLRules.WaveSpawnPeriod;
if( KFGameLength != GL_Custom )
{
if( KFGameLength == GL_Short )
{
// Make the zeds come faster in the earlier waves
if( WaveNum < 2 )
{
if( NumPlayers == 4 )
{
NextSpawnTime *= 0.85;
}
else if( NumPlayers == 5 )
{
NextSpawnTime *= 0.65;
}
else if( NumPlayers >= 6 )
{
NextSpawnTime *= 0.3;
}
}
// Give a slightly bigger breather in the later waves
else if( WaveNum >= 2 )
{
if( NumPlayers <= 3 )
{
NextSpawnTime *= 1.1;
}
else if( NumPlayers == 4 )
{
NextSpawnTime *= 1.0;//0.85;
}
else if( NumPlayers == 5 )
{
NextSpawnTime *= 0.75;//0.65;
}
else if( NumPlayers >= 6 )
{
NextSpawnTime *= 0.60;//0.3;
}
}
}
else if( KFGameLength == GL_Normal )
{
// Make the zeds come faster in the earlier waves
if( WaveNum < 4 )
{
if( NumPlayers == 4 )
{
NextSpawnTime *= 0.85;
}
else if( NumPlayers == 5 )
{
NextSpawnTime *= 0.65;
}
else if( NumPlayers >= 6 )
{
NextSpawnTime *= 0.3;
}
}
// Give a slightly bigger breather in the later waves
else if( WaveNum >= 4 )
{
if( NumPlayers <= 3 )
{
NextSpawnTime *= 1.1;
}
else if( NumPlayers == 4 )
{
NextSpawnTime *= 1.0;//0.85;
}
else if( NumPlayers == 5 )
{
NextSpawnTime *= 0.75;//0.65;
}
else if( NumPlayers >= 6 )
{
NextSpawnTime *= 0.6;//0.3;
}
}
}
else if( KFGameLength == GL_Long )
{
// Make the zeds come faster in the earlier waves
if( WaveNum < 7 )
{
if( NumPlayers == 4 )
{
NextSpawnTime *= 0.85;
}
else if( NumPlayers == 5 )
{
NextSpawnTime *= 0.65;
}
else if( NumPlayers >= 6 )
{
NextSpawnTime *= 0.3;
}
}
// Give a slightly bigger breather in the later waves
else if( WaveNum >= 7 )
{
if( NumPlayers <= 3 )
{
NextSpawnTime *= 1.1;
}
else if( NumPlayers == 4 )
{
NextSpawnTime *= 1.0;//0.85;
}
else if( NumPlayers == 5 )
{
NextSpawnTime *= 0.75;//0.65;
}
else if( NumPlayers >= 6 )
{
NextSpawnTime *= 0.60;//0.3;
}
}
}
}
else
{
if( NumPlayers == 4 )
{
NextSpawnTime *= 0.85;
}
else if( NumPlayers == 5 )
{
NextSpawnTime *= 0.65;
}
else if( NumPlayers >= 6 )
{
NextSpawnTime *= 0.3;
}
}
// Make the zeds come a little faster at all times on harder and above
if ( GameDifficulty >= 4.0 ) // Hard
{
NextSpawnTime *= 0.85;
}
NextSpawnTime += SineMod * (NextSpawnTime * 2);
return NextSpawnTime;
}
function DoWaveEnd()
{
local Controller C;
local KFDoorMover KFDM;
local PlayerController Survivor;
local int SurvivorCount;
// Only reset this at the end of wave 0. That way the sine wave that scales
// the intensity up/down will be somewhat random per wave
if( WaveNum < 1 )
{
WaveTimeElapsed = 0;
}
if ( !rewardFlag )
RewardSurvivingPlayers();
if( bDebugMoney )
{
log("$$$$$$$$$$$$$$$$ Wave "$WaveNum$" TotalPossibleWaveMoney = "$TotalPossibleWaveMoney,'Debug');
log("$$$$$$$$$$$$$$$$ TotalPossibleMatchMoney = "$TotalPossibleMatchMoney,'Debug');
TotalPossibleWaveMoney=0;
}
// Clear Trader Message status
bDidTraderMovingMessage = false;
bDidMoveTowardTraderMessage = false;
bWaveInProgress = false;
bWaveBossInProgress = false;
bNotifiedLastManStanding = false;
KFGameReplicationInfo(GameReplicationInfo).bWaveInProgress = false;
WaveCountDown = Max(TimeBetweenWaves,1);
KFGameReplicationInfo(GameReplicationInfo).TimeToNextWave = WaveCountDown;
WaveNum++;
for ( C = Level.ControllerList; C != none; C = C.NextController )
{
if ( C.PlayerReplicationInfo != none )
{
C.PlayerReplicationInfo.bOutOfLives = false;
C.PlayerReplicationInfo.NumLives = 0;
if ( KFPlayerController(C) != none )
{
if ( KFPlayerReplicationInfo(C.PlayerReplicationInfo) != none )
{
KFPlayerController(C).bChangedVeterancyThisWave = false;
if ( KFPlayerReplicationInfo(C.PlayerReplicationInfo).ClientVeteranSkill != KFPlayerController(C).SelectedVeterancy )
{
KFPlayerController(C).SendSelectedVeterancyToServer();
}
}
}
if ( C.Pawn != none )
{
if ( PlayerController(C) != none )
{
Survivor = PlayerController(C);
SurvivorCount++;
}
}
else if ( !C.PlayerReplicationInfo.bOnlySpectator )
{
C.PlayerReplicationInfo.Score = Max(MinRespawnCash,int(C.PlayerReplicationInfo.Score));
if( PlayerController(C) != none )
{
PlayerController(C).GotoState('PlayerWaiting');
PlayerController(C).SetViewTarget(C);
PlayerController(C).ClientSetBehindView(false);
PlayerController(C).bBehindView = False;
PlayerController(C).ClientSetViewTarget(C.Pawn);
}
C.ServerReStartPlayer();
}
if ( KFPlayerController(C) != none )
{
if ( KFSteamStatsAndAchievements(PlayerController(C).SteamStatsAndAchievements) != none )
{
KFSteamStatsAndAchievements(PlayerController(C).SteamStatsAndAchievements).WaveEnded();
}
// Don't broadcast this message AFTER the final wave!
if( WaveNum < FinalWave )
{
KFPlayerController(C).bSpawnedThisWave = false;
BroadcastLocalizedMessage(class'KFMod.WaitingMessage', 2);
}
else if ( WaveNum == FinalWave )
{
KFPlayerController(C).bSpawnedThisWave = false;
}
else
{
KFPlayerController(C).bSpawnedThisWave = true;
}
}
}
}
[COLOR="Red"]// Addition for the Survivor waves survived.
if ( KFPlayerReplicationInfo(Survivor.PlayerReplicationInfo).ClientVeteranSkill == class'SRVetSurvivor' && Survivor != none
&& ServerStStats(Survivor.SteamStatsAndAchievements) != none )
{
ServerStStats(Survivor.SteamStatsAndAchievements).AddSurvivorWave();
}[/COLOR]
if ( Level.NetMode != NM_StandAlone && Level.Game.NumPlayers > 1 &&
SurvivorCount == 1 && Survivor != none && KFSteamStatsAndAchievements(Survivor.SteamStatsAndAchievements) != none )
{
KFSteamStatsAndAchievements(Survivor.SteamStatsAndAchievements).AddOnlySurvivorOfWave();
}
bUpdateViewTargs = True;
//respawn doors
foreach DynamicActors(class'KFDoorMover', KFDM)
KFDM.RespawnDoor();
}
function InitMapWaveCfg()
{
local int i,l;
local KFRandomSpawn RS;
l = ZedSpawnList.Length;
for( i=0; i<l; i++ )
ZedSpawnList[i].NotifyNewWave(WaveNum);
foreach DynamicActors(Class'KFRandomSpawn',RS)
RS.NotifyNewWave(WaveNum,FinalWave-1);
}
function StartWaveBoss()
{
local int i,l;
l = ZedSpawnList.Length;
for( i=0; i<l; i++ )
ZedSpawnList[i].Reset();
bHasSetViewYet = False;
WaveEndTime = Level.TimeSeconds+60;
NextSpawnSquad.Length = 1;
if( KFGameLength != GL_Custom )
{
NextSpawnSquad[0] = Class<KFMonster>(DynamicLoadObject(MonsterCollection.default.EndGameBossClass,Class'Class'));
NextspawnSquad[0].static.PreCacheAssets(Level);
}
else
{
NextSpawnSquad[0] = Class<KFMonster>(DynamicLoadObject(EndGameBossClass,Class'Class'));
if(NextSpawnSquad[0].default.EventClasses.Length > eventNum)
{
NextSpawnSquad[0] = Class<KFMonster>(DynamicLoadObject(NextSpawnSquad[0].default.EventClasses[eventNum],Class'Class'));
}
NextspawnSquad[0].static.PreCacheAssets(Level);
}
if( NextSpawnSquad[0]==None )
NextSpawnSquad[0] = Class<KFMonster>(FallbackMonster);
KFGameReplicationInfo(Level.Game.GameReplicationInfo).MaxMonsters = 1;
TotalMaxMonsters = 1;
bWaveBossInProgress = True;
}
function UpdateViews() // To fix camera stuck on ur spec target
{
local Controller C;
bUpdateViewTargs = False;
for ( C = Level.ControllerList; C != None; C = C.NextController )
{
if ( PlayerController(C) != None && C.Pawn!=None )
PlayerController(C).ClientSetViewTarget(C.Pawn);
}
}
// Setup the random ammo pickups
function SetupPickups()
{
local int NumWeaponPickups, NumAmmoPickups, Random, i, j;
local int m;
// Randomize Available Ammo Pickups
if ( GameDifficulty >= 5.0 ) // Suicidal and Hell on Earth
{
NumWeaponPickups = WeaponPickups.Length * 0.1;
NumAmmoPickups = AmmoPickups.Length * 0.1;
}
else if ( GameDifficulty >= 4.0 ) // Hard
{
NumWeaponPickups = WeaponPickups.Length * 0.2;
NumAmmoPickups = AmmoPickups.Length * 0.35;
}
else if ( GameDifficulty >= 2.0 ) // Normal
{
NumWeaponPickups = WeaponPickups.Length * 0.3;
NumAmmoPickups = AmmoPickups.Length * 0.5;
}
else // Beginner
{
NumWeaponPickups = WeaponPickups.Length * 0.5;
NumAmmoPickups = AmmoPickups.Length * 0.65;
}
// reset all the of the pickups
for ( m = 0; m < WeaponPickups.Length ; m++ )
{
WeaponPickups[m].DisableMe();
}
for ( m = 0; m < AmmoPickups.Length ; m++ )
{
AmmoPickups[m].GotoState('Sleeping', 'Begin');
}
// Ramdomly select which pickups to spawn
for ( i = 0; i < NumWeaponPickups && j < 10000; i++ )
{
Random = Rand(WeaponPickups.Length);
if ( !WeaponPickups[Random].bIsEnabledNow )
{
WeaponPickups[Random].EnableMe();
}
else
{
i--;
}
j++;
}
for ( i = 0; i < NumAmmoPickups && j < 10000; i++ )
{
Random = Rand(AmmoPickups.Length);
if ( AmmoPickups[Random].bSleeping )
{
AmmoPickups[Random].GotoState('Pickup');
}
else
{
i--;
}
j++;
}
}
function BeginState()
{
Super.BeginState();
WaveNum = InitialWave;
InvasionGameReplicationInfo(GameReplicationInfo).WaveNumber = WaveNum;
// Ten second initial countdown
WaveCountDown = 10;// Modify this if we want to make it take long for zeds to spawn initially
SetupPickups();
}
function EndState()
{
local Controller C;
Super.EndState();
// Tell all players to stop showing the path to the trader
For( C=Level.ControllerList; C!=None; C=C.NextController )
{
if( C.Pawn!=None && C.Pawn.Health>0 )
{
// Restore pawn collision during trader time
C.Pawn.bBlockActors = C.Pawn.default.bBlockActors;
if( KFPlayerController(C) !=None )
{
KFPlayerController(C).SetShowPathToTrader(false);
}
}
}
}
}
Code on it's own (without rest of the function):
Code:
// Addition for the Survivor waves survived.
if ( KFPlayerReplicationInfo(Survivor.PlayerReplicationInfo).ClientVeteranSkill == class'SRVetSurvivor' && Survivor != none
&& ServerStStats(Survivor.SteamStatsAndAchievements) != none )
{
ServerStStats(Survivor.SteamStatsAndAchievements).AddSurvivorWave();
}
Any ideas on to make this for all survivors of that wave?
Thanks in advance!