Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TestMutator extends Mutator;
- var config string MaxMonsters;
- var config string FakedPlayers;
- var array<int> MaxMonstersInt;
- var array<int> FakedPlayersInt;
- event PreBeginPlay()
- {
- super.PreBeginPlay();
- InitDynamicSettings();
- SetMaxMonsters();
- SetFakedPlayers();
- }
- function SetMaxMonsters()
- {
- local KFGameType KFGT;
- local int TotalMaxMonsters;
- KFGT = KFGameType( Level.Game );
- if ( KFGT != None )
- {
- TotalMaxMonsters = MaxMonstersInt[Clamp( GetTruePlayerNum() - 1, 0, 128 )];
- TotalMaxMonsters = Clamp( TotalMaxMonsters, 5, 254 );
- KFGT.MaxZombiesOnce = TotalMaxMonsters;
- KFGT.StandardMaxZombiesOnce = TotalMaxMonsters;
- KFGT.MaxMonsters = Clamp( KFGT.TotalMaxMonsters, 5, TotalMaxMonsters );
- }
- }
- function SetFakedPlayers()
- {
- local KFGameType KFGT;
- local int TotalFakedPlayers;
- TotalFakedPlayers = FakedPlayersInt[Clamp( GetTruePlayerNum() - 1, 0, 128 )];
- KFGT = KFGameType( Level.Game );
- if ( KFGT != none )
- KFGT.NumPlayers = GetTruePlayerNum() + TotalFakedPlayers;
- }
- function int GetTruePlayerNum()
- {
- local Controller C;
- local PlayerReplicationInfo PRI;
- local int i;
- i = 0;
- for ( C = Level.ControllerList; C != None; C = C.NextController )
- {
- PRI = C.PlayerReplicationInfo;
- if ( ( PRI != None ) && !PRI.bBot && MessagingSpectator( C ) == None )
- i++;
- }
- return i;
- }
- private simulated function InitDynamicSettings()
- {
- SetDynamicIntegerString( MaxMonstersInt, MaxMonsters );
- SetDynamicIntegerString( FakedPlayersInt, FakedPlayers );
- }
- simulated function SetDynamicIntegerString( out array<int> OutValue, string OutString )
- {
- local string S;
- local array<string> ArrayString;
- ParseStringIntoArray( OutString, ArrayString, ",", true );
- foreach ArrayString( S )
- OutValue.AddItem( int( S ) );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement