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

From Valve Developer Community
Jump to navigation Jump to search
(Adjusted introduction, added section Game Mode Description. Named more ways to get configs running. Explained use of 'mp_guardian_shoot_point' briefly. "gamemode" -> "game mode")
mNo edit summary
 
(11 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{lang|Creating a Guardian Scenario Map}}
{{LanguageBar|title=CS:GO Game Modes/Guardian}}
{{back | Counter-Strike: Global Offensive Level Creation}}
{{back | Counter-Strike: Global Offensive Level Creation}}{{Delisted|csgo}}
[[File:Csgo icon guardian.png|left|link=]]
[[File:Csgo icon guardian.png|left|link=]]
'''Guardian''' (internally '''<code>cooperative</code>''') is a game mode in {{csgo|4}}.
This site covers the special requirements to make this game mode work for a map.
The mode was first introduced around {{csgoOperation|Bloodhound}} as a way to play co-op with a friend inside specific maps.


'''Guardian''' (internally '''Cooperative''') is a game mode in {{game name|csgo|name=Counter-Strike: Global Offensive}}.
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.
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.<br>
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!
The ''gd_'' prefix is for maps that are designed primarily for this game mode, but it has no internal purpose.


==Game Mode Description==
==Game Mode Description==


The Guardian Scenario is about defending a bombsite as CT or defending a hostage as T against waves of rushing enemy bots.
* The human players play against [[bot]]s. They spawn near a [[func_bomb_target|bomb site]] as CT or near a [[hostage_entity|hostage]] as T and must defend it against waves of rushing bots.
* The human players spawn near the target they must defend, either a [[func_bomb_target|bomb site]] or a [[hostage_entity|hostage]].
* 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 game 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 next wave of bots spawn.
* 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 win the round ''and'' the game by making a given number of kills under special conditions, e.g. with a specified weapon. 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...
* The human players lose a round and the round restarts...
** if the human players are all dead,
** if the human players are all dead,
** if a ''bomb has been planted'' on their bomb site or
** if a ''bomb has been planted'' on their bomb site or
Line 23: Line 24:
==Playing Guardian on any Map==
==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 [[func_bomb_target|bombsite]] or [[hostage_entity|hostage]]. This means that all regular ''de_'' or ''cs_'' maps are eligible for Guardian.
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 [[func_bomb_target|bombsite]] or [[hostage_entity|hostage]]. This means that all regular ''de_'' or ''cs_'' maps are eligible for Guardian. Since {{csgoOperation|Riptide}} it is even possible to play custom Bomb Defusal scenarios on {{csgo mode|Dz}} maps, provided there is a proper Guardian Config being used.
 
{{tip|Valve has prepared a number of guardian configs for the official maps as a part of the Operations which can be found at <code>csgo/maps/cfg/guardian_[...].cfg</code>. For some ''de_'' maps, there are even multiple for each bomb spot.<br>
Note that the files with the prefix <code>guardian_opXX_[...].cfg</code> 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:
There are two steps to play Guardian on a map:


# Invoke the commands <code>game_type 4</code>, <code>game_mode 0</code> and <code>[[map_(ConCommand)|map]] <mapname></code>, or all in one command: <code>map <mapname> guardian</code> (see [[CS:GO Game Mode Commands]]).
# Invoke the commands <code>game_type 4</code>, <code>game_mode 0</code> and <code>[[map (console command)|map]] <mapname></code>, or all in one command: <code>map <mapname> guardian</code> (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:
# 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.
#* Execute the commands manually in-game. You don't want to do that.
#* Write the commands in any [[cfg|.cfg]] file in <code>csgo/cfg/</code> and execute it using <code>exec <filename></code> and restart the game, e.g. using <code>mp_restartgame 1</code>.
#* Create new [[CFG]] file in <code>csgo/maps/cfg/</code> (or simply <code>csgo/cfg/</code>) and write the commands. Execute it using <code>[[execwithwhitelist]] <filename>.cfg */maps</code> or <code>exec <filename>.cfg */maps</code> (or simply <code>[[exec]] <filename></code>) and restart the game, e.g. using <code>mp_restartgame 1</code>.
#* Write the commands in <code>gamemode_cooperative</code> or <code>gamemode_cooperative_server</code>. Advantage: These files are executed automatically. For publishing, a custom variant of these files can be packed into a map, overriding a local file!
#* Write the commands in <code>csgo/cfg/gamemode_cooperative_server</code>. 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 <code>SendToConsole</code> or <code>SendToConsoleServer</code> to execute the commands.
#* Use a [[VScript]] and its functions <code>SendToConsole</code> or <code>SendToConsoleServer</code> to execute the commands.
#* Write the commands in any .cfg file in <code>csgo/cfg/</code> and execute it using [[VScript]], see [[#Automatic execution of Guardian Configs|below]].
#* If you are the maker of the map, you can add a [[VScript]] that does the CFG execiton when the map loads, see [[#Automatic execution of Guardian Configs|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.
<br>
{{Note|Maps are capable of doing step 2 on their own, see [[Creating_a_Guardian_Scenario_Map#Automatic_execution_of_Guardian_Configs|below]]. The official maps do not do that so that it is possible to play different guardian configs on the same map.}}


{{Tip|Valve has prepared a number of guardian configs for the official maps as a part of the Operations which can be found at <code>csgo/maps/cfg/guardian_[...].cfg</code>. For some ''de_'' maps, there are even two for each bomb spot. To use one of those files in step 2, copy-paste it (or even the entire <code>csgo/maps/cfg</code> folder) into <code>csgo/cfg/</code>.<br>{{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.}}<br>{{Deprecated|Any file inside <code>csgo/maps/cfg/</code> with the prefix <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.}}}}
==Guardian [[CFG|Configs]]==


{{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>.}}
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.


==Making a Map only for Guardian==
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.


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. But should you still want to, it's still supported. It might be a more interesting gameplay experience!
{{note|Remember that by default, the game will always execute the CFG files <code>csgo/cfg/gamemode_competitive.cfg, gamemode_cooperative.cfg, gamemode_cooperative_server.cfg</code>. The former two should '''not''' be modified, at most the third. You might also want to read through the former two.}}


Valve had created the new map ''gd_crashsite'' as well as some edits: ''gd_bank'', ''gd_cbble'', ''gd_lake'' and ''gd_sugarcane'' but 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.
{{Expand|title=Baseline for a Guardian Config|color={{csgo|col}}|
For [[Bomb Defusal]], you typically want something like the following as a baseline.
<syntaxhighlight lang=cpp>
// Respawning
mp_respawn_on_death_t 1 // In bomb defusal, terrorists should respawn
mp_respawn_on_death_ct 0 // Humans should not respawn by this rule. The game still handles human player respawns between waves
mp_use_respawn_waves 2 // 0: Rolling waves, like warmup respawns, 2: Spawn bots together when the whole bot team is dead
mp_maxrounds 30 // Give humans 15 tries. When humans win a round, the game ends
mp_roundtime 30 // Give humans 30 minutes per try...
mp_default_team_winner_no_objective 2 // ... and make them lose if the time is up (-1: map default, 0: draw, 2: Ts win, 3: CTs win)


===Setting up a bombsite and Counter-Terrorist Spawns===
// Bots
bot_quota 5
bot_quota_mode normal // Exactly 5 bots


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.
// Spawn points
mp_guardian_target_site 0 // Target bomb site index (-1: none), play around with this value
mp_randomspawn 3 // Respawn team 3 (human CTs) at target bomb site. Custom spawn points (mp_guardian_add_player_spawn_pt) have priority


Place [[info_player_counterterrorist|CT spawns]] inside the bombsite zone so that they know where to defend when they spawn.
// Boundaries
mp_guardian_player_dist_min 1000 // Distance from target bomb site center (or hostage) until screen fades gray. The warning sound is played at a distance of about min+(max-min)/4.
mp_guardian_player_dist_max 1200 // Distance from target bomb site center (or hostage) until damage occurs


===Setting up Terrorist Spawns===
// Human players' objective
mp_guardian_special_kills_needed 10 // The number of kills needed with a specific weapon.
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


There should be several corridors from your bombsite to the [[info_player_terrorist|terrorist spawns]].
// Buying anywhere
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)
</syntaxhighlight>


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.
For [[Hostage Rescue]], this requires just a little edit and some different commands:


==Guardian [[cfg|Config]]s==
<syntaxhighlight lang=cpp>
// Respawning
mp_respawn_on_death_t 0 // Humans are T here, so don't respawn them...
mp_respawn_on_death_ct 1 // ...but do respawn the bots on CT
mp_default_team_winner_no_objective 3 // The humans should lose on timeout (-1: map default, 0: draw, 2: Ts, 3: CTs)


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 to make a map support Guardian. This section is about what to execute and the effects of certain console commands.
// Spawn points
mp_guardian_target_site -1 // There is no bomb site that the game could generate random spawns at
mp_randomspawn 0 // Turn mp_randomspawn off instead, otherwise we get random spawns across the map


The easiest 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.
// Hostage Rescue
mp_guardian_force_collect_hostages_timeout 0 // Force bots to go rescue a hostage after not seeing an enemy for this amount of seconds
mp_hostages_spawn_same_every_round 1 // Hostages should not change their location between rounds (which they don't anyway)
</syntaxhighlight>
}}


{{Todo|
===Boundaries===
* Document several new ConVars that have been added with Operation Riptide.
[[File:Csgo guardian bounds 01.jpg|thumb|After invoking <code>mp_guardian_shoot_point</code>, the game will visualize the existing boundaries. Green with a black grid means that the local player is inside a prism's volume.]]
** custom bomb spot bounds (<code>mp_guardian_bomb_plant_[...]</code>)
[[File:Csgo guardian bounds 02.jpg|thumb|Red with no grid means that the local player is outside a prism's volume.]]
** custom hostage spawn point(s) (<code>mp_hostages_spawn_force_positions_xyz</code>)
The location where the Guardian Scenario is played depends and can also be manipulated.
** ...?
* On Bomb Defusal maps, setting the convar <tt>mp_guardian_target_site</tt> to 0 or 1 determines the location, either bomb site A or B. Set this to -1 if there is no bomb site.
* Deliver a minimal, generic config that makes the mode work.
* On Hostage Rescue maps, a specific hostage that is already on the map can be selected using {{ent|mp_hostages_spawn_force_positions|&lt;i>}} or alternatively, a new hostage can be placed using {{ent|mp_hostages_spawn_force_positions_xyz|<x> <y> <z>}}.
}}
* On {{csgo mode|Dz}} maps, one can create a Bomb Defusal scenario by using {{ent|mp_plant_c4_anywhere|1}} and the commands <tt>mp_guardian_bomb_plant_[...]</tt> to define the boundaries (see below) of a custom bomb target as well as a custom X decal with <tt>mp_guardian_bomb_plant_custom_x_mark_location "<x> <y> <z>"</tt>.


===Game Mode, Round and Spawn Settings===
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 <tt>mp_guardian_player_dist_min</tt> can be set to describe the radius of the inner sphere where the human players can move freely. Then the convar <tt>mp_guardian_player_dist_max</tt> 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 <tt>mp_guardian_player_dist_min</tt> and <tt>_max</tt> 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 <tt>max - min</tt>, for example after 100 units if <tt>min=800, max=900</tt> which by the way would have the same effect as <tt>min=1370, max=1470</tt> and so forth.


<syntaxhighlight lang=cpp>
{{Expand|title=Creating Custom Boundaries|color={{csgo|col}}|
//GUARDIAN MISSION SETTINGS
''For the bounds of bomb targets, replace <tt>mp_guardian_</tt> with <tt>mp_guardian_bomb_plant_</tt> in each of the following commands, except for <tt>mp_guardian_shoot_point</tt>.''
# Start by invoking {{mdCode|outline|mp_guardian_clear_all_bounds}} to wipe everything that has been added so far.
# To add a new prism, invoke {{mdCode|outline|mp_guardian_new_bounds}}. This might also finish the previous prism.
# To add a point to the prism, aim at that position and invoke {{mdCode|outline|mp_guardian_shoot_point}}. To save a lot of time, bind this command to a mouse button (''mouse1''). Alternatively you can also add a point by its coordinates using {{mdCode|outline|mp_guardian_add_bounds_pt <x> <y> <z>}}.<br>{{note|The prism will always stay convex; This means that when adding a point, the volume can only become larger and never smaller. Shooting a point inside the current volume has no effect. To get a playable area that is concave, create multiple prisms by going back to step 2.}}
# When you're finished, invoke {{mdCode|outline|mp_guardian_emit_bounds_config}} and copy the text in the console to your Guardian Config - that's it. {{How|How to turn the volume visualization back off?}}
{{Example|{{pre|
//guardian bounds config
mp_guardian_clear_all_bounds
mp_guardian_new_bounds
mp_guardian_add_bounds_pt -53.0 -70.6 11774.0
mp_guardian_add_bounds_pt -21.0 -837.4 12026.4
mp_guardian_add_bounds_pt -21.0 -872.3 11774.0
mp_guardian_add_bounds_pt -21.0 -966.0 12026.4
mp_guardian_add_bounds_pt -23.0 -1370.0 11774.0
mp_guardian_add_bounds_pt -78.0 -1454.7 12026.4
mp_guardian_add_bounds_pt -98.0 -1454.7 11774.0
mp_guardian_add_bounds_pt -172.4 -1449.4 12026.4
mp_guardian_add_bounds_pt -220.3 -443.2 11774.0
mp_guardian_add_bounds_pt -219.0 -358.5 12026.4
mp_guardian_add_bounds_pt -218.6 -340.0 11774.0
mp_guardian_add_bounds_pt -209.1 -70.0 12026.4
mp_guardian_add_bounds_pt -77.0 -54.1 11774.0
mp_guardian_new_bounds
mp_guardian_add_bounds_pt -292.4 -69.0 11774.0
mp_guardian_add_bounds_pt -218.5 -70.6 12001.4
mp_guardian_add_bounds_pt -208.0 -83.2 11774.0
mp_guardian_add_bounds_pt -188.0 -921.2 12001.4
mp_guardian_add_bounds_pt -188.0 -941.2 11774.0
mp_guardian_add_bounds_pt -218.2 -954.5 12001.4
mp_guardian_add_bounds_pt -235.9 -956.9 11774.0
mp_guardian_add_bounds_pt -386.3 -963.4 12001.4
mp_guardian_add_bounds_pt -422.8 -959.2 11774.0
mp_guardian_add_bounds_pt -428.0 -943.4 12001.4
mp_guardian_add_bounds_pt -577.0 -309.0 11774.0
mp_guardian_add_bounds_pt -582.5 -135.0 12001.4
mp_guardian_new_bounds
mp_guardian_add_bounds_pt -467.1 -741.5 11776.0
mp_guardian_add_bounds_pt -467.1 -761.5 11871.0
mp_guardian_add_bounds_pt -654.9 -799.0 11776.0
mp_guardian_add_bounds_pt -776.9 -799.0 11871.0
mp_guardian_add_bounds_pt -792.9 -798.2 11776.0
mp_guardian_add_bounds_pt -994.4 -688.6 11871.0
mp_guardian_add_bounds_pt -991.8 -616.1 11776.0
mp_guardian_add_bounds_pt -987.5 -525.2 11871.0
mp_guardian_add_bounds_pt -972.6 -518.5 11776.0
mp_guardian_add_bounds_pt -951.1 -518.0 11871.0
mp_guardian_add_bounds_pt -507.5 -518.0 11776.0
}}}}
}}


// map
===Spawn Points===
// de_dust 2 A site
With no adjustments, the players would spawn at the default [[info_player_counterterrorist|info_player_(counter)terrorist]] entities.
// dm_reset_spawns to reset spawn/bomb site


// the index of the bombsite that CTs will spawn at (the index is different per map)
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 {{ent|getpos_exact}}.
mp_guardian_target_site 0
{{pre|
mp_guardian_clear_all_player_spawns
mp_guardian_add_player_spawn_pt <x> <y> <z> <pitch> <yaw> <roll>


// what team will spawn randomly, 3 is team CT
mp_guardian_clear_all_enemy_spawns
mp_randomspawn 3
mp_guardian_add_enemy_spawn_pt <x> <y> <z> <pitch> <yaw> <roll>
mp_maxrounds 30
}}
mp_roundtime 30
bot_difficulty 1
bot_quota 7
mp_autoteambalance 0


// whether or not to use respawn waves
In Bomb Defusal, it is also possible to set {{ent|mp_randomspawn}} to 3. This convar determines which teams should spawn randomly (at {{ent|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 {{csgo mode|Gd}} it is special that they are only generated near the one {{ent|func_bomb_target}} that is specified by <tt>mp_guardian_target_site</tt>, if any. These spawns can be re-generated with {{ent|dm_reset_spawns}} and viewed with {{ent|map_showspawnpoints|<seconds>}} if the generation was successful.<br>
// 1 will have then spawn in rolling waves
Sadly this system cannot be used in Hostage Rescue, thus <tt>mp_randomspawn</tt> should be 0 and it is easier to set the spawn points with the above commands.
// 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 <code>mp_respawn_on_death_t 1</code> and <code>mp_guardian_target_site</code> by:
===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.
{|
{|
| <syntaxhighlight lang=cpp>
| <syntaxhighlight lang=cpp>
mp_respawn_on_death_ct 1
// Human players' objective
 
mp_guardian_special_kills_needed 10 // The number of special kills needed to win the game
mp_guardian_force_collect_hostages_timeout 1
mp_guardian_special_weapon_needed "awp" // The condition(s) that a kill must meet to increment the kills needed to complete the mission
mp_hostages_spawn_same_every_round 1
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_hostages_spawn_force_positions 0 // play around with the value
mp_guardian_loc_weapon "" // Override to weapon dialog var applied to UI
</syntaxhighlight>
</syntaxhighlight>
|}
|}


{{Tip|You can define custom spawnpoints for the human players using <code>mp_guardian_clear_all_player_spawns</code> and <code>mp_guardian_add_player_spawn_pt <x> <y> <z> <pitch> <yaw> <roll></code>. These six values can be obtained with {{ent|getpos}}.}}
{{mdCode|outline|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.
===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
{{mdCode|outline|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:
* teleport (e.g. closer to the interesting part of the map),
:{| class="wikitable mw-collapsible mw-collapsed" style=background:transparent
* 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
! Expression
! Meaning
! What kind of kills count?&nbsp;
|-
|-
| <code>""</code> or <code>any</code> or any invalid expression
| <code>""</code>
| Every kill
| Every kill. Does not work when changed to during a round.
|-
|-
| <code>awp</code>, <code>ak47</code>, etc.
| <code>awp</code>, <code>ak47</code>, ...
| Only kills with the specified weapon (omitting the <code>weapon_</code> prefix)
| Only kills with the specified weapon (omitting the <code>weapon_</code> prefix). Does not work when changed to during a round.
|-
|-
| <code>%weapon_awp%</code>, <code>%weapon_ak47%</code>, etc.
| <code>%weapon_awp%</code>, <code>%weapon_ak47%</code>, ...
| Only kills with the specified weapon (see [[List of Counter-Strike: Global Offensive Entities|List of CS:GO Entities]] for a list of weapons)
| Only kills with the specified weapon. See [[:Category:Counter-Strike: Global Offensive Weapons|Category:CS:GO Weapons]] for a list of weapons. Does not work with {{ent|weapon_fists}}, {{ent|weapon_shield}}.
|-
|-
| <code>%weapon_secondary%</code>
| <code>%weapon_secondary%</code>
| Only pistol kills
| Only pistol kills: [[weapon_glock|Glock-18]], [[weapon_hkp2000|P2000]], [[weapon_usp_silencer|USP-S]], [[weapon_elite|Dual Berettas]], [[weapon_p250|P250]], [[weapon_tec9|Tec-9]], [[weapon_cz75a|CZ75-Auto]], [[weapon_fiveseven|Fiveseven]], [[weapon_deagle|Desert Eagle]], [[weapon_revolver|R8 Revolver]].
|-
| <code>%weapon_smg%</code>
| Only SMG kills: [[weapon_mac10|MAC-10]], [[weapon_mp9|MP9]], [[weapon_mp7|MP7]], [[weapon_mp5sd|MP5-SD]], [[weapon_ump45|UMP-45]], [[weapon_p90|P90]], [[weapon_bizon|PP-Bizon]].
|-
| <code>%weapon_heavy%</code>
| Only heavy weapon kills: [[weapon_nova|Nova]], [[weapon_xm1014|XM1014]], [[weapon_sawedoff|Sawed-Off]], [[weapon_mag7|MAG-7]], [[weapon_m249|M249]], [[weapon_negev|Negev]].
|-
| <code>%weapon_rifle%</code>
| Only rifle kills: [[weapon_galilar|Galil AR]], [[weapon_famas|FAMAS]], [[weapon_ak47|AK-47]], [[weapon_m4a1|M4A4]], [[weapon_m4a1_silencer|M4A1-S]], [[weapon_ssg08|SSG 08]], [[weapon_sg556|SG 553]], [[weapon_aug|AUG]], [[weapon_awp|AWP]], [[weapon_g3sg1|G3SG1]], [[weapon_scar20|SCAR-20]].
|-
| <code>%weapon_grenade%</code>
| Only grenade kills, including grenade impact kills: [[weapon_molotov|Molotov]], [[weapon_incgrenade|Incendiary Grenade]], [[weapon_decoy|Decoy Grenade]], [[weapon_flashbang|Flashbang]], [[weapon_hegrenade|HE Grenade]], [[weapon_smokegrenade|Smoke Grenade]], [[weapon_tagrenade|Tactical Awareness Grenade]], [[weapon_snowball|Snowball]].
|-
| <code>%weapon_melee%</code>
| Only melee kills: [[weapon_knife|Knife]], [[weapon_axe|Axe]], [[weapon_hammer|Hammer]], [[weapon_spanner|Wrench]], {{ent|weapon_melee}}.
|-
|-
| <code>%weapon_knife%</code>
| <code>%weapon_knife%</code>
| Only knife kills
| Only knife kills.
|-
| <code>%cond_damage_burn%</code>
| Only kills caused by fire.
|-
| <code>%cond_damage_headshot%</code>
| Only kills caused by a headshot.
|-
|-
| <code>%weapon_grenade%</code>
| <code>%cond_damage_collateral%</code>
| Only grenade kills
| Only kills caused by a bullet that has already killed another enemy on its path.
|-
|-
| <code>%cond_match_ts_unique_weapon%</code>
| <code>%cond_match_ts_unique_weapon%</code>
| Only weapons that the human team has not done any kill with yet
| Only kills with weapons that the human team has not scored any kill with yet.
|-
| <code>%cond_player_airborne%</code><br><code>%cond_victim_airborne%</code>
| Only kills where the killer/victim is in midair.
|-
| <code>%cond_player_blind%</code><br><code>%cond_victim_blind%</code>
| Only kills where the killer/victim is (or has just been) under the flashbang effect.
|-
|-
| <code>%cond_player_zoomed%</code>
| <code>%cond_player_zoomed%</code>
| Only kills where the killer has scoped with a weapon
| Only kills where the killer has scoped with a weapon.
|-
|-
| <code>%cond_damage_headshot%</code>
| <code>%cond_victim_distance% <= 10</code>
| Only kills caused by a headshot
| Only kills where the victim is at most 10 meters away from the killer (distance from eye to eye?).
|-
{{note|
| <code>%cond_damage_burn%</code>
*Unlike the other expressions, <code>%cond_victim_distance%</code> returns a float and not just 0 or 1.
| Only kills caused by fire
*All of the operators <code>{{=}}{{=}}</code>, <code>!{{=}}</code>, <code>&lt;</code>, <code>&gt;</code>, <code>&lt;{{=}}</code>, <code>&gt;{{=}}</code> work, too.
}}
|-
|-
| <code>(%cond_victim_distance% <= 10)</code>
| <code>%''&lt;invalid_expression>''%</code>
| Only kills against players that are at most 10 meters away from the killer
| No kill.
|-
|-
| <code>!%[...]%</code>
| <code>'''!'''%...%</code>
| '''NOT''': A kill must '''NOT''' meet the condition to be counted.
| '''NOT''' operator: A kill must '''NOT''' meet the condition to be counted.
|-
|-
| <code>%[...]% <nowiki>||</nowiki> %[...]%</code>
| <code>%...% '''<nowiki>||</nowiki>''' %...%</code>
| '''OR''': A kill must meet '''ANY''' of these conditions to be counted.
| '''OR''' operator: A kill must meet '''ANY''' of these conditions to be counted.
|-
|-
| <code>%[...]% && %[...]%</code>
| <code>%...% '''&&''' %...%</code>
| '''AND''': A kill must meet '''ALL''' of these conditions to be counted.
| '''AND''' operator: A kill must meet '''ALL''' of these conditions to be counted.
|-
|-
| <code>( [...] )</code>
| <code>( ... )</code>
| Influences the order of evaluation of the previous three.
| Brackets can be used to group expressions and to influence the order of evaluation of the previous three operators. Note that due to operator precedence <tt><nowiki>!A && B || C</nowiki></tt> is equivalent to <tt><nowiki>((!A) && B) || C</nowiki></tt>.
|}
|}
{{Example|
{{mdCode|outline|mp_guardian_special_weapon_needed "%weapon_awp%"}} requires the human players to score kills with the AWP.<br>
{{mdCode|outline|mp_guardian_special_weapon_needed "%weapon_smg% && %cond_player_airborne%"}} requires the human players to score kills with any SMG while being in midair.<br>
{{mdCode|outline|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.<br>
{{mdCode|outline|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.
}}


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:
{{mdCode|outline|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 <code>csgo/resource/csgo_<language>.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"
:{| class="wikitable mw-collapsible mw-collapsed" style=background:transparent
! mp_guardian_loc_string_hud
! mp_guardian_loc_string_hud
! Displayed Text in English
! Displayed Text in English&nbsp;
|-
|-
| <code>""</code>
| <code>""</code>
Line 293: Line 307:
|}
|}


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:
{{mdCode|outline|mp_guardian_loc_weapon}} is what the expression <code>{s:weapon}</code> 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:
{| class="standard-table mw-collapsible mw-collapsed"
:{| class="wikitable mw-collapsible mw-collapsed" style=background:transparent
! mp_guardian_loc_weapon
! mp_guardian_loc_weapon
! Displayed Text in English
! Displayed Text in English&nbsp;
|-
|-
| <code>#quest_enemy_weapon</code>
| <code>#quest_enemy_weapon</code>
Line 341: Line 355:
|}
|}


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:
The following are examples from the existing files inside <code>csgo/maps/cfg/</code> to give you an idea of how these three commands can be used together:
{| class="standard-table mw-collapsible mw-collapsed"
:{| class="wikitable mw-collapsible mw-collapsed" style=background:transparent
! Filename
! Filename
! mp_guardian_special_weapon_needed
! mp_guardian_special_weapon_needed
! mp_guardian_loc_string_hud
! mp_guardian_loc_string_hud
! mp_guardian_loc_weapon
! mp_guardian_loc_weapon&nbsp;
|-
|-
| guardian_op09_card1
| guardian_op09_card1
Line 362: Line 376:
| ""
| ""
| "#quest_weapon_any_shotgun"
| "#quest_weapon_any_shotgun"
|-
| guardian_op09_card5
| "%weapon_p90% <nowiki>||</nowiki> %weapon_awp%"
| ""
| "#quest_weapon_awp_or_p90"
|-
|-
| guardian_op09_card7_1
| guardian_op09_card7_1
Line 429: Line 438:
|}
|}


===Boundary Settings===


<syntaxhighlight lang=cpp>
===Economy and Equipment===
// radius around the bombsite players can move, min is where warning starts, max is where damage occurs
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.
mp_guardian_player_dist_min 1000
{|
mp_guardian_player_dist_max 1200
| <syntaxhighlight lang=cpp>
// 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


//guardian bounds config
// default equipment
mp_guardian_clear_all_bounds
mp_free_armor 0
mp_guardian_new_bounds
mp_ct_default_primary ""
mp_guardian_add_bounds_pt 539.2 2774.0 -114.8
mp_ct_default_secondary "weapon_hkp2000"
mp_guardian_add_bounds_pt 1044.7 3070.0 349.3
mp_ct_default_melee "weapon_knife"
mp_guardian_add_bounds_pt 1572.0 3070.0 -114.8
mp_ct_default_grenades ""
[...]
mp_t_default_primary ""
mp_guardian_add_bounds_pt 527.0 2082.0 349.3
mp_t_default_secondary "weapon_glock"
mp_guardian_new_bounds
mp_t_default_melee "weapon_knife"
mp_guardian_add_bounds_pt 539.3 2058.0 95.4
mp_t_default_grenades ""
mp_guardian_add_bounds_pt 478.2 2042.0 367.8
sv_guardian_extra_equipment_ct "" // Extra starting equipment for CT players in guardian modes
mp_guardian_add_bounds_pt 458.2 2042.0 95.4
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)
mp_guardian_add_bounds_pt 548.0 2091.5 367.8
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.
</syntaxhighlight>
</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><br><code>sv_guardian_extra_equipment_t "parachute"</code> as seen in <code>csgo/maps/cfg/guardian_op11_blacksite_1.cfg</code>.}}
===Bots===
{|
| <syntaxhighlight lang=cpp>
// 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


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


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.
// bot weapons. if zero, bots may not use weapon type
* 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.
bot_allow_machine_guns 1 // If nonzero, bots may use SMGs.
** Use <code>mp_guardian_new_bounds</code> to start a new area.
bot_allow_pistols 1 // If nonzero, bots may use pistols.
*** 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.
bot_allow_rifles 1 // If nonzero, bots may use rifles.
*** Alternatively, use <code>mp_guardian_shoot_point</code> to add the point under your crosshair. A really helpful side effect of using this command is that all defined bounds will be shown in-game. When you're done, use <code>mp_guardian_emit_bounds_config</code> to print the points that you've shot in the console to copy-paste them to your config.
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.


==Automatic execution of Guardian Configs==
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
</syntaxhighlight>
|}
The AI for the bots can be set with {{ent|mp_bot_ai_bt}}.
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),
* throw grenades with exact lineups,
* rush to a specified coordiante.
* ...
{{note|All bots use the same AI script. This means they might try to escort hostages or to pick up the dropped bomb even though they are on the wrong team.}}


Using [[VScript]] it is possible to fire events depending on the game mode, 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 game mode is Guardian.


<syntaxhighlight lang=cpp>
==Automatic execution of Guardian Configs==
TYPE <- ScriptGetGameType()
{| style="float:right; margin:0"
MODE <- ScriptGetGameMode()
| <syntaxhighlight lang=cpp>
local TYPE = ScriptGetGameType()
local MODE = ScriptGetGameMode()
local ROUND = ScriptGetRoundsPlayed()


if (TYPE == 4 && MODE == 0) // Guardian uses game_type 4 and game_mode 0
if (TYPE == 4 && MODE == 0 && ROUND == 0) // Guardian uses game_type 4 and game_mode 0
{
{
// EITHER: execute a .cfg file, as long as this works.
SendToConsole(format("execwithwhitelist guardian_%s.cfg */maps", GetMapName()))
// SendToConsole(format("exec guardian/%s", GetMapName()))
SendToConsole("exec <filename>")
// OR to be safe: execute every single command:
SendToConsoleServer("...") // replace dots with a console command
SendToConsoleServer("...")
// ...
}
}


</syntaxhighlight>
</syntaxhighlight>
|}
Using [[VScript]] it is possible to fire events depending on the game mode, which is also used for {{csgo mode|Wingman}}.
The code on the right 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 Scripts|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 <tt>csgo/maps/cfg/</tt> that has the same name as the current map but with the prefix <code>guardian_</code>.
{{Confirm|The function <code>SendToConsole</code> might have the problem that it works only for local servers where a player is the host. The function <code>SendToConsoleServer</code> might not work because the command {{ent|exec}} and its variants are not [[whitelistcmd|whitelisted]] - however, executing every single command from the CFG should work, assuming those convars are whitelisted.}}


{{csgo-navbox}}
[[Category:Counter-Strike: Global Offensive]]
[[Category:Counter-Strike: Global Offensive]]
[[Category:Level Design]]
[[Category:Level Design]]
[[Category:Tutorials]]
[[Category:Tutorials]]

Latest revision as of 10:52, 2 September 2024

English (en)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.
Csgo icon guardian.png

Guardian (internally cooperative) is a game mode in Counter-Strike: Global Offensive 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 OpBloodhound.pngOperation 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 OpRiptide.pngOperation Riptide it is even possible to play custom Bomb Defusal scenarios on CS:GO Danger Zone Danger Zone maps, provided there is a proper Guardian Config being used.

Tip.pngTip:Valve has prepared a number of guardian configs for the official maps as a part of the Operations which can be found at 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:

  1. Invoke the commands game_type 4, game_mode 0 and map <mapname>, or all in one command: map <mapname> guardian (see CS:GO Game Modes).
  2. 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 simply csgo/cfg/) and write the commands. Execute it using execwithwhitelist <filename>.cfg */maps or exec <filename>.cfg */maps (or simply exec <filename>) and restart the game, e.g. using mp_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 or SendToConsoleServer 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.

Note.pngNote:Remember that by default, the game will always execute the CFG files 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.
Baseline for a Guardian Config

For Bomb Defusal, you typically want something like the following as a baseline.

// Respawning
mp_respawn_on_death_t	1	// In bomb defusal, terrorists should respawn
mp_respawn_on_death_ct	0	// Humans should not respawn by this rule. The game still handles human player respawns between waves
mp_use_respawn_waves	2	// 0: Rolling waves, like warmup respawns, 2: Spawn bots together when the whole bot team is dead
mp_maxrounds			30	// Give humans 15 tries. When humans win a round, the game ends
mp_roundtime			30	// Give humans 30 minutes per try...
mp_default_team_winner_no_objective 2	// ... and make them lose if the time is up (-1: map default, 0: draw, 2: Ts win, 3: CTs win)

// Bots
bot_quota		5
bot_quota_mode	normal	// Exactly 5 bots

// Spawn points
mp_guardian_target_site 0 // Target bomb site index (-1: none), play around with this value
mp_randomspawn			3 // Respawn team 3 (human CTs) at target bomb site. Custom spawn points (mp_guardian_add_player_spawn_pt) have priority

// Boundaries
mp_guardian_player_dist_min	1000	// Distance from target bomb site center (or hostage) until screen fades gray. The warning sound is played at a distance of about min+(max-min)/4.
mp_guardian_player_dist_max	1200	// Distance from target bomb site center (or hostage) until damage occurs

// Human players' objective
mp_guardian_special_kills_needed	10		// The number of kills needed with a specific weapon.
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

// Buying anywhere
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)

For Hostage Rescue, this requires just a little edit and some different commands:

// Respawning
mp_respawn_on_death_t	0	// Humans are T here, so don't respawn them...
mp_respawn_on_death_ct	1	// ...but do respawn the bots on CT
mp_default_team_winner_no_objective	3	// The humans should lose on timeout (-1: map default, 0: draw, 2: Ts, 3: CTs)

// Spawn points
mp_guardian_target_site -1	// There is no bomb site that the game could generate random spawns at
mp_randomspawn			0	// Turn mp_randomspawn off instead, otherwise we get random spawns across the map

// Hostage Rescue
mp_guardian_force_collect_hostages_timeout	0	// Force bots to go rescue a hostage after not seeing an enemy for this amount of seconds
mp_hostages_spawn_same_every_round			1	// Hostages should not change their location between rounds (which they don't anyway)

Boundaries

After invoking mp_guardian_shoot_point, the game will visualize the existing boundaries. Green with a black grid means that the local player is inside a prism's volume.
Red with no grid means that the local player is outside a prism's volume.

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 CS:GO Danger Zone 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.
Creating Custom Boundaries

For the bounds of bomb targets, replace mp_guardian_ with mp_guardian_bomb_plant_ in each of the following commands, except for mp_guardian_shoot_point.

  1. Start by invoking mp_guardian_clear_all_bounds to wipe everything that has been added so far.
  2. To add a new prism, invoke mp_guardian_new_bounds. This might also finish the previous prism.
  3. To add a point to the prism, aim at that position and invoke mp_guardian_shoot_point. To save a lot of time, bind this command to a mouse button (mouse1). Alternatively you can also add a point by its coordinates using mp_guardian_add_bounds_pt <x> <y> <z>.
    Note.pngNote:The prism will always stay convex; This means that when adding a point, the volume can only become larger and never smaller. Shooting a point inside the current volume has no effect. To get a playable area that is concave, create multiple prisms by going back to step 2.
  4. When you're finished, invoke mp_guardian_emit_bounds_config and copy the text in the console to your Guardian Config - that's it.
    How?: How to turn the volume visualization back off?
PlacementTip.pngExample:
//guardian bounds config
mp_guardian_clear_all_bounds
mp_guardian_new_bounds
mp_guardian_add_bounds_pt -53.0 -70.6 11774.0
mp_guardian_add_bounds_pt -21.0 -837.4 12026.4
mp_guardian_add_bounds_pt -21.0 -872.3 11774.0
mp_guardian_add_bounds_pt -21.0 -966.0 12026.4
mp_guardian_add_bounds_pt -23.0 -1370.0 11774.0
mp_guardian_add_bounds_pt -78.0 -1454.7 12026.4
mp_guardian_add_bounds_pt -98.0 -1454.7 11774.0
mp_guardian_add_bounds_pt -172.4 -1449.4 12026.4
mp_guardian_add_bounds_pt -220.3 -443.2 11774.0
mp_guardian_add_bounds_pt -219.0 -358.5 12026.4
mp_guardian_add_bounds_pt -218.6 -340.0 11774.0
mp_guardian_add_bounds_pt -209.1 -70.0 12026.4
mp_guardian_add_bounds_pt -77.0 -54.1 11774.0
mp_guardian_new_bounds
mp_guardian_add_bounds_pt -292.4 -69.0 11774.0
mp_guardian_add_bounds_pt -218.5 -70.6 12001.4
mp_guardian_add_bounds_pt -208.0 -83.2 11774.0
mp_guardian_add_bounds_pt -188.0 -921.2 12001.4
mp_guardian_add_bounds_pt -188.0 -941.2 11774.0
mp_guardian_add_bounds_pt -218.2 -954.5 12001.4
mp_guardian_add_bounds_pt -235.9 -956.9 11774.0
mp_guardian_add_bounds_pt -386.3 -963.4 12001.4
mp_guardian_add_bounds_pt -422.8 -959.2 11774.0
mp_guardian_add_bounds_pt -428.0 -943.4 12001.4
mp_guardian_add_bounds_pt -577.0 -309.0 11774.0
mp_guardian_add_bounds_pt -582.5 -135.0 12001.4
mp_guardian_new_bounds
mp_guardian_add_bounds_pt -467.1 -741.5 11776.0
mp_guardian_add_bounds_pt -467.1 -761.5 11871.0
mp_guardian_add_bounds_pt -654.9 -799.0 11776.0
mp_guardian_add_bounds_pt -776.9 -799.0 11871.0
mp_guardian_add_bounds_pt -792.9 -798.2 11776.0
mp_guardian_add_bounds_pt -994.4 -688.6 11871.0
mp_guardian_add_bounds_pt -991.8 -616.1 11776.0
mp_guardian_add_bounds_pt -987.5 -525.2 11871.0
mp_guardian_add_bounds_pt -972.6 -518.5 11776.0
mp_guardian_add_bounds_pt -951.1 -518.0 11871.0
mp_guardian_add_bounds_pt -507.5 -518.0 11776.0

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 CS:GO Guardian 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 What kind of kills count? 
"" Every kill. Does not work when changed to during a round.
awp, ak47, ... Only kills with the specified weapon (omitting the weapon_ prefix). Does not work when changed to during a round.
%weapon_awp%, %weapon_ak47%, ... Only kills with the specified weapon. See Category:CS:GO Weapons for a list of weapons. Does not work with weapon_fists, weapon_shield.
%weapon_secondary% Only pistol kills: Glock-18, P2000, USP-S, Dual Berettas, P250, Tec-9, CZ75-Auto, Fiveseven, Desert Eagle, R8 Revolver.
%weapon_smg% Only SMG kills: MAC-10, MP9, MP7, MP5-SD, UMP-45, P90, PP-Bizon.
%weapon_heavy% Only heavy weapon kills: Nova, XM1014, Sawed-Off, MAG-7, M249, Negev.
%weapon_rifle% Only rifle kills: Galil AR, FAMAS, AK-47, M4A4, M4A1-S, SSG 08, SG 553, AUG, AWP, G3SG1, SCAR-20.
%weapon_grenade% Only grenade kills, including grenade impact kills: Molotov, Incendiary Grenade, Decoy Grenade, Flashbang, HE Grenade, Smoke Grenade, Tactical Awareness Grenade, Snowball.
%weapon_melee% Only melee kills: Knife, Axe, Hammer, Wrench, weapon_melee.
%weapon_knife% Only knife kills.
%cond_damage_burn% Only kills caused by fire.
%cond_damage_headshot% Only kills caused by a headshot.
%cond_damage_collateral% Only kills caused by a bullet that has already killed another enemy on its path.
%cond_match_ts_unique_weapon% Only kills with weapons that the human team has not scored any kill with yet.
%cond_player_airborne%
%cond_victim_airborne%
Only kills where the killer/victim is in midair.
%cond_player_blind%
%cond_victim_blind%
Only kills where the killer/victim is (or has just been) under the flashbang effect.
%cond_player_zoomed% Only kills where the killer has scoped with a weapon.
%cond_victim_distance% <= 10 Only kills where the victim is at most 10 meters away from the killer (distance from eye to eye?).
Note.pngNote:
  • Unlike the other expressions, %cond_victim_distance% returns a float and not just 0 or 1.
  • All of the operators ==, !=, <, >, <=, >= work, too.
%<invalid_expression>% No kill.
!%...% NOT operator: A kill must NOT meet the condition to be counted.
%...% || %...% OR operator: A kill must meet ANY of these conditions to be counted.
%...% && %...% AND operator: A kill must meet ALL of these conditions to be counted.
( ... ) Brackets can be used to group expressions and to influence the order of evaluation of the previous three operators. Note that due to operator precedence !A && B || C is equivalent to ((!A) && B) || C.
PlacementTip.pngExample:

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

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 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 you an idea 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_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"


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.
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
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.
  • ...
Note.pngNote:All bots use the same AI script. This means they might try to escort hostages or to pick up the dropped bomb even though they are on the wrong team.


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 CS:GO/CS2 Wingman 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_.

Confirm:The function 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.