Func buyzone: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(updates)
(Corrected TeamNums, added SetTeam input, tested that touch-specific I/O doesn't work properly, found mistake in csgo.fgd (SetEnabled -> Enable).)
Line 1: Line 1:
{{lang|Func buyzone}}
{{lang|Func buyzone}}
{{base brush multi|func_buyzone|game1=Counter-Strike: Source|game2=Counter-Strike: Global Offensive}} It is used to define the "Buy Zones" used by players to purchase weapons and equipment.
[[Image:Csgobuyzones.jpg|thumb|500px|Buyzones usually touch all player spawns of an entire team.]]
{{base brush multi|func_buyzone|game1=Counter-Strike: Source|game2=Counter-Strike: Global Offensive}}


{{code class|CBuyZone|func_buy_zone.cpp}}
{{code class|CBuyZone|func_buy_zone.cpp}}
==Entity Description==
It is used to define areas where [[player]]s of different teams can open the buy menu to purchase weapons and equipment.
If a [[player]] touches the volume of this entity and his team equals the team of this entity, then he is allowed to buy. {{csgo}} If this entity has the team 0 or -1, then any or no player can buy inside this entity's volume, respectively.
{{Tip | The <code>SetTeam</code> input can be used to change the buying team in-game.}}
{{Note | Setting this entity's team to -1 and <code>Disable</code>ing it have the same effect, just that these are independent operations.}}
{{Bug | The "touch-specific" [[I/O]] of this entity (<code>OnStartTouch</code>, <code>OnTouching</code>, ...) does not work properly, the buyzone's volume seems not to be considered. Make a different entity to use these.}}
{{Bug | {{csgo}} By default, this entity has the inputs <code>SetEnabled/SetDisabled</code> in [[Hammer]], but it actually doesn't; Using these has no effect! Use <code>Enable/Disable/Toggle</code>. This can be fixed by editing in {{ent|csgo.fgd}}, searching for <code>func_buyzone</code>. (That's 8 characters to delete.)}}


==Keyvalues==
==Keyvalues==
{{KV|Team number (int) (TeamNum)|int|The team that can use the buyzone.}}
{{KV|Team number (int)|int|intn=TeamNum|The team that can use the buyzone.}}
:{| class=standard-table
:{| class="wikitable"
!| Value || Description
| -1 || {{csgo}} No one
|-
| -1 || None{{csgo}}
|-
|-
| 0 || None{{css}} All Teams{{csgo}}
| 0 || {{csgo}} Everyone
|-
|-
| 1 || All Teams{{css}} Unassigned?{{csgo}}
| 2 || Terrorists
|-
|-
| 2 || Terrorist
| 3 || Counter-Terrorists
|-
|-
| 3 || Counter-Terrorist
| ''other'' || No one
|}
|}
{{Note | This keyvalue is only used when this entity is spawned, so changing it with {{ent|AddOutput}} has no effect. {{csgo}} The actual keyvalue that determines the buy team is <code>teamnumber</code>.}}
{{KV BaseTrigger}}
{{KV BaseTrigger}}
{{KV BaseEntity|brush=1}}
{{KV BaseEntity|brush=1}}


==Inputs==
==Inputs==
{{IO|SetTeam_TerroristOnly|since=CSGO|Restrict buyzone to terrorists only.}}
{{IO|SetTeam|param=int|Sets the team of this entity, which also sets the team that is allowed to buy.}}
{{IO|SetTeam_CTOnly|since=CSGO|Restrict buyzone to counter-terrorists only.}}
{{IO|SetTeam_TerroristOnly|only=CSGO|Restrict buyzone to Terrorists only. Equivalent to <code>SetTeam 2</code>.}}
{{IO|SetTeam_AllTeams|since=CSGO|Allows all teams to use the buyzone.}}
{{IO|SetTeam_CTOnly|only=CSGO|Restrict buyzone to Counter-Terrorists only. Equivalent to <code>SetTeam 3</code>.}}
{{IO|SetTeam_None|since=CSGO|Allows no team to use the buyzone, effectively disabling it. {{todo|Does this actually behave different from <code>Disable</code> in any way?}}}}
{{IO|SetTeam_AllTeams|only=CSGO|Allows all teams to use the buyzone. Equivalent to <code>SetTeam 0</code>.}}
{{IO|SetTeam_None|only=CSGO|Allows no team to use the buyzone, effectively disabling it. Equivalent to <code>SetTeam -1</code>.}}
{{I BaseTrigger|notf2=1}}
{{I BaseTrigger|notf2=1}}
{{I BaseEntity}}
{{I BaseEntity}}

Revision as of 15:57, 27 August 2021

English (en)Translate (Translate)
Buyzones usually touch all player spawns of an entire team.

Template:Base brush multi

C++ In code, it is represented by theCBuyZoneclass, defined in thefunc_buy_zone.cppfile.

Entity Description

It is used to define areas where players of different teams can open the buy menu to purchase weapons and equipment.

If a player touches the volume of this entity and his team equals the team of this entity, then he is allowed to buy. Counter-Strike: Global Offensive If this entity has the team 0 or -1, then any or no player can buy inside this entity's volume, respectively.

Tip.pngTip: The SetTeam input can be used to change the buying team in-game.
Note.pngNote: Setting this entity's team to -1 and Disableing it have the same effect, just that these are independent operations.
Icon-Bug.pngBug: The "touch-specific" I/O of this entity (OnStartTouch, OnTouching, ...) does not work properly, the buyzone's volume seems not to be considered. Make a different entity to use these.  [todo tested in ?]
Icon-Bug.pngBug: Counter-Strike: Global Offensive By default, this entity has the inputs SetEnabled/SetDisabled in Hammer, but it actually doesn't; Using these has no effect! Use Enable/Disable/Toggle. This can be fixed by editing in csgo.fgd, searching for func_buyzone. (That's 8 characters to delete.)  [todo tested in ?]

Keyvalues

Team number (int) (TeamNum) <integer>
The team that can use the buyzone.
-1 Counter-Strike: Global Offensive No one
0 Counter-Strike: Global Offensive Everyone
2 Terrorists
3 Counter-Terrorists
other No one
Note.pngNote: This keyvalue is only used when this entity is spawned, so changing it with AddOutput has no effect. Counter-Strike: Global Offensive The actual keyvalue that determines the buy team is teamnumber.
BaseTrigger
Filter Name (filtername) <filter>
A filter entity to test potential activators against.
Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).


Inputs

SetTeam <integerRedirectInput/integer>
Sets the team of this entity, which also sets the team that is allowed to buy.
SetTeam_TerroristOnly  (only in Counter-Strike: Global Offensive)
Restrict buyzone to Terrorists only. Equivalent to SetTeam 2.
SetTeam_CTOnly  (only in Counter-Strike: Global Offensive)
Restrict buyzone to Counter-Terrorists only. Equivalent to SetTeam 3.
SetTeam_AllTeams  (only in Counter-Strike: Global Offensive)
Allows all teams to use the buyzone. Equivalent to SetTeam 0.
SetTeam_None  (only in Counter-Strike: Global Offensive)
Allows no team to use the buyzone, effectively disabling it. Equivalent to SetTeam -1.
BaseTrigger
Toggle
Toggles this trigger between enabled and disabled states.
Enable
Enable trigger
Disable
Disable trigger
TouchTest  (in all games since Source 2007)
Triggers either the OnTouching or OnNotTouching outputs for whether anything is touching this entity.
Icon-Bug.pngBug:Sleeping prop_physics will never fire "OnTouching". Also applies to entities using prop_physics as base.  (tested in: Half-Life 2)
StartTouch  (in all games since Source 2007) !FGD
Behave as if the !caller entity had just entered the trigger volume. Accepts non-physical entities.
EndTouch  (in all games since Source 2007) !FGD
Behave as if !caller had just exited the trigger volume.
DisableAndEndTouch  (only in Source 2013 MultiplayerTeam Fortress 2 branch)
Disables this trigger and calls EndTouch on all currently-touching entities.


Outputs

BaseTrigger
OnStartTouch
!activator = entity that caused this output
!caller = this entity
Fired when a valid entity starts touching this trigger.
OnStartTouchAll
!activator = entity that caused this output
!caller = this entity
Fired when a valid entity starts touching this trigger, and no other entities are touching it. If there are any other entities touching the trigger when a new one begins to touch, only OnStartTouch will fire.
OnEndTouch
!activator = entity that caused this output
!caller = this entity
Fired when a valid entity stops touching this trigger.
Note.pngNote:Will also fire for entities touching it when trigger is disabled via Disable input
Warning.pngWarning:This includes entities which are deleted while inside the trigger. In this case !activator will be invalid.
Warning.pngWarning:OnEndTouch can fire before OnStartTouch under certain circumstances[How?] where both are fired on the same tick and each have the same delay.
Note.pngFix:Add a slight delay to OnEndTouch.
OnEndTouchAll
!activator = entity that caused this output
!caller = this entity
Fired when all valid entities stop touching this trigger.
OnTouching  (in all games since Source 2007)
!activator = !caller = this entity
Fired if something is currently touching this trigger when TouchTest is fired.
OnNotTouching  (in all games since Source 2007)
!activator = !caller = this entity
Fired if nothing is currently touching this trigger when TouchTest is fired.