Setting up 1v1 Warmup Arenas

From Valve Developer Community
Revision as of 08:03, 1 May 2021 by Popcorn (talk | contribs) (Created page with "{| style="float:right;" | {| class="standard-table" style="float:right;" |+ Official Maps with 1v1 Warmup Arenas ! Map Name ! BSP name |- | Dust II || de_dust2 |- | Infern...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Official Maps with 1v1 Warmup Arenas
Map Name BSP name
Dust II de_dust2
Inferno de_inferno
Mirage de_mirage
Nuke de_nuke
Overpass de_overpass
Shortnuke de_shortnuke
Train de_train
Vertigo de_vertigo
Pick/Ban lobby
(Broken Fang Premier Mode)
lobby_mapveto
1v1 Weapons
AK-47
Galil AR
FAMAS
AWP
M4A4
M4A1-S
Desert Eagle
USP-S
Glock-18

This is the documentation of a way to use the VScripts

  • csgo/scripts/vscripts/warmup/warmup_arena.nut
  • csgo/scripts/vscripts/warmup/warmup_teleport.nut

that are designed for the management of 1v1 warmup arenas in Counter-Strike: Global Offensive Counter-Strike: Global Offensive .

The information of this page has been collected heuristically. Valve might have used a (slightly) different implementation.

Gameplay Description

Officially, the 1v1 warmup plays as follows:

  • It is only active during warmup of the game modes Competitive and Wingman, i.e. if game_type is 0 and game_mode is 1 or 2.
  • During warmup, respawning players are teleported to a separate room ("1v1 arena") with one enemy player (if there is one), emitting the player spawn sound used in Deathmatch.
  • Both players are get 100 HP, kevlar (no helmet), their knife and a randomly chosen weapon from a hard-coded list inside warmup_arena.nut.
  • If there is only one player in an arena, he will be reset in this arena if a respawning enemy player is teleported there.
  • Dropped weapons are cleared in an arena if two players spawn.
  • In Competitive, 5 arenas are used. In Wingman, only 2 arenas are regarded.

Map Requirements

This section covers the requirements to a map to additionally support 1v1 warmup arenas.

Overview

This is how the following implementation will work:

  • During warmup, the players actually spawn at their default spawns on the regular part of the map, but all of the spawn points are inside a big trigger_multiple that teleports them into an arena with a free slot.
  • The VScript warmup/warmup_teleport.nut handles the assignment of players to the arenas.
  • Each of the 5 arenas has a logic_script with the VScript warmup/warmup_arena.nut keeping track of its current players.
  • In each arena there are two trigger_multiples inside each other with different team filters filling the entire arena. These are always testing if a (Counter-)Terrorist is in the arena and locks or unlocks the arena for other players.


Required Entities - General

Class Where? Name KeyValues Outputs Comment
trigger_multiple so that all Competitive and Wingman CT spawns are inside it not needed
Property Name Value
Entity Scripts warmup/warmup_teleport.nut
Start Disabled Yes
Filter Name @warmup.filter_ct
Delay Before Reset 0
My Output > Target Entity Target Input Parameter Delay Only Once
Io11.png OnTrigger !self RunScriptCode PlayerSpawnedCT() 0.00 No
Tip.pngTip: One can create two unique trigger brushes for Competitive and Wingman spawns of a team, select both and hit Ctrl+T to tie them to a single trigger_multiple.
trigger_multiple so that all Competitive and Wingman T spawns are inside it not needed
Property Name Value
Entity Scripts warmup/warmup_teleport.nut
Start Disabled Yes
Filter Name @warmup.filter_t
Delay Before Reset 0
My Output > Target Entity Target Input Parameter Delay Only Once
Io11.png OnTrigger !self RunScriptCode PlayerSpawnedT() 0.00 No
filter_activator_team anywhere @warmup.filter_ct
Property Name Value
Filter Team Number Counter-Terrorist
The previous triggers rely on these, because the scripts must be able to differentiate between Terrorists and Counter-Terrorists.
filter_activator_team anywhere @warmup.filter_t
Property Name Value
Filter Team Number Terrorist
game_player_equip anywhere @warmup.weapon_equip_empty
Property Name Value
Spawnflags 3 (Flags Use only and
Strip All Weapons First)
This is used to clear the weapons of (re-)spawning players before they are equipped by an arena script.

Required Entities - Arenas

To avoid VScript errors and/or lonely players, there should be at least 5 arenas, which is also the maximum of arenas that the scripts support.

PlacementTip.gifPlacement Tip: An arena should be completely separated from the rest of the map, although it needn't.
PlacementTip.gifPlacement Tip: Create cover so that there is no direct line of sight between the two players' spawn points.
Note.pngNote: The arena script cleans up weapons lying around within a radius of 640 units from it. Don't make the playable area too big.


For the player spawning logic, you need the following entities for each arena. The entity names must be exact as the scripts rely on them.

If you are done creating one arena and you want to copy-paste it, you have to make renaming changes to these entities, which is the adjustment of the yellow highlighted 1's. Replace them by 2, 3, 4 and 5 accordingly.

Class Where? Name KeyValues Outputs Comment
info_target place as CT spawn point, including orientation arena1-ctspawn The scripts will only call GetOrigin() and GetAngles() from these entities to teleport players to them, so one could use any entity for this if it has a name, an origin and an orientation, e.g. Player spawn entities, but these must be disabled by default, because players should never actually spawn there, especially if it's not warmup. VScript does not take the enabled state into account. Still, do not use info_deathmatch_spawns as it happens that the game uses these even if they are disabled.
info_target place as T spawn point, including orientation arena1-tspawn
logic_script in the middle of the arena on the ground arena1-script
Property Name Value
Entity Scripts warmup/warmup_arena.nut
Think Function ArenaStart
EntityGroup[0] arena1-trigger_ct
EntityGroup[1] arena1-trigger_t
This entity should be placed in the center of the arena on the ground due to the weapon clearing radius of 640 units around it.
Tip.pngTip: Visualize the radius e.g. by temporary creating an entity with a radius such as ambient_generic.
The Think function fires the input TouchTest to the following two triggers every 0.1 seconds.
trigger_multiple fills the entire playable area of the arena arena1-trigger_ct
Property Name Value
Filter Name @warmup.filter_ct
My Output > Target Entity Target Input Parameter Delay Only Once
Io11.png OnNotTouching arena1-script RunScriptCode EnableCTSpawn() 0.00 No
Io11.png OnTrigger arena1-script RunScriptCode DisableCTSpawn() 0.00 No
Tip.pngTip: As these are two brushes with identical dimensions, use H and U in Hammer to hide and unhide one of them, to make selecting the other easier.
The functions DisableCTSpawn() and DisableTSpawn() save the activator assuming it is a player, so the trigger's output must be OnTrigger, because OnTouching uses the trigger as activator, causing VScript errors.
trigger_multiple fills the entire playable area of the arena arena1-trigger_t
Property Name Value
Filter Name @warmup.filter_t
My Output > Target Entity Target Input Parameter Delay Only Once
Io11.png OnNotTouching arena1-script RunScriptCode EnableTSpawn() 0.00 No
Io11.png OnTrigger arena1-script RunScriptCode DisableTSpawn() 0.00 No

Testing and Debugging

] ent_fire logic_script runscriptcode "DebugInfo()"
===arena1 debug info: ===
Available T spawn = false
Available CT spawn = false
Current T player = ([9] player)
Current CT player = ([6] player)
===arena1 end debug info ===
===arena2 debug info: ===
Available T spawn = false
Available CT spawn = true
Current T player = ([5] player)
Current CT player = (null : 0x00000000)
===arena2 end debug info ===
===arena3 debug info: ===
Available T spawn = false
Available CT spawn = false
Current T player = ([2] player)
Current CT player = ([3] player)
===arena3 end debug info ===
===arena4 debug info: ===
Available T spawn = false
Available CT spawn = false
Current T player = ([4] player)
Current CT player = ([1] player)
===arena4 end debug info ===
===arena5 debug info: ===
Available T spawn = true
Available CT spawn = false
Current T player = (null : 0x00000000)
Current CT player = ([7] player)
===arena5 end debug info ===

To see if everything works correctly, you can open in the console and

  • look for VScript errors.
  • invoke sv_cheats 1 and ent_messages_draw 1 to visualize I/O.
  • invoke sv_cheats 1 and ent_fire logic_script runscriptcode "DebugInfo()" to see the states of each arena.
    • The Available T/CT spawn should be true if there is a T/CT in the arena (no matter why).
    • The Current T/CT player should either be null if the corresponding spawn is available or a player if not.

Manipulating Gameplay

You cannot or should not manipulate the orignal scripts

  • csgo/scripts/vscripts/warmup/warmup_arena.nut
  • csgo/scripts/vscripts/warmup/warmup_teleport.nut,

but you can still change gameplay per map by either firing RunScriptCode to the arena scripts or by writing an own script to change variables or even functions in the arena scripts.

For example, you could create a logic_script in your map and set its Entity Scripts to a .nut file with this content to change the weapons.

ARENA1_SCRIPT <- Entities.FindByName(null, "arena1-script");
ARENA2_SCRIPT <- Entities.FindByName(null, "arena2-script");
ARENA3_SCRIPT <- Entities.FindByName(null, "arena3-script");
ARENA4_SCRIPT <- Entities.FindByName(null, "arena4-script");
ARENA5_SCRIPT <- Entities.FindByName(null, "arena5-script");

NEW_WEAPON <- ["weapon_ssg08", "weapon_p250", "weapon_mp5sd", "weapon_nova", "weapon_negev"]

function OnPostSpawn()
{
	ARENA1_SCRIPT.GetScriptScope().WEAPON = NEW_WEAPON
	ARENA2_SCRIPT.GetScriptScope().WEAPON = NEW_WEAPON
	ARENA3_SCRIPT.GetScriptScope().WEAPON = NEW_WEAPON
	ARENA4_SCRIPT.GetScriptScope().WEAPON = NEW_WEAPON
	ARENA5_SCRIPT.GetScriptScope().WEAPON = NEW_WEAPON
}