Force Game Start Mutator - Forced start of the game 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. The interval is configured in the ForceGameS...
#1
Posted:
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.
The interval is configured in the ForceGameStartMut.ini file (waitingInterval parameter in seconds) Add as ForceGameStartMut.ForceGameStartMut:
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