Custom default local server settings

Started by Viathan, July 04, 2017, 01:38:36 PM

Previous topic - Next topic
Hey there, it's been a while. Glad to see that some ppl are still active on this game :cheers:


Creating a LAN server for mod testing can be awesome because you can turn off bots and stuff.
Nevertheless I find it annoying that I have to set the server settings over and over again whenever I restart the game.

So, here's the solution:
The default server settings are (kinda ugly/not clear) stored in the shell file ifs_mp_gameopts.lua
To override these simply, find (within the first 20 lines):
Code (lua) Select

if(not this.bFirstTime) then
  this.bFirstTime = 1
  this.iNumPlayers = this.iMaxPlayers
  this.iNumBots = this.iMaxBots
end


and extend it with an else statement like this:

Code (lua) Select

if(not this.bFirstTime) then
  this.bFirstTime = 1
  this.iNumPlayers = this.iMaxPlayers
  this.iNumBots = this.iMaxBots
else -- OVERRIDE DEFAULT SERVER OPTIONS
  this.iNumBots = 0 -- AI units per team set to 0
  this.bAutoAssignTeams = not this.bAutoAssignTeams -- enable team player select
end


Of course you can customize the other options as well.

Nice find thx :tu:
I've also customized this script a bit. A while ago I changed this line so that players only have to click once to go from 16 to 0 AI. Click twice to go to 32.

elseif (this.CurButton == "bots") then
--this.iNumBots = max(0,this.iNumBots - 1)
if(this.iNumBots == 0) then
if(this.bDedicated) then
this.iNumBots =this.iMaxDedicatedBots
else
this.iNumBots =this.iMaxBots
end
else
this.iNumBots = this.iNumBots - 16 ---- stock -1, fix added June 2014 by Phobos
end