Dedicated autostart.gm
From King Arthur's Gold Wiki
Located in Base/Scripts/, this is the file KAG uses to "initialize" the server. It is usually modified to enable different gamemodes based upon a global.
A simple dedicated_autostart.gm file would look like this:
newWorld( "" );
switchGameState(0);
startServer();
LoadRules("Rules/TDM/gamemode.cfg");
LoadMapCycle( "Scripts/mapcycle.cfg" );
LoadMap( "" );
print(`Loaded TDM default config`);
switchGameState(0);
startServer();
LoadRules("Rules/TDM/gamemode.cfg");
LoadMapCycle( "Scripts/mapcycle.cfg" );
LoadMap( "" );
print(`Loaded TDM default config`);
This loads a new world for the server, switches the game state to 0 (it is unknown what the flag is, but changing it does nothing), loads the Map Cycle, and then loads the Map. Print simply echoes out to the log file/console.
Some people use a global var and the if/else switch to easily switch between gamemodes:
global autostartswitch = 1;
newWorld( "" );
switchGameState(0);
startServer();
if (autostartswitch == 0) //ctf
{
LoadRules("Rules/CTF/gamemode.cfg");
LoadMapCycle( "Scripts/mapcycle.cfg" );
LoadMap( "" );
print(`Loaded CTF default config`);
}
else if (autostartswitch == 1) //tdm
{
LoadRules("Rules/TDM/gamemode.cfg");
LoadMapCycle( "Scripts/mapcycle.cfg" );
LoadMap( "" );
print(`Loaded TDM default config`);
}
newWorld( "" );
switchGameState(0);
startServer();
if (autostartswitch == 0) //ctf
{
LoadRules("Rules/CTF/gamemode.cfg");
LoadMapCycle( "Scripts/mapcycle.cfg" );
LoadMap( "" );
print(`Loaded CTF default config`);
}
else if (autostartswitch == 1) //tdm
{
LoadRules("Rules/TDM/gamemode.cfg");
LoadMapCycle( "Scripts/mapcycle.cfg" );
LoadMap( "" );
print(`Loaded TDM default config`);
}
Note the global setting the variable to 1, and then the if/elseif that tells KAG to load the TDM gamemode, since "autostartswitch" is set to 1.