Mutators & UnrealScript

Force Game Start Mutator - Forced start of the game

The mutator automatically starts the game (without waiting for everyone to press “ready”) after a certain time interval.

Killing Floor character select screen The character selection grid in Killing Floor.

The interval is configured in the ForceGameStartMut.ini file (waitingInterval parameter in seconds)

class ForceGameStartMut extends Mutator config(ForceGameStartMut);

var config int waitingInterval;
var int startWaiting;
var bool firstPlayerArrived;

function PostBeginPlay()
{
    startWaiting = Level.TimeSeconds;
    firstPlayerArrived = false;
    SetTimer(5.0, true);
}

function Timer()
{
    local int playersN;

    // Exit if the game is not in the pre-match waiting state.
    if (!Level.Game.bWaitingToStartMatch)
        return;

    // When the first player appears, reset the timer baseline.
    playersN = PlayersNumber();
    if (playersN == 0)
        return;

    if (playersN > 0 && !firstPlayerArrived)
    {
        firstPlayerArrived = true;
        startWaiting = Level.TimeSeconds;
        return;
    }

    // Wait until waitingInterval seconds have passed since the first player joined.
    if (Level.TimeSeconds - startWaiting < waitingInterval)
        return;

    Level.Game.StartMatch();
}

function int PlayersNumber()
{
    local int N;
    local Controller C;

    N = 0;
    for (C = Level.ControllerList; C != None; C = C.nextController)
    {
        if (C.IsA('PlayerController') && C.PlayerReplicationInfo.PlayerID > 0 && C.PlayerReplicationInfo.bWaitingPlayer)
            N++;
    }
    return N;
}

defaultproperties
{
    waitingInterval=60
    bAddToServerPackages=True
    GroupName="ForceGameStartMut"
    FriendlyName="ForceGameStartMut"
    Description="Forces game start if some players are not ready for a long period of time"
}

Author: Flame Compiled version: https://yadi.sk/d/giSP0sgucjCuF

Rewritten version: countdown after the first "ready"

In the "Принудительный старт игры" (forced game start) thread on the killingfloor.ru forum, Flame later rewrote the mutator. The main change: the countdown starts only once at least one player has pressed "ready". There is one setting, TimeToWait (time in seconds): if at least one player is ready and TimeToWait seconds have passed, the game starts. The default is 180. Add it the same way: ForceGameStartMut.ForceGameStartMut.

class ForceGameStartMut extends Mutator config(ForceGameStartMut);
var config int TimeToWait;
var float StartWaiting;
var bool bStartCountDown;
function PostBeginPlay()
{
 SetTimer(1.0,true);
 SaveConfig();
}
function Timer()
{
 local bool bWeHaveReadyPlayers;
 //If the match has started, stop the timer
 if(!Level.Game.bWaitingToStartMatch)
 SetTimer(0.0,false);
 //Check whether any players are ready
 bWeHaveReadyPlayers=WeHaveReadyPlayers();
 if(!bWeHaveReadyPlayers)
 return;
 //At least one player is ready? Start the countdown
 if(bWeHaveReadyPlayers && !bStartCountDown)
 {
 bStartCountDown=true;
 StartWaiting=Level.TimeSeconds;
 return;
 }
 if(Level.TimeSeconds-StartWaiting>=TimeToWait)
 Level.Game.StartMatch();
}
function bool WeHaveReadyPlayers()
{
 local Controller C;
 for(C=Level.ControllerList;C!=None;C=C.nextController)
 {
 if (
 C.IsA('PlayerController')
 && C.PlayerReplicationInfo.PlayerID>0
 && C.PlayerReplicationInfo.bReadyToPlay
 )
 {
 return true;
 }
 }
 return false;
}
defaultproperties
{
 TimeToWait=180
 GroupName="ForceGameStartMut"
 FriendlyName="ForceGameStartMut"
 Description="Forces game start if some players are still not ready for a time period"
}