CS:GO Game Modes/Guardian




It is covered here for historical and technical reference.

Guardian (internally cooperative
) is a game mode in Counter-Strike: Global Offensive.
This site covers the special requirements to make this game mode work for a map.
The mode was first introduced around Operation Bloodhound as a way to play co-op with a friend inside specific maps.
The gd_ prefix is for maps that are designed primarily for this game mode, but it has no internal purpose. Valve had created the new map gd_crashsite as well as some edits: gd_bank, gd_cbble, gd_lake and gd_sugarcane. Only gd_cbble still exists in the current game files and has a modified T spawn: The fountain is a bomb spot with some additional cover.
Valve originally planned the Guardian game mode to be played on special gd_ maps, but then moved away from it when they realised that it is easier to make regular maps support this game mode instead of creating new maps only for it. On the other hand, one could still make a map that is designed for this game mode, it might be a more interesting gameplay experience!
Game Mode Description
- The human players play against bots. They spawn near a bomb site as CT or near a hostage as T and must defend it against waves of rushing bots.
- Each round starts with a freezetime and buying. From then on, bots will spawn in waves. When all bots are dead, the players receive health and are allowed to buy until the bots respawn for the next wave.
- The human players win the round and the game by making a given number of kills under special conditions, e.g. with a specified weapon. The condition and the number of special kills that has already been made can be seen in a HUD element on the left. As soon as the required number of kills is reached, all players are stopped and an end panel is shown after which the next map loads.
- The human players lose a round immediately, all players are stopped and the round restarts...
- if the human players are all dead,
- if a bomb has been planted on their bomb site or
- if their hostage has been picked up.
- The human players lose the game if mp_maxrounds is reached and they did not win a round.
Playing Guardian on any Map
The Guardian game mode can be programmed almost entirely with console commands so that the only map requirements are player spawns and at least one bombsite or hostage. This means that all regular de_ or cs_ maps are eligible for Guardian. Since Operation Riptide it is even possible to play custom Bomb Defusal scenarios on
Danger Zone maps, provided there is a proper Guardian Config being used.

csgo/maps/cfg/guardian_[...].cfg
. For some de_ maps, there are even multiple for each bomb spot.Note that the files with the prefix
guardian_opXX_[...].cfg
are up to date and work correctly on the destined map; The others might use outdated commands/syntaxes and need to be edited to work correctly.There are two steps to play Guardian on a map:
- Invoke the commands
game_type 4
,game_mode 0
andmap <mapname>
, or all in one command:map <mapname> guardian
(see CS:GO Game Modes). - In-game, the adjustment of some ConVars is required (especially to make bots spawn in waves) and more adjustments can be made to customize a mission. However, there is no official way to accomplish the execution of these console commands. There are some options:
- Execute the commands manually in-game. You don't want to do that.
- Create new CFG file in
csgo/maps/cfg/
(or simplycsgo/cfg/
) and write the commands. Execute it usingexecwithwhitelist <filename>.cfg */maps
orexec <filename>.cfg */maps
(or simplyexec <filename>
) and restart the game, e.g. usingmp_restartgame 1
. - Write the commands in
csgo/cfg/gamemode_cooperative_server
. Advantage: These files are executed automatically. For publishing, a custom variant of these files can be packed into a map, overriding a local file! - Use a VScript and its functions
SendToConsole
orSendToConsoleServer
to execute the commands. - If you are the maker of the map, you can add a VScript that does the CFG execiton when the map loads, see below. This however might override any CFGs that are executed earlier such that it is not possible to play a different guardian scenario on this particular map other than the one that the VScript defines.
Guardian Configs
As mentioned above, besides launching the map in the Guardian game mode, there is "just" a number of console commands that have to be executed get a proper Guardian Scenario. This section is about what to execute and the effects of certain console commands and convars.
In the following, you find a baseline for a Guardian Config. Of course it does not contain map specific settings (e.g. spawn points defined by coordinates), so it alone won't deliver too good results but it should make any map at least playable for this game mode. In Hostage Rescue it can happen that the human players spawn and die immediately because they are to far away from the hostage.

csgo/cfg/gamemode_competitive.cfg, gamemode_cooperative.cfg, gamemode_cooperative_server.cfg
. The former two should not be modified, at most the third. You might also want to read through the former two.Boundaries
The location where the Guardian Scenario is played depends and can also be manipulated.
- On Bomb Defusal maps, setting the convar mp_guardian_target_site to 0 or 1 determines the location, either bomb site A or B. Set this to -1 if there is no bomb site.
- On Hostage Rescue maps, a specific hostage that is already on the map can be selected using mp_hostages_spawn_force_positions <i> or alternatively, a new hostage can be placed using mp_hostages_spawn_force_positions_xyz <x> <y> <z>.
- On
Danger Zone maps, one can create a Bomb Defusal scenario by using mp_plant_c4_anywhere 1 and the commands mp_guardian_bomb_plant_[...] to define the boundaries (see below) of a custom bomb target as well as a custom X decal with mp_guardian_bomb_plant_custom_x_mark_location "<x> <y> <z>".
Typically, the human players should stay near the location where the Guardian Scenario takes place. This is achieved with boundaries such that if the human player leaves them, their view fades to gray, they receive a warning and if they go even further, they receive lethal damage. These boundaries can be defined as a sphere (if possible) or using custom bounds (always possible).
- If there is a func_bomb_target or a hostage_entity, then it is possible to use the sphere around its origin as bounds. In this case, the convar mp_guardian_player_dist_min can be set to describe the radius of the inner sphere where the human players can move freely. Then the convar mp_guardian_player_dist_max can be set to a larger radius: The human players receive damage if they step outside this larger sphere. The area between the inner and outer sphere is used for the transition to gray.
- Custom bounds consist of an arbitrary number of convex prisms and each convex prism consists of an arbitrary number of points. Valve has implemented a system in-game to create, visualize (!) and save such structures, see below. When some bounds are defined, then mp_guardian_player_dist_min and _max get a slightly different meaning. When a player starts to run outside of the bounds, the fade to gray starts right at the border of the bounds and damage starts at a distance of max - min, for example after 100 units if min=800, max=900 which by the way would have the same effect as min=1370, max=1470 and so forth.
Spawn Points
With no adjustments, the players would spawn at the default info_player_(counter)terrorist entities.
The definite solution to get custom spawn points are the following commands. Use the clear command once followed by at least 2 human spawns or 5 enemy spawns, respectively. In-game, you can obtain the coordinates with getpos_exact.
mp_guardian_clear_all_player_spawns mp_guardian_add_player_spawn_pt <x> <y> <z> <pitch> <yaw> <roll> mp_guardian_clear_all_enemy_spawns mp_guardian_add_enemy_spawn_pt <x> <y> <z> <pitch> <yaw> <roll>
In Bomb Defusal, it is also possible to set mp_randomspawn to 3. This convar determines which teams should spawn randomly (at info_deathmatch_spawn entities) where 0 means none, 1: both teams, 2: Ts and 3: CTs. Normally, those spawns are generated across the entire Nav Mesh, however, in Guardian it is special that they are only generated near the one func_bomb_target that is specified by mp_guardian_target_site, if any. These spawns can be re-generated with dm_reset_spawns and viewed with map_showspawnpoints <seconds> if the generation was successful.
Sadly this system cannot be used in Hostage Rescue, thus mp_randomspawn should be 0 and it is easier to set the spawn points with the above commands.
Player Mission
By game logic, the human players win a round (and the game) as soon as they score a certain number of special kills that meet certain conditions which can be set with the following convars.
// Human players' objective
mp_guardian_special_kills_needed 10 // The number of special kills needed to win the game
mp_guardian_special_weapon_needed "awp" // The condition(s) that a kill must meet to increment the kills needed to complete the mission
mp_guardian_loc_string_hud "#guardian_mission_type_kills" // Localized string token to use on hud for this mission, otherwise defaults to "Get Kills: <weapon>"
mp_guardian_loc_weapon "" // Override to weapon dialog var applied to UI
|
mp_guardian_special_kills_needed
stands for the number of kills that the human players must score to win the game.
If set to 0 or a negative value, the game ends as soon as the humans score one kill.
mp_guardian_special_weapon_needed
determines the condition(s) that kills must pass to be counted as a special kill. It can be one or a combination of the following:
Expression ExpandWhat kind of kills count?

mp_guardian_special_weapon_needed "%weapon_awp%"
requires the human players to score kills with the AWP.
mp_guardian_special_weapon_needed "%weapon_smg% && %cond_player_airborne%"
requires the human players to score kills with any SMG while being in midair.
mp_guardian_special_weapon_needed "%weapon_awp% && !%cond_player_zoomed% || %weapon_ssg08%"
requires the human players to score kills either while unscoped with the AWP or with the SSG 08.
mp_guardian_special_weapon_needed "%cond_damage_headshot% && (%weapon_deagle% || %weapon_revolver%)"
requires the human players to score headshot kills with either the Desert Eagle or the R8 Revolver.
mp_guardian_loc_string_hud
is the mission text shown on the left of the screen. This can be any text surrounded by quotation marks, but for language compatiblity, there are predefined string tokens that can be found at csgo/resource/csgo_<language>.txt
and used with a preceding hash sign. It makes sense to use one of the following:
mp_guardian_loc_string_hud ExpandDisplayed Text in English
mp_guardian_loc_weapon
is what the expression {s:weapon}
will be replaced with. Ideally, this is also a localized string, but it is rarely needed at all because the game already does a good job picking a string itself. Some of the existing strings are:
mp_guardian_loc_weapon ExpandDisplayed Text in English
The following are examples from the existing files inside csgo/maps/cfg/
to give you an idea of how these three commands can be used together:
Filename mp_guardian_special_weapon_needed mp_guardian_loc_string_hud Expandmp_guardian_loc_weapon
Economy and Equipment
From here on, you can bring up any ideas that you might have for the mission. There is no right or wrong configuration. Regard the following snippets as inspiration. There are a lot of convars that you can manipulate.
// economy settings
mp_startmoney 800 // Only given on game start! Not given when humans lose and the round restarts!
mp_afterroundmoney 800 // Given every new round, except the first, so set this to the same as mp_startmoney
mp_maxmoney 16000
cash_player_killed_enemy_default 300 // Money award to player when they kill an enemy (which then gets scaled per weapon)
cash_player_killed_enemy_factor 1
cash_player_get_killed 0 // Money a player can get when they are killed by another player
cash_player_bomb_planted 300
cash_team_survive_guardian_wave 1000
cash_team_elimination_bomb_map 0
cash_team_loser_bonus -16000
cash_team_loser_bonus_consecutive_rounds 0
cash_team_bonus_shorthanded 0 // Should set to 0 because teams are unbalanced
mp_guardian_bot_money_per_wave 800 // The amount of money bots get time each wave the players complete. This # is abs
sv_buy_status_override 0 // Teams that are allowed to buy (-1: don't override, 0: everyone 1: no one, 2: Ts, 3: CTs)
mp_buy_anywhere 1 // Buy anywhere (still, humans can only buy between waves!)
mp_buytime 1800 // Buy forever (round duration in seconds)
mp_buy_during_immunity 0
mp_buy_allow_guns 255 // 0: none, 255: all, sum up what shall be allowed: 1=pistols, 2=SMGs, 4=rifles, 8=shotguns, 16=snipers, 32=heavy
mp_buy_allow_grenades 1
mp_items_prohibited 0 // can disable specific items
// default equipment
mp_free_armor 0
mp_ct_default_primary ""
mp_ct_default_secondary "weapon_hkp2000"
mp_ct_default_melee "weapon_knife"
mp_ct_default_grenades ""
mp_t_default_primary ""
mp_t_default_secondary "weapon_glock"
mp_t_default_melee "weapon_knife"
mp_t_default_grenades ""
sv_guardian_extra_equipment_ct "" // Extra starting equipment for CT players in guardian modes
sv_guardian_extra_equipment_t "" // Extra starting equipment for Terrorist players in guardian modes
sv_guardian_starting_equipment_humans "weapon_healthshot" // Extra starting equipment for human players in guardian modes (not whitelisted)
sv_guardian_health_refresh_per_wave 50 // Health given to survivors per wave in guardian mode.
sv_guardian_spawn_health_ct 100 // Starting health in guardian modes.
sv_guardian_spawn_health_t 100 // Starting health in guardian modes.
sv_guardian_respawn_health 50 // Starting health of guardian players when respawned.
sv_guardian_refresh_ammo_for_items_on_waves "" // List of additional weapons to refill ammo on waves.
|


mp_items_prohibited "33"
to restrict weapon_mp7, so weapon_mp5sd is equipped automatically. This example is from csgo/maps/cfg/guardian_op09_card2.cfg
.
sv_guardian_extra_equipment_ct exojump
as seen in csgo/maps/cfg/guardian_op09_card4
.sv_guardian_extra_equipment_t weapon_shield
as seen in csgo/maps/cfg/guardian_op09_card13.cfg
sv_guardian_extra_equipment_t "parachute"
as seen in csgo/maps/cfg/guardian_op11_blacksite_1.cfg
.
Bots
// initial bot difficulty
bot_difficulty 2
// bot gets easier on team T each time they win a round
sv_bots_get_easier_each_win 1
sv_bots_get_harder_after_each_wave 2
sv_bots_force_rebuy_every_round 0
sv_auto_adjust_bot_difficulty 0
// heavy weapons guy
sv_guardian_heavy_all 0 // 1: every bot is a heavy
sv_guardian_heavy_count 0 // max the number of heavies that will come
sv_guardian_max_wave_for_heavy 0 // last wave number that can have a heavy
sv_guardian_min_wave_for_heavy 0 // first wave number that can have a heavy
// bot weapons. if zero, bots may not use weapon type
bot_allow_machine_guns 1 // If nonzero, bots may use SMGs.
bot_allow_pistols 1 // If nonzero, bots may use pistols.
bot_allow_rifles 1 // If nonzero, bots may use rifles.
bot_allow_shotguns 1 // If nonzero, bots may use shotguns.
bot_allow_snipers 1 // If nonzero, bots may use sniper rifles.
bot_allow_sub_machine_guns 1 // If nonzero, bots may use sub-machine guns.
bot_allow_rogues 1 // If nonzero, bots may occasionally go 'rogue'. Rogue bots do not obey radio commands
mp_guardian_give_random_grenades_to_bots 1 // If set guardian bots will be given grenades at the beginning of the wave.
sv_guardian_reset_c4_every_wave 0 // 0: the C4 stays where bots have dropped it after a wave. 1: they spawn with the C4
|
The AI for the bots can be set with mp_bot_ai_bt.
In short: Bots can be programmed map specifically using .kv3
text files (as seen in csgo/scripts/ai/guardian/
) which allow the programmer to make bots
- teleport (e.g. closer to the interesting part of the map),
- throw grenades with exact lineups,
- rush to a specified coordiante.
- ...

Automatic execution of Guardian Configs
local TYPE = ScriptGetGameType()
local MODE = ScriptGetGameMode()
local ROUND = ScriptGetRoundsPlayed()
if (TYPE == 4 && MODE == 0 && ROUND == 0) // Guardian uses game_type 4 and game_mode 0
{
SendToConsole(format("execwithwhitelist guardian_%s.cfg */maps", GetMapName()))
// SendToConsole(format("exec guardian/%s", GetMapName()))
}
|
Using VScript it is possible to fire events depending on the game mode, which is also used for Wingman.
The code on the right is an example for a VScript that - if saved as .nut
file inside csgo/scripts/vscripts/
and used as an Entity Script of an entity in the map - can execute commands to the console when the map loads but only if the current game mode is Guardian.
In this particular case it executes the CFG file under csgo/maps/cfg/ that has the same name as the current map but with the prefix guardian_
.

SendToConsole
might have the problem that it works only for local servers where a player is the host. The function SendToConsoleServer
might not work because the command exec and its variants are not whitelisted - however, executing every single command from the CFG should work, assuming those convars are whitelisted.
|