Custom

From Valve Developer Community
Jump to: navigation, search
English (en)中文 (zh)Translate (Translate)
Counter-Strike: Global Offensive Level Creation
Icon-delisted.png
This page documents information about a game or software, Counter-Strike: Global Offensive Counter-Strike: Global Offensive, that is no longer available for purchase or download digitally.
It is covered here for historical and technical reference.

Custom is a game mode in Counter-Strike: Global Offensive Counter-Strike: Global Offensive. It is an "empty" game mode allowing the mapmaker to customize it per map. ConVars can be set with a map specific CFG file csgo/maps/cfg/<mapname>.cfg.

Warning.pngWarning:The default value of the ConVar sv_autoexec_mapname_cfg is 0, so this game mode does not execute that file by default. To get around this, use csgo/cfg/gamemode_custom_server.cfg, point_servercommand, point_clientcommand or VScript, see below.
Note.pngNote:That CFG file can also be executed with the console command exec <mapname> */maps. Use execwithwhitelist for the whitelist restriction.
Tip.pngTip:When writing a CFG file for the game rules, you can use a command such as exec gamemode_competitive as a first line to use a different game mode's gamerules as a baseline, so there might be less ConVars that you need to manipulate.

Every map can be run in the Custom game mode. Possibilities are:

  • Run it through the Workshop menus and choose the Custom game mode, if possible.
  • Set game_type 3 and game_mode 0 in the console before loading the map via map <mapname>. This is equivalent to invoking map <mapname> custom.
Tip.pngTip:This game mode does not have in icon for the loading screen, but the game searches it, so one can ship their own icon at csgo/materials/panorama/images/icons/ui/custom.svg.

Game Mode Description

This game mode allows map makers to run their map with a bunch of custom settings via a custom config file csgo/maps/cfg/<mapname>.cfg.

It allows to play mode variants like scoutzknivez and aim maps with their unique settings embedded right in the map. So, how many new game modes will Custom support? We don’t know! We can’t wait to see what the community comes up with. We’ve provided some Custom mode examples in the SDK which you can get by clicking here.

Technical details

When a map is loaded in any game mode, all whitelisted ConVars are set to their default value and are then possibly overwritten by subsequent config executions.

If sv_autoexec_mapname_cfg is not 0 while loading a map in the Custom game mode, then the CFG file csgo/maps/cfg/<mapname>.cfg is executed using execwithwhitelist, only affecting whitelisted ConVars listed in csgo/bspconvar_whitelist.txt.

Otherwise, the resulting game rules are very similar to Casual but with the noticeable differences mp_timelimit 5, mp_roundtime 5 and bot_quota_mode normal.

Publishing

When you upload your map to the workshop, your cfg file will automatically get packed into your bsp file, so don't worry about packing it yourself.[confirm]

What else can I ship with my BSP?
Lots of stuff! New textures, new models, new sounds and most importantly (for custom gameplay) you can ship VScript files. If you aren't familiar with VScript files, they are Squirrel language-based scripts that can be run in-game. To learn more about them, see VScript.
How do I pack additional files in my BSP?
This is covered on the CS:GO Map Publish Tool page along with what files are automatically packed in the BSP on upload.

Execute CFG files using VScript

nType <- ScriptGetGameType()
nMode <- ScriptGetGameMode()

if (nType == 3 && nMode == 0)
{
	SendToConsole("exec " + GetMapName() + " */maps")
}

To achieve what this game mode used to be made for, namely the execution of csgo/maps/cfg/<mapname>.cfg, but without depending on sv_autoexec_mapname_cfg, we need only one short VScript with the concept named at CS:GO Game Modes#Game Mode dependent Events.

  • Create a text file with the content shown on the right. Save it at csgo/scripts/vscripts/ or in a subfolder from there as a .nut file.
  • In Hammer, create a logic_script and add this file to its Entity Scripts.
  • In-game, the script will be executed every time a round starts. If the current game mode is Custom, the script executes the CFG file csgo/maps/cfg/<mapname>.cfg.
Note.pngNote:Incidentally, many other things can be done other than just a CFG execution, see List of CS:GO Script Functions.

Accordingly, both the script and the CFG file must be packed to the BSP file when publishing, see e.g. VIDE.