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

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(Revised and investigated many aspects.)
Line 1: Line 1:
This tutorial on how to make a Guardian Scenario map requires on you to know how to map for CS:GO already. If you don't know, you should learn how to [[Level Design|here.]]
{{stub}}


The Guardian Scenario was first introduced around Operation: Bloodhound as a way to play co-op with a friend inside specific maps. These maps have the ''gd_'' prefix.
This tutorial on how to make a Guardian Scenario map requires you to know how to map for CS:GO already. If you don't know, you should learn how to [[Level Design|here.]]
This tutorial will go over the special requirements when making these kinds of maps.
This tutorial will go over the special requirements when making these kinds of maps.


The latter half of this tutorial will guide through how to set up this gamemode for Hostage Rescue Situations, as this functionality was added by Valve, but not ever properly acted upon.
The Guardian Scenario is about defending a bombsite as CT or a hostage as T against waves of rushing enemy bots. The human players win by making kills under special conditions, e.g. with a specified weapon. If both of them die, the mission restarts.


==Which Maps Are Supported?==
The mode was first introduced around Operation: Bloodhound as a way to play co-op with a friend inside specific maps.<br>
The ''gd_'' prefix is for maps that are designed primarily for this gamemode.


If you want to try out some of Valve's Guardian Scenario Maps, load up one of the following maps and use the commands ''game_mode 0'' and ''game_type 4''
==Playing Guardian on any Map==
* gd_bank ''(Has more limited LOS to make a better bombsite)''
* gd_cbble ''(Lack of Stairs on B; and modified drop zone; Hostage Rescue Scenario)''
* gd_crashsite ''(Special Guardian Only Map!)''
* gd_lake ''(Hostage Rescue Scenario)''
* cs_assault
* cs_italy
* cs_militia
* cs_office
* de_aztec
* de_cache
* de_cbble
* de_coast ''(From Operation: Wildfire)''
* de_dust
* de_dust2 ''(Has Alternate Script)''
* de_empire ''(From Operation: Wildfire; Has Alternate Script)''
* de_inferno
* de_lake ''(Has Alternate Script)''
* de_mikla ''(From Operation: Wildfire; Has Alternate Script)''
* de_mirage ''(Has Alternate Script)''
* de_nuke
* de_overpass ''(Has Alternate Script)''
* de_royal
* de_safehouse
* de_train ''(Has Two Alternate Scripts)''
* de_tulip ''(Has Alternate Script)''
* de_vertigo


Although gd_assault is in the game files, it is broken, and unlikely to be fixed.
Guardian is a gamemode that every map can be launched with. It requires <code>game_type 4</code> and <code>game_mode 0</code> before launching the map using <code>map <mapname></code>, or all in one command: <code>map <mapname> guardian</code> (see [[CSGO Game Mode Commands]]).


=GD Maps=
The only other thing to do is the execution of a couple of console commands to make the mode run correctly. This is where [[cfg|config]]s come in handy, as they are not more than a sequence of console commands which are all invoked when executed.


Valve originally planned for the Guardian gamemode to be on special gd_ maps, but then moved away from it when they realised it was easier to use regular maps than to create their own. Should you still want to, it's still supported. It might make for a more interesting gameplay experience!
Valve has prepared a number of configs for the official maps as a part of the Operations which can be found at <code>csgo/maps/cfg/guardian_[...].cfg</code>.
 
{{Deprecated|Any file with the name <code>guardian_opXX_[...].cfg</code> is up to date and works correctly on the destined map. The other files might use outdated commands/syntaxes and need to be edited to work correctly.}}
 
To execute a file, copy-paste it into <code>csgo/cfg/</code> and use <code>exec <filename></code> and restart the current game using <code>mp_restartgame 1</code>.
{{Idea|To stay organized, make a subfolder for guardian, for example <code>csgo/cfg/guardian/</code> and execute files inside it using <code>exec guardian/<filename></code>.}}
{{Todo|Is there a way to execute files at <code>csgo/maps/cfg/</code> without copy-pasting? Sadly, commands like <code>exec ../maps/cfg/[...]</code> do not function.}}
 
{{Note|The official maps do not have a Guardian configuration "baked" into the level, although it would be possible for any map. It is possible to write different configs for the same map: Valve provided even two configs for each bomb spot of many ''de_'' maps.}}
 
 
 
==Making a Map only for Guardian==
 
Valve originally planned the Guardian gamemode 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 gamemode instead of creating new maps only for it. But should you still want to, it's still supported. It might be a more interesting gameplay experience!
 
The map gd_cbble still exists and has a modified T spawn: The fountain is a bomb spot with some additional cover.


===Setting up a bombsite and Counter-Terrorist Spawns===
===Setting up a bombsite and Counter-Terrorist Spawns===


The first thing any ''gd_'' map will need is a bombsite. I'm not going to go through how to make one here. Just ensure it is fair and balanced.
The first thing any ''gd_'' map will need is a [[func_bomb_target|bombsite]]. Ensure it is fair and balanced. Don't make more than one.
 
''gd_'' maps only have one bombsite so don't make any more than that.


Place CT spawns inside the bombsite zone so that they know where to defend when they spawn.
Place [[info_player_counterterrorist|CT spawns]] inside the bombsite zone so that they know where to defend when they spawn.


===Setting up Terrorist Spawns===
===Setting up Terrorist Spawns===


There should be several corridors from your bombsite to the terrorist spawns.
There should be several corridors from your bombsite to the [[info_player_terrorist|terrorist spawns]].


There should be 5 to 10 spawns that are placed throughout the map. The terrorists will spawn randomly at these points and will rush the bombsite.  
There should be 5 to 10 spawns that are placed throughout the map. The terrorists will spawn randomly at these points and will rush the bombsite.  


=DE Maps=


The granddaddy of Counter-Strike can support the mode.


As long as you have at least one bombsite, the map can be used in Guardian mode, but if you are only releasing it for the Guardian gamemode, make it a gd_ map.
==Automatic execution of Guardian Configs==
 
Using [[VScript]] it is possible to fire events depending on the gamemode, which is also used for [[Creating_a_Wingman_Map|Wingman]]. The following is an example for a VScript that - if saved as <code>.nut</code> file inside <code>csgo/scripts/vscripts/</code> and used as an Entity Script of an entity in the map - will execute commands to the console only if the current gamemode is Guardian.
 
<syntaxhighlight lang=cpp>
TYPE <- ScriptGetGameType()
MODE <- ScriptGetGameMode()
 
if (TYPE == 4 && MODE == 0) // Guardian uses game_type 4 and game_mode 0
{
// EITHER: execute a .cfg file, as long as this works. SendToConsoleServer("exec <filename>") does not work however.
SendToConsole("exec <filename>")
// OR to be safe: execute every single command:
SendToConsoleServer("...") // replace dots with a console command
SendToConsoleServer("...")
// ...
}
 
</syntaxhighlight>
 
 
 
==Developing a Guardian [[cfg|Config]]==
 
As mentioned above, besides launching the map in the Guardian gamemode, there is "just" a number of console commands that have to be executed to make a map support Guardian. This section is about what to execute and the effects of certain console commands.
 
The best way to create a config is to copy-paste an existing config by Valve and to adjust the [[ConVar]]s at your liking. There are explanations as comments inside the latest files. In the following, we use the file <code>csgo/maps/cfg/guardian_op10_dust2_a.cfg</code> as a leitmotif and split it up into subsections. This is the state of the file when it was last changed on 2021-01-21.
 
 
 
===Gamemode, Round and Spawn Settings===
 
<syntaxhighlight lang=cpp>
//GUARDIAN MISSION SETTINGS
 
// map
// de_dust 2 A site
// dm_reset_spawns to reset spawn/bomb site
 
// the index of the bombsite that CTs will spawn at (the index is different per map)
mp_guardian_target_site 0
 
// what team will spawn randomly, 3 is team CT
mp_randomspawn 3
mp_maxrounds 30
mp_roundtime 30
bot_difficulty 1
bot_quota 7
mp_autoteambalance 0
 
// whether or not to use respawn waves
// 1 will have then spawn in rolling waves
// 1 will have then spawn in rolling waves
// 2 has them spawn only when the whole team is dead
mp_use_respawn_waves 2
mp_respawn_on_death_t 1
 
// who wins if time runs out (-1 == map default, 0 == draw, 2 == Ts, 3 == CTs)
mp_default_team_winner_no_objective 2
</syntaxhighlight>
 
For hostage maps, replace the <code>mp_guardian_target_site</code> command by:
<syntaxhighlight lang=cpp>
mp_guardian_force_collect_hostages_timeout 1
mp_hostages_spawn_same_every_round 1
mp_hostages_spawn_force_positions 0 // play around with the value
</syntaxhighlight>
 
 
 
===Bot AI Settings===
 
<syntaxhighlight lang=cpp>
mp_bot_ai_bt "scripts/ai/guardian/bt_op10_dust2_a.kv3"
</syntaxhighlight>
 
See {{ent|mp_bot_ai_bt}} for more details to that command. To get generic bots, use <code>"scripts/ai/guardian/bt_config.kv3"</code> as the value for it.
 
In short: Bots can be programmed map specifically using <code>.kv3</code> text files (as seen in <code>csgo/scripts/ai/guardian/</code>) which allow the programmer to make bots
* teleport (e.g. closer to the interesting part of the map),
* try to throw grenades with exact lineups,
* rush to a specified coordiante.
 
 
 
===Economy and Equipment Settings===
 
<syntaxhighlight lang=cpp>
// economy settings
mp_startmoney 800
mp_maxmoney 16000
mp_afterroundmoney 0
mp_buytime 1800
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
 
//Override for buy status map info. 0 = everyone can buy, 1 = ct 2 = t 3 = nobody
sv_buy_status_override 0
mp_buy_anywhere                                    1
mp_buy_during_immunity                              0
 
// player weapons and equipment
//ct
mp_ct_default_primary ""
mp_ct_default_secondary "weapon_usp_silencer"
mp_free_armor 0
sv_guardian_health_refresh_per_wave 50
sv_guardian_respawn_health     50
//t
mp_t_default_primary ""
mp_t_default_secondary ""
//mp_t_default_grenades ""
 
// set new items from other game modes
sv_guardian_extra_equipment_ct "item_assaultsuit"
//sv_guardian_extra_equipment_t
//sv_guardian_refresh_ammo_for_items_on_waves
</syntaxhighlight>
 
{{Tip|If you want to restrict the human players from buying certain weapons, you can either adjust cash values or make use of {{ent|mp_items_prohibited}} to disallow exact items.}}
{{Tip|It is possible to use something like <code>mp_items_prohibited "33"</code> to restrict [[weapon_mp7]], so [[weapon_mp5sd]] is equipped automatically. This example is from <code>csgo/maps/cfg/guardian_op09_card2.cfg</code>.}}
{{Tip|You can also use extraordinary items:<br><code>sv_guardian_extra_equipment_ct exojump</code> as seen in <code>csgo/maps/cfg/guardian_op09_card4</code>.<br><code>sv_guardian_extra_equipment_t weapon_shield</code> as seen in <code>csgo/maps/cfg/guardian_op09_card13.cfg</code>.}}
 
 
 
===Bot Settings===
 
<syntaxhighlight lang=cpp>
// 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
 
//sv_guardian_max_wave_for_heavy 0
//sv_guardian_min_wave_for_heavy 0
//sv_guardian_heavy_count 0
 
 
// bot weapons. if zero, bots may not use weapon type
bot_allow_shotguns 0
bot_allow_rifles 1
bot_allow_machine_guns                              0
bot_allow_snipers 1
</syntaxhighlight>
 
{{Note|All bots use the same AI. This means they might try to escort hostages or to pick up the dropped bomb although they are on the wrong team.}}
 
 
 
===Player Mission Settings===
 
<syntaxhighlight lang=cpp>
// # of kills needed witht he special weapon to win the match
 
mp_guardian_special_kills_needed 15
 
// which weapon is needed to get kills with to win the match
// if this is blank, the players just need to survive until the round timer expires to win
// make sure mp_default_team_winner_no_objective is set to have the CTs win if this is set to blank!
 
mp_guardian_special_weapon_needed "%weapon_ssg08%" 
mp_guardian_loc_weapon ""
</syntaxhighlight>
 
The value of <code>mp_guardian_special_weapon_needed</code> determines the condition(s) that kills must pass to be counted for the human team. It can be one or a combination of the following:
{| class="standard-table mw-collapsible mw-collapsed"
! Expression
! Meaning
|-
| <code>""</code> or <code>any</code> or any invalid expression
| Every kill
|-
| <code>awp</code>, <code>ak47</code>, etc.
| Only kills with the specified weapon (omitting the <code>weapon_</code> prefix)
|-
| <code>%weapon_awp%</code>, <code>%weapon_ak47%</code>, etc.
| Only kills with the specified weapon (see [[List of Counter-Strike: Global Offensive Entities|List of CS:GO Entities]] for a list of weapons)
|-
| <code>%weapon_secondary%</code>
| Only pistol kills
|-
| <code>%weapon_knife%</code>
| Only knife kills
|-
| <code>%weapon_grenade%</code>
| Only grenade kills
|-
| <code>%cond_match_ts_unique_weapon%</code>
| Only weapons that the human team has not done any kill with yet
|-
| <code>%cond_player_zoomed%</code>
| Only kills where the killer has scoped with a weapon
|-
| <code>%cond_damage_headshot%</code>
| Only kills caused by a headshot
|-
| <code>%cond_damage_burn%</code>
| Only kills caused by fire
|-
| <code>(%cond_victim_distance% <= 10)</code>
| Only kills against players that are at most 10 meters away from the killer
|-
| <code>!%[...]%</code>
| '''NOT''': A kill must '''NOT''' meet the condition to be counted.
|-
| <code>%[...]% <nowiki>||</nowiki> %[...]%</code>
| '''OR''': A kill must meet '''ANY''' of these conditions to be counted.
|-
| <code>%[...]% && %[...]%</code>
| '''AND''': A kill must meet '''ALL''' of these conditions to be counted.
|-
| <code>( [...] )</code>
| Influences the order of evaluation of the previous three.
|}
 
The value of <code>mp_guardian_loc_string_hud</code> 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 <code>csgo/resource/csgo_english.txt</code> and used with a preceding hash sign. It makes sense to use one of the following:
{| class="standard-table mw-collapsible mw-collapsed"
! mp_guardian_loc_string_hud
! Displayed Text in English
|-
| <code>""</code>
| Get kills: {s:weapon}
|-
| <code>"#guardian_mission_type_kills"</code>
| Get kills: {s:weapon}
|-
| <code>"#guardian_mission_type_headshots"</code>
| Get headshots: {s:weapon}
|-
| <code>"#guardian_mission_type_unscoped"</code>
| Get unscoped kills: {s:weapon}
|-
| <code>"#guardian_mission_type_enemy_weapon"</code>
| Get kills with enemy's {s:weapon}
|-
| <code>"#guardian_mission_type_enemy_airborne"</code>
| Get airborne kills: {s:weapon}
|-
| <code>"#guardian_mission_type_flashbang"</code>
| Kill blinded enemies
|-
| <code>"#guardian_mission_type_ct_weapons"</code>
| Get kills with Counter-Terrorist weapons
|}
 
These strings can contain the expression <code>{s:weapon}</code> which will be replaced by the value of <code>mp_guardian_loc_weapon</code>. If not set, the game tries to pick it itself. Some of the existing strings are:
{| class="standard-table mw-collapsible mw-collapsed"
! mp_guardian_loc_weapon
! Displayed Text in English
|-
| <code>#quest_enemy_weapon</code>
| Enemy Weapon
|-
| <code>#quest_weapon_CZ75a_or_enemy_weapon</code>
| CZ75-Auto or any enemy weapon
|-
| <code>#quest_weapon_sniperrifle</code>
| any sniper rifle
|-
| <code>#quest_weapon_m4</code>
| any M4 rifle
|-
| <code>#quest_weapon_starter_ct</code>
| any default CT pistol
|-
| <code>#quest_weapon_ct</code>
| Counter-Terrorist weapon
|-
| <code>#quest_weapon_t</code>
| Terrorist weapon
|-
| <code>#quest_weapon_any_pistol</code>
| any pistol
|-
| <code>#quest_weapon_any_weapon</code>
| any weapon
|-
| <code>#quest_weapon_any_shotgun</code>
| any shotgun
|-
| <code>#quest_weapon_any_smg</code>
| any smg
|-
| <code>#quest_weapon_ssg08_or_mag7</code>
| SSG 08 or MAG-7
|-
| <code>#quest_weapon_awp_or_p90</code>
| AWP or P90
|-
| <code>#quest_weapon_unique_pistol</code>
| Different Pistols
|}
 
The following are examples from the existing files inside <code>csgo/maps/cfg/</code> to give an example of how these three commands can be used together:
{| class="standard-table mw-collapsible mw-collapsed"
! Filename
! mp_guardian_special_weapon_needed
! mp_guardian_loc_string_hud
! mp_guardian_loc_weapon
|-
| guardian_op09_card1
| "%weapon_ssg08% <nowiki>||</nowiki> %weapon_mag7%"
| ""
| "#quest_weapon_ssg08_or_mag7"
|-
| guardian_op09_card1_2
| "%weapon_p90% <nowiki>||</nowiki> %weapon_awp%"
| ""
| "#quest_weapon_awp_or_p90"
|-
| guardian_op09_card4
| <nowiki>"%weapon_nova% || %weapon_xm1014% || %weapon_mag7% || %weapon_sawedoff%"</nowiki>
| ""
| "#quest_weapon_any_shotgun"
|-
| guardian_op09_card5
| "%weapon_p90% <nowiki>||</nowiki> %weapon_awp%"
| ""
| "#quest_weapon_awp_or_p90"
|-
| guardian_op09_card7_1
| "%weapon_awp% && !%cond_player_zoomed%"
| "#guardian_mission_type_unscoped"
| ""
|-
| guardian_op09_card8
| <nowiki>"%weapon_m4a1% || %weapon_m4a1_silencer% || %weapon_hkp2000% || %weapon_usp_silencer% || %weapon_famas% || %weapon_aug% || %weapon_mag7% || %weapon_scar20% || %weapon_fiveseven% || %weapon_mp9%"</nowiki>
| "#guardian_mission_type_ct_weapons"
| ""
|-
| guardian_op09_card9
| "%weapon_usp_silencer% && %cond_damage_headshot%"
| "#guardian_mission_type_headshots"
| ""
|-
| guardian_op09_card11_1
| "%weapon_grenade%"
| ""
| ""
|-
| guardian_op09_card11_2
| "( %weapon_incgrenade% <nowiki>||</nowiki> %weapon_molotov% ) && %cond_damage_burn%"
| ""
| ""
|-
| guardian_op10_ancient_a
| <nowiki>"%weapon_nova% || %weapon_mag7% || %weapon_sawedoff% || %weapon_xm1014%"</nowiki>
| ""
| "#SFUI_WPNHUD_Shotgun"
|-
| guardian_op10_apollo
| "%cond_match_ts_unique_weapon% && %weapon_secondary%"
| ""
| "#quest_weapon_unique_pistol"
|-
| guardian_op10_dust2_b
| "(%cond_victim_distance% <= 10)"
| ""
| "#quest_1071_hud_var_desc"
|-
| guardian_op10_nuke_b
| <nowiki>"(%weapon_mp9% || %weapon_mp7% || %weapon_mp5sd% || %weapon_ump45% || %weapon_mp9% || %weapon_bizon% || %weapon_p90% || %weapon_mac10%)"</nowiki>
| ""
| "#quest_weapon_any_smg"
|-
| guardian_op10_overpass_a
| "(%weapon_aug% && %cond_damage_headshot%)"
| ""
| "#quest_1067_hud_var_desc"
|-
| guardian_op10_train_b
| <nowiki>"%weapon_ssg08% || %weapon_awp% || %weapon_scar20% || %weapon_g3sg1%"</nowiki>
| ""
| "#quest_weapon_sniperrifle"
|-
| guardian_op10_vertigo_b
| <nowiki>"%weapon_glock% || %weapon_tec9% || %weapon_sawedoff% || %weapon_mac10% || %weapon_galilar% || %weapon_ak47% || %weapon_sg556% || %weapon_g3sg1%"</nowiki>
| ""
| "#quest_weapon_t"
|}
 
 
 
===Boundary Settings===
 
<syntaxhighlight lang=cpp>
// radius around the bombsite players can move, min is where warning starts, max is where damage occurs
mp_guardian_player_dist_min 1000
mp_guardian_player_dist_max 1200
 
//guardian bounds config
mp_guardian_clear_all_bounds
mp_guardian_new_bounds
mp_guardian_add_bounds_pt 539.2 2774.0 -114.8
mp_guardian_add_bounds_pt 1044.7 3070.0 349.3
mp_guardian_add_bounds_pt 1572.0 3070.0 -114.8
[...]
mp_guardian_add_bounds_pt 527.0 2082.0 349.3
mp_guardian_new_bounds
mp_guardian_add_bounds_pt 539.3 2058.0 95.4
mp_guardian_add_bounds_pt 478.2 2042.0 367.8
mp_guardian_add_bounds_pt 458.2 2042.0 95.4
[...]
mp_guardian_add_bounds_pt 548.0 2091.5 367.8
</syntaxhighlight>
 
If there are no bounds set, the values of <code>mp_guardian_player_dist_min</code> and <code>mp_guardian_player_dist_max</code> are primarily used. The first determines at which range from the target bomb site the player view starts to fade gray and a warning appears. The second determines at which range from the bombsite damage starts. This way, the playable area is a sphere with the origin of a bomb site as center.
 
Alternatively, it is possible to define custom boundaries to get other shapes. If there are bounds defined, the '''DIFFERENCE''' of the [[ConVar]]s <code>mp_guardian_player_dist_min</code> and <code>mp_guardian_player_dist_max</code> (mathematically: the value of <code>max&nbsp;-&nbsp;min</code>) is then used to determine the distance from the defined bounds until the warning and damage occur. If these two convars have the values 1000 and 1200 it means that damage occurs to [[player]]s that are not at most 200 units away from the interiors of all defined bounds. The same would apply to the values 2000 and 2200.
* Use <code>mp_guardian_clear_all_bounds</code> to clear all existing bounds, possibly from previously played maps. Do this once even if you don't use these bounds.
** Use <code>mp_guardian_new_bounds</code> to start a new area.
*** Use <code>mp_guardian_add_bounds_pt <x> <y> <z></code> to add a new corner point of the boundary. An idea is to get a [[wiki:Prism_(geometry)|prism]] which means that in the end, there are only two different z-coordinates used for the corners. For each vertical edge, one corner is enough. Enter top and bottom corners alternately and go through the corners clockwise or counter-clockwise. Use {{ent|noclip}} to fly to a corner, enter {{ent|getpos}} (to get your eyes' position) or <code>getpos_exact</code> (for your feet's position) and copy-paste the coordinates to the config. Note that the last point added will internally be connected to the first point of the last area that had been begun in the previous step.
 


To play the Guardian gamemode, you need a guardian.txt file. A template is available _here_


If the Bots don't make it to the bombsite after some time, they will all die, and be respawned
[[Category:Counter-Strike: Global Offensive]]
[[Category:Counter-Strike: Global Offensive]]
[[Category:Level Design]]
[[Category:Level Design]]
[[Category:Tutorials]]
[[Category:Tutorials]]

Revision as of 16:46, 19 February 2021

Stub

This article or section is a stub. You can help by expanding it.

This tutorial on how to make a Guardian Scenario map requires you to know how to map for CS:GO already. If you don't know, you should learn how to here. This tutorial will go over the special requirements when making these kinds of maps.

The Guardian Scenario is about defending a bombsite as CT or a hostage as T against waves of rushing enemy bots. The human players win by making kills under special conditions, e.g. with a specified weapon. If both of them die, the mission restarts.

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 gamemode.

Playing Guardian on any Map

Guardian is a gamemode that every map can be launched with. It requires game_type 4 and game_mode 0 before launching the map using map <mapname>, or all in one command: map <mapname> guardian (see CSGO Game Mode Commands).

The only other thing to do is the execution of a couple of console commands to make the mode run correctly. This is where configs come in handy, as they are not more than a sequence of console commands which are all invoked when executed.

Valve has prepared a number of configs for the official maps as a part of the Operations which can be found at csgo/maps/cfg/guardian_[...].cfg.

Obsolete-notext.pngDeprecated:Any file with the name guardian_opXX_[...].cfg is up to date and works correctly on the destined map. The other files might use outdated commands/syntaxes and need to be edited to work correctly.

To execute a file, copy-paste it into csgo/cfg/ and use exec <filename> and restart the current game using mp_restartgame 1.

Tip.pngIdea:To stay organized, make a subfolder for guardian, for example csgo/cfg/guardian/ and execute files inside it using exec guardian/<filename>.
Todo: Is there a way to execute files at csgo/maps/cfg/ without copy-pasting? Sadly, commands like exec ../maps/cfg/[...] do not function.
Note.pngNote:The official maps do not have a Guardian configuration "baked" into the level, although it would be possible for any map. It is possible to write different configs for the same map: Valve provided even two configs for each bomb spot of many de_ maps.


Making a Map only for Guardian

Valve originally planned the Guardian gamemode 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 gamemode instead of creating new maps only for it. But should you still want to, it's still supported. It might be a more interesting gameplay experience!

The map gd_cbble still exists and has a modified T spawn: The fountain is a bomb spot with some additional cover.

Setting up a bombsite and Counter-Terrorist Spawns

The first thing any gd_ map will need is a bombsite. Ensure it is fair and balanced. Don't make more than one.

Place CT spawns inside the bombsite zone so that they know where to defend when they spawn.

Setting up Terrorist Spawns

There should be several corridors from your bombsite to the terrorist spawns.

There should be 5 to 10 spawns that are placed throughout the map. The terrorists will spawn randomly at these points and will rush the bombsite.


Automatic execution of Guardian Configs

Using VScript it is possible to fire events depending on the gamemode, which is also used for Wingman. The following 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 - will execute commands to the console only if the current gamemode is Guardian.

TYPE <- ScriptGetGameType()
MODE <- ScriptGetGameMode()

if (TYPE == 4 && MODE == 0) // Guardian uses game_type 4 and game_mode 0
{
	// EITHER: execute a .cfg file, as long as this works. SendToConsoleServer("exec <filename>") does not work however.
	
	SendToConsole("exec <filename>")
	
	// OR to be safe: execute every single command:
	
	SendToConsoleServer("...") // replace dots with a console command
	SendToConsoleServer("...")
	// ...
}


Developing a Guardian Config

As mentioned above, besides launching the map in the Guardian gamemode, there is "just" a number of console commands that have to be executed to make a map support Guardian. This section is about what to execute and the effects of certain console commands.

The best way to create a config is to copy-paste an existing config by Valve and to adjust the ConVars at your liking. There are explanations as comments inside the latest files. In the following, we use the file csgo/maps/cfg/guardian_op10_dust2_a.cfg as a leitmotif and split it up into subsections. This is the state of the file when it was last changed on 2021-01-21.


Gamemode, Round and Spawn Settings

//GUARDIAN MISSION SETTINGS

// map
// de_dust 2 A site
// dm_reset_spawns to reset spawn/bomb site

// the index of the bombsite that CTs will spawn at (the index is different per map)
mp_guardian_target_site 								0

// what team will spawn randomly, 3 is team CT
mp_randomspawn 										3
mp_maxrounds 										30
mp_roundtime 										30
bot_difficulty										1	
bot_quota											7
mp_autoteambalance									0

// whether or not to use respawn waves
// 1 will have then spawn in rolling waves
// 1 will have then spawn in rolling waves
// 2 has them spawn only when the whole team is dead
mp_use_respawn_waves									2
mp_respawn_on_death_t									1

// who wins if time runs out (-1 == map default, 0 == draw, 2 == Ts, 3 == CTs)
mp_default_team_winner_no_objective							2

For hostage maps, replace the mp_guardian_target_site command by:

mp_guardian_force_collect_hostages_timeout 			1
mp_hostages_spawn_same_every_round					1
mp_hostages_spawn_force_positions					0 // play around with the value


Bot AI Settings

mp_bot_ai_bt "scripts/ai/guardian/bt_op10_dust2_a.kv3"

See mp_bot_ai_bt for more details to that command. To get generic bots, use "scripts/ai/guardian/bt_config.kv3" as the value for it.

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),
  • try to throw grenades with exact lineups,
  • rush to a specified coordiante.


Economy and Equipment Settings

// economy settings
mp_startmoney										800
mp_maxmoney											16000
mp_afterroundmoney									0
mp_buytime											1800
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

//Override for buy status map info. 0 = everyone can buy, 1 = ct 2 = t 3 = nobody
sv_buy_status_override									0
mp_buy_anywhere                                     					1
mp_buy_during_immunity                              					0

// player weapons and equipment
//ct
mp_ct_default_primary									""
mp_ct_default_secondary									"weapon_usp_silencer"
mp_free_armor											0
sv_guardian_health_refresh_per_wave						50
sv_guardian_respawn_health							    50
//t
mp_t_default_primary									""
mp_t_default_secondary									""
//mp_t_default_grenades									""

// set new items from other game modes
sv_guardian_extra_equipment_ct							"item_assaultsuit"	
//sv_guardian_extra_equipment_t						
//sv_guardian_refresh_ammo_for_items_on_waves
Tip.pngTip:If you want to restrict the human players from buying certain weapons, you can either adjust cash values or make use of mp_items_prohibited to disallow exact items.
Tip.pngTip:It is possible to use something like 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.
Tip.pngTip:You can also use extraordinary items:
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.


Bot Settings

// 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

//sv_guardian_max_wave_for_heavy						0
//sv_guardian_min_wave_for_heavy						0
//sv_guardian_heavy_count								0


// bot weapons. if zero, bots may not use weapon type
bot_allow_shotguns									0					
bot_allow_rifles									1
bot_allow_machine_guns                              0
bot_allow_snipers									1
Note.pngNote:All bots use the same AI. This means they might try to escort hostages or to pick up the dropped bomb although they are on the wrong team.


Player Mission Settings

// # of kills needed witht he special weapon to win the match

mp_guardian_special_kills_needed					15

// which weapon is needed to get kills with to win the match
// if this is blank, the players just need to survive until the round timer expires to win
// make sure mp_default_team_winner_no_objective is set to have the CTs win if this is set to blank!

mp_guardian_special_weapon_needed					"%weapon_ssg08%"  
mp_guardian_loc_weapon								""

The value of mp_guardian_special_weapon_needed determines the condition(s) that kills must pass to be counted for the human team. It can be one or a combination of the following:

Expression Meaning
"" or any or any invalid expression Every kill
awp, ak47, etc. Only kills with the specified weapon (omitting the weapon_ prefix)
%weapon_awp%, %weapon_ak47%, etc. Only kills with the specified weapon (see List of CS:GO Entities for a list of weapons)
%weapon_secondary% Only pistol kills
%weapon_knife% Only knife kills
%weapon_grenade% Only grenade kills
%cond_match_ts_unique_weapon% Only weapons that the human team has not done any kill with yet
%cond_player_zoomed% Only kills where the killer has scoped with a weapon
%cond_damage_headshot% Only kills caused by a headshot
%cond_damage_burn% Only kills caused by fire
(%cond_victim_distance% <= 10) Only kills against players that are at most 10 meters away from the killer
!%[...]% NOT: A kill must NOT meet the condition to be counted.
%[...]% || %[...]% OR: A kill must meet ANY of these conditions to be counted.
%[...]% && %[...]% AND: A kill must meet ALL of these conditions to be counted.
( [...] ) Influences the order of evaluation of the previous three.

The value of 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_english.txt and used with a preceding hash sign. It makes sense to use one of the following:

mp_guardian_loc_string_hud Displayed Text in English
"" Get kills: {s:weapon}
"#guardian_mission_type_kills" Get kills: {s:weapon}
"#guardian_mission_type_headshots" Get headshots: {s:weapon}
"#guardian_mission_type_unscoped" Get unscoped kills: {s:weapon}
"#guardian_mission_type_enemy_weapon" Get kills with enemy's {s:weapon}
"#guardian_mission_type_enemy_airborne" Get airborne kills: {s:weapon}
"#guardian_mission_type_flashbang" Kill blinded enemies
"#guardian_mission_type_ct_weapons" Get kills with Counter-Terrorist weapons

These strings can contain the expression {s:weapon} which will be replaced by the value of mp_guardian_loc_weapon. If not set, the game tries to pick it itself. Some of the existing strings are:

mp_guardian_loc_weapon Displayed Text in English
#quest_enemy_weapon Enemy Weapon
#quest_weapon_CZ75a_or_enemy_weapon CZ75-Auto or any enemy weapon
#quest_weapon_sniperrifle any sniper rifle
#quest_weapon_m4 any M4 rifle
#quest_weapon_starter_ct any default CT pistol
#quest_weapon_ct Counter-Terrorist weapon
#quest_weapon_t Terrorist weapon
#quest_weapon_any_pistol any pistol
#quest_weapon_any_weapon any weapon
#quest_weapon_any_shotgun any shotgun
#quest_weapon_any_smg any smg
#quest_weapon_ssg08_or_mag7 SSG 08 or MAG-7
#quest_weapon_awp_or_p90 AWP or P90
#quest_weapon_unique_pistol Different Pistols

The following are examples from the existing files inside csgo/maps/cfg/ to give an example of how these three commands can be used together:

Filename mp_guardian_special_weapon_needed mp_guardian_loc_string_hud mp_guardian_loc_weapon
guardian_op09_card1 "%weapon_ssg08% || %weapon_mag7%" "" "#quest_weapon_ssg08_or_mag7"
guardian_op09_card1_2 "%weapon_p90% || %weapon_awp%" "" "#quest_weapon_awp_or_p90"
guardian_op09_card4 "%weapon_nova% || %weapon_xm1014% || %weapon_mag7% || %weapon_sawedoff%" "" "#quest_weapon_any_shotgun"
guardian_op09_card5 "%weapon_p90% || %weapon_awp%" "" "#quest_weapon_awp_or_p90"
guardian_op09_card7_1 "%weapon_awp% && !%cond_player_zoomed%" "#guardian_mission_type_unscoped" ""
guardian_op09_card8 "%weapon_m4a1% || %weapon_m4a1_silencer% || %weapon_hkp2000% || %weapon_usp_silencer% || %weapon_famas% || %weapon_aug% || %weapon_mag7% || %weapon_scar20% || %weapon_fiveseven% || %weapon_mp9%" "#guardian_mission_type_ct_weapons" ""
guardian_op09_card9 "%weapon_usp_silencer% && %cond_damage_headshot%" "#guardian_mission_type_headshots" ""
guardian_op09_card11_1 "%weapon_grenade%" "" ""
guardian_op09_card11_2 "( %weapon_incgrenade% || %weapon_molotov% ) && %cond_damage_burn%" "" ""
guardian_op10_ancient_a "%weapon_nova% || %weapon_mag7% || %weapon_sawedoff% || %weapon_xm1014%" "" "#SFUI_WPNHUD_Shotgun"
guardian_op10_apollo "%cond_match_ts_unique_weapon% && %weapon_secondary%" "" "#quest_weapon_unique_pistol"
guardian_op10_dust2_b "(%cond_victim_distance% <= 10)" "" "#quest_1071_hud_var_desc"
guardian_op10_nuke_b "(%weapon_mp9% || %weapon_mp7% || %weapon_mp5sd% || %weapon_ump45% || %weapon_mp9% || %weapon_bizon% || %weapon_p90% || %weapon_mac10%)" "" "#quest_weapon_any_smg"
guardian_op10_overpass_a "(%weapon_aug% && %cond_damage_headshot%)" "" "#quest_1067_hud_var_desc"
guardian_op10_train_b "%weapon_ssg08% || %weapon_awp% || %weapon_scar20% || %weapon_g3sg1%" "" "#quest_weapon_sniperrifle"
guardian_op10_vertigo_b "%weapon_glock% || %weapon_tec9% || %weapon_sawedoff% || %weapon_mac10% || %weapon_galilar% || %weapon_ak47% || %weapon_sg556% || %weapon_g3sg1%" "" "#quest_weapon_t"


Boundary Settings

// radius around the bombsite players can move, min is where warning starts, max is where damage occurs
mp_guardian_player_dist_min							1000									
mp_guardian_player_dist_max							1200

//guardian bounds config
mp_guardian_clear_all_bounds
mp_guardian_new_bounds
mp_guardian_add_bounds_pt 539.2 2774.0 -114.8
mp_guardian_add_bounds_pt 1044.7 3070.0 349.3
mp_guardian_add_bounds_pt 1572.0 3070.0 -114.8
[...]
mp_guardian_add_bounds_pt 527.0 2082.0 349.3
mp_guardian_new_bounds
mp_guardian_add_bounds_pt 539.3 2058.0 95.4
mp_guardian_add_bounds_pt 478.2 2042.0 367.8
mp_guardian_add_bounds_pt 458.2 2042.0 95.4
[...]
mp_guardian_add_bounds_pt 548.0 2091.5 367.8

If there are no bounds set, the values of mp_guardian_player_dist_min and mp_guardian_player_dist_max are primarily used. The first determines at which range from the target bomb site the player view starts to fade gray and a warning appears. The second determines at which range from the bombsite damage starts. This way, the playable area is a sphere with the origin of a bomb site as center.

Alternatively, it is possible to define custom boundaries to get other shapes. If there are bounds defined, the DIFFERENCE of the ConVars mp_guardian_player_dist_min and mp_guardian_player_dist_max (mathematically: the value of max - min) is then used to determine the distance from the defined bounds until the warning and damage occur. If these two convars have the values 1000 and 1200 it means that damage occurs to players that are not at most 200 units away from the interiors of all defined bounds. The same would apply to the values 2000 and 2200.

  • Use mp_guardian_clear_all_bounds to clear all existing bounds, possibly from previously played maps. Do this once even if you don't use these bounds.
    • Use mp_guardian_new_bounds to start a new area.
      • Use mp_guardian_add_bounds_pt <x> <y> <z> to add a new corner point of the boundary. An idea is to get a prism which means that in the end, there are only two different z-coordinates used for the corners. For each vertical edge, one corner is enough. Enter top and bottom corners alternately and go through the corners clockwise or counter-clockwise. Use noclip to fly to a corner, enter getpos (to get your eyes' position) or getpos_exact (for your feet's position) and copy-paste the coordinates to the config. Note that the last point added will internally be connected to the first point of the last area that had been begun in the previous step.