Page 1 of 1

How can I run a custom mapcycle/game mode?

Posted: Sat Aug 25, 2012 12:29 am
by Vanderburg
  1. Open up your control panel with us (https://www.nfoservers.com/control) and click on the "Easy setup" page.
  2. Click "gamemodes_server.txt" to expand that file section.
  3. Here's a simple example gamemodes_server.txt which can be your starting point. Copy and paste this into the empty text box you just revealed.

    Code: Select all

    "GameModes_Server.txt"
    {
    	"gameTypes"
    	{
    		"classic"
    		{
    			"gameModes"
    			{
    				"casual"
    				{
    					"maxplayers"		"20"
    
    					"exec" 
    					{
    						"exec"					"ca_custom_convar.cfg"
    					}
    
    					"mapgroupsMP" 
    					{
    						"mg_bomb"		""
    					}
    				}
    
    				"competitive"
    				{
    					"maxplayers"		"20"
    				}
    			}
    		}
    
    		"gungame"
    		{
    			"gameModes"
    			{
    				"gungameprogressive"
    				{
    					"maxplayers"		"20"
    				}
    
    				"gungametrbomb"
    				{
    					"maxplayers"		"20"
    				}
    			}
    		}
    	}
    
    	"mapgroups"
    	{
    
    		"mg_bomb"
    		{
    			"imagename"		"mapgroup-custom1"
    			"nameID"		"#SFUI_Mapgroup_mg_bomb"
    			"name"			"mg_bomb"
    			"maps"
    			{
    				"cs_italy"		""
    				"de_dust"		""
    				"de_train"		""
    				"de_dust2"		""
    				"de_aztec"		""
    				"de_inferno"		""
    				"de_nuke"		""
    				"ar_baggage"		""
    				"de_lake"		""
    				"de_bank"		""
    				"de_safehouse"		""
    				"de_sugarcane"		""
    				"ar_shoots"		""
    				"de_stmarc"		""
    				"de_shorttrain"		""
    				"cs_office"		""
    			}
    		}
    	}
    }
  4. Under the "mapgroups" section near the bottom, adjust the list of maps within the brackets to match your preferred cycle. If you add lines for new maps, make they match the simple format of these example lines.
  5. In the section above that, note that we are editing the "classic casual" game mode, making the new set of allowed mapgroups just "mp_custom", matching the name of the mapgroup you just created. If you are actually running a different mode, you will need to override its corresponding "mapgroupsMP" section in its tree, instead. For instance, to adjust "classic competitive", change the word "casual" to "competitive". Similarly, if you want to adjust the "demolition" type, you'll need to change the word "classic" to "gungame" and the word "casual" to "gungametrbomb". These names and sections correspond to the defaults defined by Valve in gamemodes.txt.
  6. On the "Easy setup" page, also adjust "Starting map:" and "Map group:" to match a map from your new mapgroup and to match the map group name. For instance, here, you could enter "de_aztec_se" and "mg_custom".
  7. Submit the "Easy setup" page.
  8. Click the "Server control" page in the control panel and restart your server. It should start up with your new settings.
In your mapgroup, make sure to only specify maps that will work with your chosen game type/mode. If you list maps that will not work -- such as "cs_" (hostage) maps in a defuse/bomb-only mode like Demolition -- your client will freeze when you join the server.

If you want special cvars (aka convars, aka console variables) defined for just this game type/mode, such as mp_startmoney and mp_maxmoney, you will need to define them separately in a cfg/gamemode_xxx_server.cfg file, where "xxx" is the game mode you are modifying. For more variables that you can change, and to see what the defaults are, reference cfg/gamemode_xxx.cfg. We recommend setting variables that apply to the server overall, like the rcon password and hostname, in the cfg/server.cfg file on your server instead.

That's it! Well, not exactly. There's a lot of other stuff you can set in gamemodes_server.txt, like skins, bot difficulty, etc, but that's for another tutorial.