Is there a way to have a server always start matches even if there are no human players on the server?
I was looking through uscript code to try and find how to start a match, but couldn't find what I was looking for(being stupid) or not applying it correctly in a mutator.
Auto start matches without human players
-
- Masterful
- Posts: 748
- Joined: Thu Jun 24, 2010 10:35 pm
- Personal rank: Retard
- Location: England
-
- Skilled
- Posts: 163
- Joined: Mon Jan 24, 2011 3:22 am
- Personal rank: Codezilla
Re: Auto start matches without human players
You may hafta write a new gamemode class for that purpose. Since I have UT2k4 code in front of me, I see (file DeathMatch.uc)
In your new gamemode class get rid of this line. And you are good to go!
Code: Select all
auto State PendingMatch
{
... Some functions
function Timer()
{
local Controller P;
local bool bReady;
Global.Timer();
// first check if there are enough net players, and enough time has elapsed to give people
// a chance to join
if ( NumPlayers == 0 )
bWaitForNetPlayers = true;
// Now this part is hardcoded and nothing can be done here.
}
... Some more related functions
}
Patreon: https://www.patreon.com/FreeandOpenFeralidragon wrote:Trial and error is sometimes better than any tutorial, because we learn how it works for ourselfs, which kills any doubts about anything![]()
-
- Masterful
- Posts: 748
- Joined: Thu Jun 24, 2010 10:35 pm
- Personal rank: Retard
- Location: England
Re: Auto start matches without human players
Pretty crude but does what I required, just wanted matches to happen on my server without me having to have a player joined to it to collect match logs for node utstats.
Code: Select all
//=============================================================================
// Potatoes.
//=============================================================================
class Potatoes expands DeathMatchPlus;
function Timer()
{
Super.Timer();
bRequireReady = false;
StartMatch();
if(needPlayers()){
AddBot();
}
if ( bGameEnded )
{
if ( Level.TimeSeconds > EndTime + RestartWait )
RestartGame();
}
else if ( !bOverTime && (TimeLimit > 0) )
{
GameReplicationInfo.bStopCountDown = false;
RemainingTime--;
GameReplicationInfo.RemainingTime = RemainingTime;
if ( RemainingTime % 60 == 0 )
GameReplicationInfo.RemainingMinute = RemainingTime;
if ( RemainingTime <= 0 )
EndGame("timelimit");
}
else
{
ElapsedTime++;
GameReplicationInfo.ElapsedTime = ElapsedTime;
}
}
defaultproperties
{
GameName="Potatoes"
NetWait=0
RestartWait=0
bNetReady=True
bStartMatch=True
bRequireReady=False
MutatorClass=Class'Botpack.DMMutator'
DefaultWeapon=Class'BotPack.ImpactHammer'
}
-
- Godlike
- Posts: 2474
- Joined: Sat Mar 21, 2020 5:32 am
Re: Auto start matches without human players
Look like this can be done outside from gameInfo code. For example via mutator with Timer.
-
- Skilled
- Posts: 163
- Joined: Mon Jan 24, 2011 3:22 am
- Personal rank: Codezilla
Re: Auto start matches without human players
O yeah Buggie, my friend, enlighten us, why would you want to do that instead of graceful leverage of new game type's complete control!
Patreon: https://www.patreon.com/FreeandOpenFeralidragon wrote:Trial and error is sometimes better than any tutorial, because we learn how it works for ourselfs, which kills any doubts about anything![]()
-
- Godlike
- Posts: 6353
- Joined: Sun May 09, 2010 6:15 pm
- Location: On the roof.
Re: Auto start matches without human players
I've done something a few time ago for starting matches and quickly ending them in purpose to deliver server-travel at MapVote for loading mutators normally in multi-servers. Section for starting goes like this:
Code: Select all
if ( bStartGames )
{
if ( DeathMatchPlus(Level.Game) != None )
{
DeathMatchPlus(Level.Game).NetWait=0;
DeathMatchPlus(Level.Game).RestartWait=0;
DeathMatchPlus(Level.Game).bRequireReady=False;
DeathMatchPlus(Level.Game).bNetReady=False;
DeathMatchPlus(Level.Game).StartMatch();
}
}
-
- Masterful
- Posts: 748
- Joined: Thu Jun 24, 2010 10:35 pm
- Personal rank: Retard
- Location: England
Re: Auto start matches without human players
I put what sektor said, and created a Server Actor and called it in PreBeginPlay(). I did something similar before I did the custom gametype, but missed a few of the values and couldn't get it to work.
Thanks, much less faffing about compared to making custom gametypes.
Thanks, much less faffing about compared to making custom gametypes.
Code: Select all
//=============================================================================
// AutoStartActor.
//=============================================================================
class AutoStartActor expands Actor;
function PreBeginPlay(){
if ( DeathMatchPlus(Level.Game) != None ){
DeathMatchPlus(Level.Game).NetWait=0;
DeathMatchPlus(Level.Game).RestartWait=0;
DeathMatchPlus(Level.Game).bRequireReady=False;
DeathMatchPlus(Level.Game).bNetReady=False;
DeathMatchPlus(Level.Game).StartMatch();
}
}