Counter-Strike: Global Offensive/Game Modes/Custom: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Made some cosmetic changes to the list)
No edit summary
 
(21 intermediate revisions by 13 users not shown)
Line 1: Line 1:
If you are unfamiliar with making a map for Counter-Strike:GO or any other Source game, start here:
{{LanguageBar|title = Custom Game Mode}}
[[Counter-Strike:_Global_Offensive_Level_Creation|CS:GO Level Creation]]


The new Custom game mode allows map makers to run their map with a bunch of custom settings via a custom config file.  That means you can 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 [steam://install/745 clicking here].
{{back|Counter-Strike: Global Offensive Level Creation}}{{Delisted|csgo}}


== Where do I put my cfg file? ==
'''Custom''' is a [[game mode]] in {{csgo|4}}.
It is an "empty" game mode allowing the mapmaker to customize it per map. [[ConVar]]s can be set with a map specific [[CFG]] file <code>csgo/maps/cfg/<mapname>.cfg</code>.


Your cfg file must be located in:
{{Warning|The default value of the [[ConVar]] <code>sv_autoexec_mapname_cfg</code> is <code>0</code>, so this game mode does not execute that file by default. To get around this, use <code>csgo/cfg/gamemode_custom_server.cfg</code>, [[point_servercommand]], [[point_clientcommand]] or [[VScript]], see [[#Execute CFG files using VScript|below]].}}
csgo/maps/cfg
{{Note|That CFG file can also be executed with the console command {{ent|exec|<mapname> */maps}}. Use {{ent|execwithwhitelist}} for the whitelist restriction.}}
{{Tip|When writing a CFG file for the game rules, you can use a command such as <code>exec gamemode_competitive</code> 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.}}


The name of the config file must be named the same as your bsp. For example if your bsp is named "cp_watermelon.bsp", you would name your cfg file "cp_watermelon.cfg".  If your map is run with Custom game rules but you don't have a cfg file, it'll run your map with Classic Casual rules instead. 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.  See the SDK for more examples of this.
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 {{ent|game_type|3}} and {{ent|game_mode|0}} in the console before loading the map via <code>[[map (console command)|map]] <mapname></code>. This is equivalent to invoking <code>map <mapname> custom</code>.


== How do I run my map with Custom game rules? ==
{{Tip|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 <code>csgo/materials/panorama/images/icons/ui/custom.svg</code>.}}


There are a few ways you can do this.
== Game Mode Description ==
* When a map gets run through the in-game Workshop menus and run as a Custom map.
* If you set game_type to 3 in the console before you load the map via "map <your map>"
* Run the map from the console using "map <your map> custom"


== What else can I ship with my BSP ==
This game mode allows map makers to run their map with a bunch of custom settings via a custom [[CFG|config file]] <code>csgo/maps/cfg/<mapname>.cfg</code>.


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 and to learn more about them, see [[VScript]].
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 [steam://install/745 clicking here].


== How do I pack additional files in my BSP? ==
=== Technical details ===


This are covered on the [[CSGO_Map_Publish_Tool|Map Publish Tool]] page along with what files are automatically packed in the BSP on upload.
When a map is loaded in any game mode, all [[whitelistcmd|whitelisted ConVars]] are set to their default value and are then possibly overwritten by subsequent config executions.


== Map supported convars and descriptions ==
If <code>'''sv_autoexec_mapname_cfg'''</code> is not <code>0</code> while loading a map in the Custom game mode, then the [[CFG]] file <code>csgo/maps/cfg/<mapname>.cfg</code> is executed using {{ent|execwithwhitelist}}, only affecting [[whitelistcmd|whitelisted ConVars]] listed in <code>csgo/bspconvar_whitelist.txt</code>.
The following list contains the ConVars that may be included in your cfg file.


{{note|This list may be out of date.  See <code>bspconvar_whitelist.txt</code> located in "<code>..\common\Counter-Strike Global Offensive\csgo\</code>" for a complete updated list.}}
Otherwise, the resulting game rules are very similar to Casual but with the noticeable differences <code>mp_timelimit 5</code>, <code>mp_roundtime 5</code> and {{ent|bot_quota_mode|normal}}.


<pre>
== Publishing ==
// bot convars
bot_autodifficulty_threshold_high // Amount above avg human contribution score, above which a bot should lower its difficulty
bot_autodifficulty_threshold_low // Amount below avg human contribution score, below which a bot should raise its difficulty
bot_chatter // Control how bots talk. Allowed values: 'off', 'radio', 'minimal', or 'normal'.
bot_defer_to_human_goals // If nonzero and there is a human on the team, the bots will not do the scenario tasks.
bot_defer_to_human_items // If nonzero and there is a human on the team, the bots will not get scenario items.
bot_difficulty
bot_quota // Determines the total number of bots in the game.
bot_quota_mode // Determines the type of quota. Allowed values: 'normal', 'fill', and 'match'. If 'fill', the server will adjust bots to keep N players in the game, where N is bot_quota. If 'match', the server will maintain a 1:N ratio of humans to bots, where N is bot_quota.
bot_allow_grenades // If nonzero, bots may use grenades.
bot_allow_pistols // If nonzero, bots may use pistols.
bot_allow_sub_machine_guns // If nonzero, bots may use sub-machine guns.
bot_allow_shotguns // If nonzero, bots may use shotguns.
bot_allow_rifles // If nonzero, bots may use rifles.
bot_allow_snipers // If nonzero, bots may use sniper rifles.
bot_allow_machine_guns // If nonzero, bots may use the machine gun.


// player/team cash award and buy convars
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}}
mp_playercashawards // Players can earn money by performing in-game actions
cash_player_bomb_defused
cash_player_bomb_planted
cash_player_damage_hostage // The penalty (or bonus) players get from harming a hostage
cash_player_interact_with_hostage
cash_player_killed_enemy_default // Money award to player when they kill an enemy (which then gets scaled per weapon)
cash_player_killed_enemy_factor // Scaler that adjusts the money recieved per kill
cash_player_killed_hostage // The penalty (or bonus) players get for killing a hostage
cash_player_killed_teammate
cash_player_rescued_hostage
cash_player_respawn_amount // The money bonus a play can get when they respawn (if respawning is enabled)
cash_player_get_killed // Money a player can get when they are killed by another player
mp_teamcashawards // Teams can earn money by performing in-game actions
cash_team_elimination_bomb_map
cash_team_elimination_hostage_map_t
cash_team_elimination_hostage_map_ct
cash_team_hostage_alive
cash_team_hostage_interaction
cash_team_loser_bonus
cash_team_loser_bonus_consecutive_rounds
cash_team_planted_bomb_but_defused
cash_team_rescued_hostage
cash_team_terrorist_win_bomb
cash_team_win_by_defusing_bomb
cash_team_win_by_hostage_rescue
cash_team_win_by_time_running_out_bomb
cash_team_win_by_time_running_out_hostage
mp_afterroundmoney // Amount of money awared to every player after each round
mp_buytime // How many seconds after round start players can buy items for.
mp_buy_anywhere
mp_buy_during_immunity
mp_startmoney // Amount of money each player starts with on match start, half start or reset
mp_maxmoney // maximum amount of money allowed in a player's account


// item convars
;What else can I ship with my BSP?
mp_death_drop_defuser // Whether a defuser drops from a player holding on when they die
: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]].
mp_death_drop_grenade // Which grenade to drop on player death: 0=none, 1=best, 2=current or best
mp_death_drop_gun // Which gun to drop on player death: 0=none, 1=best, 2=current or best
mp_deathcam_skippable // Determines whether a player can early-out of the deathcam
mp_defuser_allocation // How to allocate defusers to CTs at start or round: 0=none, 1=random, 2=everyone
mp_give_player_c4 // Whether this map should spawn a c4 bomb for a player or not
mp_free_armor // Determines whether armor and helmet are given automatically.
mp_molotovusedelay // Number of seconds to delay before the molotov can be used after acquiring it
mp_weapons_allow_zeus // Determines whether the Zeus is purchasable or not
mp_weapons_allow_map_placed // If this convar is set, when a match starts, the game will not delete weapons placed in the map.
mp_weapons_glow_on_ground // If this convar is set, weapons on the ground will have a glow around them and can be seen through walls.
mp_ct_default_melee // The default melee weapon that the CTs will spawn with.  Even if this is blank, a knife will be given.  To give a taser, it should look like this: 'weapon_knife weapon_taser'.  Remember to set mp_weapons_allow_zeus to 1 if you want to give a taser!
mp_ct_default_secondary // The default secondary (pistol) weapon that the CTs will spawn with
mp_ct_default_primary // The default primary (rifle) weapon that the CTs will spawn with
mp_ct_default_grenades // The default grenades that the CTs will spawn with.  To give multiple grenades, separate each weapon class with a space like this: 'weapon_molotov weapon_hegrenade'
mp_t_default_melee // The default melee weapon that the Ts will spawn with.  Even if this is blank, a knife will be given. To give a taser, it should look like this: 'weapon_knife weapon_taser'.  Remember to set mp_weapons_allow_zeus to 1 if you want to give a taser!
mp_t_default_secondary // The default secondary (pistol) weapon that the Ts will spawn with
mp_t_default_primary // The default primary (rifle) weapon that the Ts will spawn with
mp_t_default_grenades // The default grenades that the CTs will spawn with. To give multiple grenades, separate each weapon class with a space like this: 'weapon_molotov weapon_hegrenade'
mp_buy_allow_grenades // Whether or not grenades can be purchased from the buy menu


// round and match setting convars
;How do I pack additional files in my BSP?
mp_freezetime // how many seconds to keep players frozen when the round starts
:This is covered on the [[CS:GO Map Publish Tool]] page along with what files are automatically packed in the BSP on upload.
mp_force_pick_time // The amount of time a player has on the team screen to make a selection before being auto-teamed
mp_halftime // Set to 1 to stay in halftime indefinitely. Set to 0 to resume the timer.
mp_match_can_clinch // 0=No mercy rule, 1=team can clinch match win early if they win > 1/2 total rounds
mp_maxrounds // max number of rounds to play before server changes maps
mp_roundtime // How many minutes each round takes.
mp_roundtime_defuse // How many minutes each round of Bomb Defuse takes.
mp_roundtime_hostage // How many minutes each round of Hostage Rescue takes.
mp_timelimit // Allow the match to end when mp_timelimit hits instead of waiting for the end of the current round.
mp_warmuptime // How long the warmup period lasts. Changing this value resets warmup.
mp_warmup_pausetimer // Set to 1 to stay in warmup indefinitely. Set to 0 to resume the timer.
mp_halftime_pausetimer // Set to 1 to stay in halftime indefinitely. Set to 0 to resume the timer.
mp_default_team_winner_no_objective // if set, the map will declare this team the winner when the round timer expires.  (-1 == map default, 0 == draw, 2 == Ts, 3 == CTs)
mp_hostagepenalty // Terrorist are kicked for killing too much hostages


// damage, team and communication convars
== Execute CFG files using VScript ==
mp_solid_teammates // Determines whether teammates are solid or not.
sv_allow_votes // Voting allowed in this mode
sv_alltalk // When set, players can hear all enemy communication (voice, chat)
sv_deadtalk // When set, dead players can speak (voice, text) to the living
sv_ignoregrenaderadio // Turn off Fire in the hole messages
mp_teammates_are_enemies // When set, your teammates act as enemies and all players are valid targets.
mp_damage_scale_ct_body // Scales the damage a CT player takes by this much when they take damage in the body. (1 == 100%, 0.5 == 50%)
mp_damage_scale_ct_head // Scales the damage a CT player takes by this much when they take damage in the head. (1 == 100%, 0.5 == 50%)
mp_damage_scale_t_body // Scales the damage a T player takes by this much when they take damage in the body. (1 == 100%, 0.5 == 50%)
mp_damage_scale_t_head // Scales the damage a T player takes by this much when they take damage in the head. (1 == 100%, 0.5 == 50%)
mp_friendlyfire // Allows team members to injure other members of their team
ff_damage_reduction_bullets // How much to reduce damage done to teammates when shot.  Range is from 0 - 1 (with 1 being damage equal to what is done to an enemy)
ff_damage_reduction_grenade // How much to reduce damage done to teammates by a thrown grenade.  Range is from 0 - 1 (with 1 being damage equal to what is done to an enemy)
ff_damage_reduction_grenade_self // How much to damage a player does to himself with his own grenade.  Range is from 0 - 1 (with 1 being damage equal to what is done to an enemy)
ff_damage_reduction_other // How much to reduce damage done to teammates by things other than bullets and grenades.  Range is from 0 - 1 (with 1 being damage equal to what is done to an enemy)
mp_limitteams // Max # of players 1 team can have over another (0 disables check)


// spectator, death, spawning and camera convars
{| style="float:right;"
spec_freeze_panel_extended_time // Time spent with the freeze panel still up after observer freeze cam is done.
| <syntaxhighlight lang=cpp>
spec_freeze_time // Time spend frozen in observer freeze cam.
nType <- ScriptGetGameType()
mp_forcecamera // Restricts spectator modes for dead players. 0 = Any team. 1 = Only own team. 2 = No one; fade to black on death (previously mp_fadetoblack).
nMode <- ScriptGetGameMode()
mp_respawn_immunitytime // How many seconds after respawn immunity lasts.
mp_respawn_on_death_t // When set to 1, terrorists will respawn after dying.
mp_respawn_on_death_ct // When set to 1, counter-terrorists will respawn after dying.
mp_display_kill_assists // Whether to display and score player assists
mp_use_respawn_waves // When set to 1, and that player's team is set to respawn, they will respawn in waves.
mp_respawnwavetime_ct // Time between respawn waves for CTs.
mp_respawnwavetime_t // Time between respawn waves for Terrorists.
mp_randomspawn // Determines whether players are to spawn. 0 = default; 1 = both teams; 2 = Terrorists; 3 = CTs.
mp_randomspawn_los
mp_radar_showall // Determines who should see all in the radar. 0 = default. 1 = both teams. 2 = Terrorists. 3 = CTs.


// world and movement convars
if (nType == 3 && nMode == 0)
sv_gravity // World gravity. (default is 800)
{
sv_accelerate
SendToConsole("exec " + GetMapName() + " */maps")
sv_stopspeed //"Minimum stopping speed when on ground.
}
sv_airaccelerate
</syntaxhighlight>
sv_wateraccelerate  
|}
sv_waterfriction  
sv_friction //"World friction."
sv_bounce //"Bounce multiplier for when physically simulated objects collide with other objects.
sv_maxvelocity //Maximum speed any ballistically moving object is allowed to attain per axis.
sv_maxspeed


// gungame/armsrace
To achieve what this game mode used to be made for, namely the execution of <code>csgo/maps/cfg/<mapname>.cfg</code>, but without depending on <code>sv_autoexec_mapname_cfg</code>, we need only one short [[VScript]] with the concept named at [[CS:GO Game Modes#Game Mode dependent Events]].
mp_ggprogressive_round_restart_delay
* Create a text file with the content shown on the right. Save it at <code>csgo/scripts/vscripts/</code> or in a subfolder from there as a <code>.nut</code> file.
mp_ggtr_bomb_defuse_bonus
* In [[Hammer]], create a [[logic_script]] and add this file to its <code>Entity Scripts</code>.
mp_ggtr_bomb_detonation_bonus
* 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 <code>csgo/maps/cfg/<mapname>.cfg</code>.
mp_ggtr_bomb_pts_for_flash
mp_ggtr_bomb_pts_for_he
mp_ggtr_bomb_pts_for_molotov
mp_ggtr_bomb_pts_for_upgrade
mp_ggtr_bomb_respawn_delay
mp_ggtr_end_round_kill_bonus
mp_ggtr_halftime_delay
mp_ggtr_last_weapon_kill_ends_half
sv_arms_race_vote_to_restart_disallowed_afte
</pre>


{{Note|Incidentally, many other things can be done other than just a CFG execution, see [[List of CS:GO Script Functions#Global functions|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]].
{{csgo-navbox}}
[[Category:Counter-Strike: Global Offensive]]
[[Category:Counter-Strike: Global Offensive]]
[[Category:Level_Design]]
[[Category:Entry pages]]

Latest revision as of 02:09, 14 May 2025

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.