Advertisement
Treedestroyed

wA

Dec 20th, 2020
2,497
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class WaveMaxMut extends KFMutator
  2.     config(WaveMax);
  3.  
  4. var globalconfig int WaveMax;
  5.  
  6. simulated event PostBeginPlay()
  7. {
  8.     super.PostBeginPlay();
  9.    
  10.     if ( WorldInfo.Game.BaseMutator == None )
  11.         WorldInfo.Game.BaseMutator = Self;
  12.     else WorldInfo.Game.BaseMutator.AddMutator( Self );
  13.    
  14.     SaveConfig();
  15.    
  16.     if ( !SetWaveMax() )
  17.         SetTimer(1.f, true, 'CheckWaveMax');   
  18. }
  19.  
  20. function AddMutator( Mutator M )
  21. {
  22.     if ( M != Self )
  23.     {
  24.         if ( M.Class == Class )
  25.             M.Destroy();
  26.         else super.AddMutator( M );
  27.     }
  28. }
  29.  
  30. simulated function CheckWaveMax()
  31. {
  32.     if ( !SetWaveMax() )
  33.         ClearTimer('CheckWaveMax');
  34. }
  35.  
  36. simulated function bool SetWaveMax()
  37. {
  38.     local int i, j, NewWaveMax;
  39.     local array<int> WaveCount;
  40.     local KFGameInfo_Survival KFGI;
  41.  
  42.     NewWaveMax = (WaveMax > 0) ? WaveMax : 11;
  43.     WaveCount.Length = NewWaveMax - 1;
  44.    
  45.     KFGI = KFGameInfo_Survival( MyKFGI );
  46.    
  47.     if ( KFGI == None )
  48.         return false;
  49.        
  50.     if ( KFGI != None && KFGI.GameLength == GL_Long )
  51.     {
  52.         KFGI.WaveMax = NewWaveMax;
  53.        
  54.         if ( KFGI.MyKFGRI != None )
  55.             KFGI.MyKFGRI.WaveMax = KFGI.WaveMax;
  56.            
  57.         KFGI.UpdateGameSettings();
  58.        
  59.         if ( KFGI.SpawnManager != None )
  60.         {
  61.             for ( i = 0; i < KFGI.SpawnManager.DifficultyWaveSettings.Length; i++ )
  62.             {
  63.                 for ( j = 10; j < WaveCount.Length; j++ )
  64.                     KFGI.SpawnManager.DifficultyWaveSettings[i].Waves[j] = KFGI.SpawnManager.DifficultyWaveSettings[i].Waves[9];                                   
  65.                
  66.                 KFGI.SpawnManager.DifficultyWaveSettings[i].Waves[WaveCount.Length] = KFAIWaveInfo'GP_Spawning_ARCH.Long.HOE.ZED_Boss_Long_HOE';                   
  67.                 KFGI.SpawnManager.GetWaveSettings( KFGI.SpawnManager.WaveSettings );
  68.             }
  69.         }
  70.     }
  71.    
  72.     return true;
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement