This article's documentation is for anything that uses the Source engine. Click here for more information.

Trigger once: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(clarify more)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<!-- When this page is updated to {{langsp}} or {{language subpage}} instead of {{lang}}, please move {{this is a}} to the base page, as it is automatically translated. -->{{lang|Trigger once}}{{CD|CTriggerOnce|file1=triggers.cpp}}
{{LanguageBar}}
{{this is a|brush entity|name=trigger_once}} It is a trigger volume that removes itself after it has been triggered (touched by a qualifying entity) once. A [[trigger]] uses [[outputs]] to activate an [[event]] in another [[entity]].
{{TabsBar}}
{{CD|CTriggerOnce|file1=triggers.cpp}}
{{This is a|brush entity|name=trigger_once}} It is a trigger volume that removes itself after it has been triggered (touched by a qualifying entity) once. A [[trigger]] uses [[outputs]] to activate an [[event]] in another [[entity]].


{{sensor brush}}
{{sensor brush}}
Line 12: Line 14:


== Inputs ==
== Inputs ==
{{IO|Toggle|Toggles this trigger between enabled and disabled states.}}
{{I|Toggle|Toggles this trigger between enabled and disabled states.}}
{{IO|Enable|Enable trigger}}
{{I|Enable|Enable trigger}}
{{IO|Disable|Disable trigger}}
{{I|Disable|Disable trigger}}
{{IO|StartTouch|Behave as if the {{ent|!caller}} entity had just entered the trigger volume. Accepts non-physical entities.|since={{Src07}}|nofgd=1}}
{{I|StartTouch|Behave as if the {{ent|!caller}} entity had just entered the trigger volume. Accepts non-physical entities.|since={{Src07}}|nofgd=1}}
::{{note|Will trigger OnStartTouch output and the trigger won't be removed.}}
::{{note|Will trigger OnStartTouch output and the trigger won't be removed.}}
::{{warning|If !caller doesn't exist game will crash}}
::{{warning|If !caller doesn't exist game will crash}}
{{I Trigger Chaos}}


== Outputs ==
== Outputs ==
{{IO|OnStartTouch}}
{{O|OnStartTouch}}
{{IO|OnTrigger|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."}}}}
{{O|OnTrigger|activator = entity that touched the trigger|Fired when an entity starts touching this trigger. The touching entity must pass this trigger's filters to cause this output to fire.}}
{{Important|If the [[trigger_once]] is enabled while multiple entities that can trigger it are touching it each output will have different outcomes. OnStartTouch will fire for '''each''' [[!activator]]. Meanwhile OnTrigger will only trigger '''once'''.{{Note| The refire amount will decide how many times your OnStartTouch will fire.}}}}
{{Important|If the [[trigger_once]] is enabled while multiple entities that can trigger it are touching it each output will have different outcomes. OnStartTouch will fire for '''each''' [[!activator]]. Meanwhile OnTrigger will only trigger '''once'''.{{Note| The refire amount will decide how many times your OnStartTouch will fire.}}}}



Latest revision as of 08:22, 23 April 2025

English (en)中文 (zh)Translate (Translate)
edit
C++ Class hierarchy
CTriggerOnce
CTriggerMultiple
CBaseTrigger
CBaseToggle
CBaseEntity
C++ triggers.cpp

trigger_once is a brush entity available in all Source Source games. It is a trigger volume that removes itself after it has been triggered (touched by a qualifying entity) once. A trigger uses outputs to activate an event in another entity.

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

BaseTrigger
Filter Name (filtername) <filter>
A filter entity to test potential activators against.
Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).

Flags

BaseTrigger
Everything (not including physics debris) : [64]
Clients (Survivors, Special Infected, Tanks Left 4 Dead seriesLeft 4 Dead series) : [1]
Only clients in vehicles : [32]
Only clients *not* in vehicles : [512]
Disallow Bots (removed since Left 4 Dead) : [4096]
NPCs (Common Infected, Witches Left 4 Dead seriesLeft 4 Dead series) : [2]
Only player ally NPCs : [16]
Only NPCs in vehicles (respects player ally flag) : [2048]
Physics Objects (not including physics debris) : [8]
Physics debris (include also physics debris) : [1024]
Pushables (Passes entities with classname func_pushable) : [4] Obsolete
Deprecated.
Equivalent to using Everything + filter_activator_class that filters func_pushable.

Inputs

Toggle
Toggles this trigger between enabled and disabled states.
Enable
Enable trigger
Disable
Disable trigger
StartTouch  (in all games since Source 2007) !FGD
Behave as if the !caller entity had just entered the trigger volume. Accepts non-physical entities.
Note.pngNote:Will trigger OnStartTouch output and the trigger won't be removed.
Warning.pngWarning:If !caller doesn't exist game will crash

Outputs

OnStartTouch
OnTrigger
!activator = entity that touched the trigger
!caller = this entity
Fired when an entity starts touching this trigger. The touching entity must pass this trigger's filters to cause this output to fire.
Icon-Important.pngImportant:If the trigger_once is enabled while multiple entities that can trigger it are touching it each output will have different outcomes. OnStartTouch will fire for each !activator. Meanwhile OnTrigger will only trigger once.
Note.pngNote: The refire amount will decide how many times your OnStartTouch will fire.

See also