Trigger brush: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(removed {{DISPLAYTITLE}}, covered by the base point template)
(Overhauled the entire page)
Line 1: Line 1:
{{ent not in fgd}}
{{ent not in fgd}}
{{base_brush|trigger_brush}}
{{base_brush|trigger_brush}} Fires an output when given a special [[targetname]] in response to [[player]] events.
==Entity Description==
For example, when a [[player]] dies, a <code>Use</code> input is sent to any [[trigger_brush]] named <code>game_playerdie</code>. The [[trigger_brush]] will fire <code>OnUse</code> in response.
===Special Targetnames===
{{note|The brush will be fully solid unlike other trigger [[entities]].}}
A '''Trigger_brush''' can be named one of these special targetnames, which can fire outputs anytime a certain event occurs.


For Example:
{{code class|CTriggerBrush|modelentities.cpp}}
''When a player entity dies, it sends the '''Use''' input to '''game_playerdie'''. If you name a '''Trigger_brush''' to '''game_playerdie''' and give it some '''OnUse''' outputs, they will fire every single time a player dies.''
==Targetnames==
 
The following [[targetname]]s are available for [[trigger_brush]].
* '''game_playerdie''' - Fires every time a player dies. The player who died is the '''!activator'''.
* <code>game_playerdie</code> - Fires every time a [[player]] dies. The player who died is the [[!activator]].
* '''game_playerkill''' - Fires every time a player kills another player, the killer is the '''!activator'''.
* <code>game_playerkill</code> - Fires every time a [[player]] kills another player, the killer is the [[!activator]].
* '''game_playerjoin''' - Fires every time a player joins the game, the joining player is the '''!activator'''. {{note| A delay is needed to target the !activator, as the !activator is not initialized instantly when joining.}}
* <code>game_playerjoin</code> - Fires every time a [[player]] joins the game, the joining player is the [[!activator]]. {{bug|Bots do not fire this.}}
* '''game_playerspawn''' - Fires every time a player spawns, the spawning player is the '''!activator'''. {{bug| game_playerspawn does not work in CS:GO and Team Fortress 2.}}
* <code>game_playerspawn</code> - Fires every time a [[player]] spawns, the spawning player is the [[!activator]]. {{bug|<code>game_playerspawn</code> does not function in {{csgo}} and {{tf2}}.}}
* '''game_playerleave''' - Fires every time a player leaves the game, '''!activator''' will not work in this case as the player entity no longer exists.
* <code>game_playerleave</code> - Fires every time a [[player]] leaves the game, [[!activator]] will not work in this case as the [[player]] [[entity]] no longer exists.


===FGD Code===
===FGD Code===
<pre>@SolidClass base(Targetname, Parentname, Global, EnableDisable) = trigger_brush
<pre>@SolidClass base(Targetname, Parentname, Global, EnableDisable) = trigger_brush
[
[
spawnflags(flags) =
input Use(void) : "Fires the OnUse output."
[
output OnUse(void) : "Fired when the Use input is given."
2: "Ignore player +USE" : 0
]
InputFilter(choices) : "Input Filter" : 0 : "Used to specify which inputs this entity will accept." =
[
0 : "Allow Everything"
22 : "Touch/Untouch: Players"
20 : "Touch/Untouch: Players & NPCs"
16 : "Touch/Untouch: Players, NPCs, Pushables"
18 : "Touch/Untouch: Players & Pushables"
21 : "Touch/Untouch: NPCs"
17 : "Touch/Untouch: NPCs & Pushables"
19 : "Touch/Untouch: Pushables"
6 : "Touch/Untouch & Use: Players"
2 : "Touch/Untouch & Use: Players & Pushables"
4 : "Touch/Untouch & Use: Players & NPCs: "
5 : "Touch/Untouch & Use: NPCs"
1 : "Touch/Untouch & Use: NPCs & Pushables"
3 : "Touch/Untouch & Use: Pushables"
14 : "Use: Players"
12 : "Use: Players & NPCs"
8 : "Use: Players, NPCs, & Pushables"
10 : "Use: Players & Pushables"
13 : "Use: NPCs"
9 : "Use: NPCs & Pushables"
11 : "Use: Pushables"
]
input Use(void) : "Use"
output OnUse(void) : "On use"
output OnStartTouch(void) : "Fired when an entity starts touching this trigger. " +
"The touching entity must pass this trigger's filters " +
"to cause this output to fire."
output OnEndTouch(void) : "Fired when an entity stops touching this trigger. " +
"The touching entity must pass this trigger's filters " +
"to cause this output to fire."
output OnEndTouchAll(void) : "Fires when an entity stops touching this trigger, " +
"and no other entities are touching it. Only entities " +
"that passed this trigger's filters are considered."
]</pre>
]</pre>


==Keyvalues==
==Keyvalues==
*{{KV Targetname}}
{{KV BaseEntity|brush=1}}
*{{KV Parentname}}
*{{KV Global}}
*{{KV EnableDisable}}
* '''InputFilter'''
: Used to specify which inputs this entity will accept.
:{| class=standard-table
! Literal Value || Description
|-
| 0 || Allow Everything
|-
| 22 || Touch/Untouch: Players
|-
| 20 || Touch/Untouch: Players & NPCs
|-
| 16 || Touch/Untouch: Players, NPCs, Pushables
|-
| 18 || Touch/Untouch: Players & Pushables
|-
| 21 || Touch/Untouch: NPCs
|-
| 17 || Touch/Untouch: NPCs & Pushables
|-
| 19 || Touch/Untouch: Pushables
|-
| 6 || Touch/Untouch & Use: Players
|-
| 2 || Touch/Untouch & Use: Players & Pushables
|-
| 4 || Touch/Untouch & Use: Players & NPCs
|-
| 5 || Touch/Untouch & Use: NPCs
|-
| 1 || Touch/Untouch & Use: NPCs & Pushables
|-
| 3 || Touch/Untouch & Use: Pushables
|-
| 14 || Use: Players
|-
| 12 || Use: Players & NPCs
|-
| 8 || Use: Players, NPCs, & Pushables
|-
| 10 || Use: Players & Pushables
|-
| 13 || Use: NPCs
|-
| 9 || Use: NPCs & Pushables
|-
| 11 || Use: Pushables
|}
==Flags==
==Inputs==
==Inputs==
*{{I Targetname}}
{{I BaseEntity}}
*{{I Parentname}}
*{{I EnableDisable}}
*'''Use'''
==Outputs==
==Outputs==
*{{O Targetname}}
{{O BaseEntity|l4d=1}}
* '''OnUse'''
{{IO|OnUse|Fired when the <code>Use</code> input is given.}}
:{{activator|activator}}
* '''OnStartTouch'''
: Fired when an entity starts touching this trigger. The touching entity must pass this trigger's filters to cause this output to fire. {{activator|toucher}}
* '''OnEndTouch'''
: Fired when an entity stops touching this trigger. Only entities that passed this trigger's filters will cause this output to fire. {{activator|exiting entity}}
* '''OnEndTouchAll'''
: Fires when an entity stops touching this trigger, and no other entities are touching it. Only entities that passed this trigger's filters are considered. {{activator|last exiting entity}}
== See also ==
== See also ==
[[logic_eventlistener]]
*[[logic_eventlistener]]
[[Category:Entities]]

Revision as of 04:13, 20 October 2018

Icon-NotInFGD.png
This entity is not in the FGD by default.
See below for instructions on making it available.

Template:Base brush Fires an output when given a special targetname in response to player events. For example, when a player dies, a Use input is sent to any trigger_brush named game_playerdie. The trigger_brush will fire OnUse in response.

Note.pngNote:The brush will be fully solid unlike other trigger entities.
C++ In code, it is represented by theCTriggerBrushclass, defined in themodelentities.cppfile.

Targetnames

The following targetnames are available for trigger_brush.

  • game_playerdie - Fires every time a player dies. The player who died is the !activator.
  • game_playerkill - Fires every time a player kills another player, the killer is the !activator.
  • game_playerjoin - Fires every time a player joins the game, the joining player is the !activator.
    Icon-Bug.pngBug:Bots do not fire this.  [todo tested in ?]
  • game_playerspawn - Fires every time a player spawns, the spawning player is the !activator.
    Icon-Bug.pngBug:game_playerspawn does not function in Counter-Strike: Global Offensive and Team Fortress 2.  [todo tested in ?]
  • game_playerleave - Fires every time a player leaves the game, !activator will not work in this case as the player entity no longer exists.

FGD Code

@SolidClass base(Targetname, Parentname, Global, EnableDisable) = trigger_brush
[
	input Use(void) : "Fires the OnUse output."
	output OnUse(void) : "Fired when the Use input is given."
]

Keyvalues

Inputs

Outputs

OnUse
Fired when the Use input is given.

See also