Func buyzone: Difference between revisions
Jump to navigation
Jump to search

Note:This entity's trigger functionalities are !FGD but can be used, such as the StartDisabled keyvalue and the Enable/Disable/Toggle inputs. To use this entity's inherited trigger I/O (OnStartTouch, ...), set its spawnflags keyvalue appropriately (default is 4097). To add all of this in Hammer, see below.
Bug:
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 instead. This can be fixed by editing csgo.fgd, searching for func_buyzone and replacing the incorrect input names. (The FGD code below fixes this differently.) [todo tested in ?]
Tip:The
Note:Setting this entity's team to -1 and
Note: This keyvalue is only used when this entity is spawned, so changing it with AddOutput has no effect.
The actual keyvalue that determines the buy team is
(Corrected TeamNums, added SetTeam input, tested that touch-specific I/O doesn't work properly, found mistake in csgo.fgd (SetEnabled -> Enable).) |
(Added FGD code to use Trigger functionality.) |
||
Line 3: | Line 3: | ||
{{base brush multi|func_buyzone|game1=Counter-Strike: Source|game2=Counter-Strike: Global Offensive}} | {{base brush multi|func_buyzone|game1=Counter-Strike: Source|game2=Counter-Strike: Global Offensive}} | ||
{{Note|This entity's trigger functionalities are {{not in FGD}} but can be used, such as the <tt>StartDisabled</tt> keyvalue and the <tt>Enable/Disable/Toggle</tt> inputs. To use this entity's inherited trigger I/O (<tt>OnStartTouch</tt>, ...), set its <tt>spawnflags</tt> keyvalue appropriately (default is 4097). To add all of this in [[Hammer]], see [[#FGD Code|below]].}} | |||
{{Bug|{{csgo}} By default, this entity has the inputs <tt>SetEnabled/SetDisabled</tt> in [[Hammer]], but it actually doesn't; Using these has no effect! Use <tt>Enable/Disable/Toggle</tt> instead. This can be fixed by editing {{ent|csgo.fgd}}, searching for <tt>func_buyzone</tt> and replacing the incorrect input names. (The FGD code [[#FGD Code|below]] fixes this differently.)}} | |||
{{code class|CBuyZone|func_buy_zone.cpp}} | {{code class|CBuyZone|func_buy_zone.cpp}} | ||
Line 10: | Line 12: | ||
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. | 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.}} | {{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. | {{Note|Setting this entity's team to -1 and <code>Disable</code>ing it have the same effect, just that these are independent operations.}} | ||
==Keyvalues== | ==Keyvalues== | ||
Line 44: | Line 44: | ||
{{O BaseTrigger}} | {{O BaseTrigger}} | ||
{{O BaseEntity}} | {{O BaseEntity}} | ||
==[[FGD]] Code== | |||
This code... | |||
*replaces its base class with Trigger which effectively adds trigger properties such as the keyvalue <tt>StartDisabled</tt>, the inputs and outputs <tt>Enable/Disable/Toggle/OnStartTouch/...</tt> and the trigger flags (1: Clients, ...). | |||
*adds the input <tt>TouchTest</tt> and the outputs <tt>OnTouching/OnNotTouching</tt> as seen in {{ent|trigger_multiple}} of {{ent|base.fgd}}. | |||
*removes the invalid inputs <tt>SetEnabled, SetDisabled</tt>. | |||
Replace the corresponding lines of {{ent|cstrike.fgd}} or {{ent|csgo.fgd}} near <tt>func_buyzone</tt> with this. | |||
{{note|{{css}} The inputs <tt>SetTeam_[...]</tt> don't exist, so make sure not to add those four lines.}} | |||
<syntaxhighlight lang=php highlight=1,7-9,16-17> | |||
@SolidClass base(Trigger, TeamNum) = func_buyzone: // "Targetname" -> "Trigger" | |||
"Buy Zone. Players can buy equipment while standing in this zone, if the zone matches their current team.\n\n" + | |||
"A single Buy Zone entity must be either terrorist or counter-terrorist, it cannot be both. Should have " + | |||
"the toolstrigger material applied to all sides" | |||
[ | |||
// input SetEnabled(void) : "Sets this buyzone as enabled." | |||
// input SetDisabled(void) : "Sets this buyzone as disabled." | |||
input TouchTest(void) : "Tests if the trigger is being touched and fires an output based on whether the value is true or false." | |||
input SetTeam_TerroristOnly(void) : "Make it so only terrorist can buy from this buyzone." | |||
input SetTeam_CTOnly(void) : "Make it so only CT's can buy from this buyzone." | |||
input SetTeam_AllTeams(void) : "Make it so all teams can buy from this buyzone." | |||
input SetTeam_None(void) : "Make it so no teams can buy from this buyzone (this essentially disables the buyzone)." | |||
output OnTouching(void) : "Fired when the TestTouch input is true (something is touching the trigger.)" | |||
output OnNotTouching(void) : "Fired when the TestTouch input is not true (nothing is touching the trigger.)" | |||
] | |||
</syntaxhighlight> |
Revision as of 20:17, 26 September 2022





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. If this entity has the team 0 or -1, then any or no player can buy inside this entity's volume, respectively.

SetTeam
input can be used to change the buying team in-game.
Disable
ing it have the same effect, just that these are independent operations.Keyvalues
- Team number (int) (TeamNum) <integer>
- The team that can use the buyzone.


teamnumber
.
|
Inputs
- SetTeam <integer >
- Sets the team of this entity, which also sets the team that is allowed to buy.
- SetTeam_None (only in
)
- Allows no team to use the buyzone, effectively disabling it. Equivalent to
SetTeam -1
.
|
Outputs
|
FGD Code
This code...
- replaces its base class with Trigger which effectively adds trigger properties such as the keyvalue StartDisabled, the inputs and outputs Enable/Disable/Toggle/OnStartTouch/... and the trigger flags (1: Clients, ...).
- adds the input TouchTest and the outputs OnTouching/OnNotTouching as seen in trigger_multiple of base.fgd.
- removes the invalid inputs SetEnabled, SetDisabled.
Replace the corresponding lines of cstrike.fgd or csgo.fgd near func_buyzone with this.
@SolidClass base(Trigger, TeamNum) = func_buyzone: // "Targetname" -> "Trigger"
"Buy Zone. Players can buy equipment while standing in this zone, if the zone matches their current team.\n\n" +
"A single Buy Zone entity must be either terrorist or counter-terrorist, it cannot be both. Should have " +
"the toolstrigger material applied to all sides"
[
// input SetEnabled(void) : "Sets this buyzone as enabled."
// input SetDisabled(void) : "Sets this buyzone as disabled."
input TouchTest(void) : "Tests if the trigger is being touched and fires an output based on whether the value is true or false."
input SetTeam_TerroristOnly(void) : "Make it so only terrorist can buy from this buyzone."
input SetTeam_CTOnly(void) : "Make it so only CT's can buy from this buyzone."
input SetTeam_AllTeams(void) : "Make it so all teams can buy from this buyzone."
input SetTeam_None(void) : "Make it so no teams can buy from this buyzone (this essentially disables the buyzone)."
output OnTouching(void) : "Fired when the TestTouch input is true (something is touching the trigger.)"
output OnNotTouching(void) : "Fired when the TestTouch input is not true (nothing is touching the trigger.)"
]