Difference between revisions of "Dedicated autostart.gm"
From King Arthur's Gold Wiki
Splittingred (Talk | contribs) |
m |
||
(One intermediate revision by one other user not shown) | |||
Line 44: | Line 44: | ||
* [[Modding]] | * [[Modding]] | ||
* [[Server]] | * [[Server]] | ||
+ | * [[Dedicated autoconfig.gm]] | ||
* [[gamemode.cfg]] | * [[gamemode.cfg]] | ||
− | * [[ | + | * [[MapCycle.cfg]] |
[[Category:Modding]][[Category:Server]] | [[Category:Modding]][[Category:Server]] |
Latest revision as of 18:03, 5 August 2013
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.