Trigger
Verb Definition: see Triggered
When a Trigger is touched by a valid object, usually a Player or some other type of Pawn, it causes a certain event to be initiated. However, if a Trigger is listening for an event and detects it, then it is turned on or off according to its state and whether it was on or off to begin with.
The event that a Trigger calls is Events → Event and the event it listens for is Events → Tag, both under the Events section of the properties. The Event page explains this in more depth.
Even though this is a very simple thing for an actor to do, there are many variables that are used to alter the way this is done.
Tips
To see where triggers are so you can easily test them in game, change their Lighting properties so they cast a small circle of light: set LightType, LightRadius and LightBrightness. See Actor (UT)/Lighting for more info on these properties.
Properties
- bool bInitiallyActive
- This variable determines whether the trigger is on or off when the level starts. A Trigger can be put to sleep or woken up by being triggered itself: see the States section below.
- bool bTriggerOnceOnly
- If this variable is set to True, then the trigger will function once. If it is set to False, then the Trigger will work over and over again, as long as the Trigger is left active.
Wild guess: if this is set to true, it can't be subsequently woken up by triggering. I'm guessing the script just send it to the None state —Tarquin - ETriggerType TriggerType
- The content of this variable is used to determine exactly what kind of actors are relevant, i.e. what actors will make this Trigger work when they touch it. This is an enumerator, and here are its choices:
TT_PlayerProximity This trigger can only be set off by a PlayerPawn. TT_PawnProximity This trigger can be set off by any type of Pawn (UT). TT_ClassProximity This trigger can only be set off by Actors of a certain class or Actors of a class below this one. (So if you make a Trigger that only a Nali can set off, then a Nali Priest will also be able to set it off.) The class that is capable of setting off this trigger is defined in the ClassProximityType variable. TT_AnyProximity This trigger can be set off by pretty much anything touching it other than the world geometry. Use caution when selecting this option. TT_Shoot This trigger is set off by being shot and damaged. To be successfully set off, the Trigger must sustain at least as much damage as is specified in the DamageThreshold variable. TT_HumanPlayerProximity (only UT2003) Trigger activated by human player (not bot) - class<Actor> ClassProximityType
- This variable determines what classes are capable of setting off this Trigger. It is only relevant if the TriggerType variable is set to TT_ClassProximity.
- float DamageThreshold
- This variables determines how much damage is necessary to successfully set off. It is only relevant if the TriggerType variable is set to TT_Shoot.
- float ReTriggerDelay
- After each time it is successfuly set off, the Trigger is prevented from doing so again until this length of time has elapsed.
- float RepeatTriggerTime
- This property is inactive if set to 0. If the actor setting off the Trigger is remaining within the Trigger's proximity, then the Trigger will be set off over and over again at this interval until the actor leaves the Trigger's proximity. The ReTriggerDelay doesn't interfere with this action, since it will only kick in after the actor finally leaves.
- string Message (localized)
- If a Player is the reason that a Trigger is successully set off, either because the player touched the Trigger or shot it, then this message will be sent to that player through his console.
CollisionHeight and CollisionRadius
These properties (under the Collision grouping) determine the size of the Trigger's collision cylinder.
Even though all Actors have these variables in their Collision properties, it is important to remember that they can be adjusted by the mapper to allow for different dimensions where collision should be checked. This is useful so that a mapper can use a single Trigger to cover a large area, or to cover an area that requires pinpoint accuracy from a player.
States
The Object → InitialState property contains a list of states that are made available to mappers.
The Trigger class does not switch states during gameplay. The different states determine how the trigger behaves when it is itself triggered (by another Trigger, for example). These allow the Trigger to be woken up or put to sleep.
- None
- The Trigger is in a permanently inactive state. The None state exists for all actors, otherwise it would not be here. Ignore this state. (Actually, doesn't this behave the same as NormalTrigger?)
- NormalTrigger
- The Trigger is permanently active and can't be turned off.
- OtherTriggerTurnsOff
- If the Trigger itself is triggered, then it will be permanently deactivated. Note that bInitiallyActive must be set to true, otherwise the trigger will be off and will stay off when triggered.
- OtherTriggerTurnsOn
- If the Trigger itself is triggered, then it will be permanently activated. Again if bInitiallyActive is true then it will be on already when triggered.
- OtherTriggerToggles
- If the Trigger itself is triggered, it will be turned off if it was on, and vice versa. This is repeatable.
Known subclasses in UT
Known Subclasses in UT2003
Related Topics
- Dynamics: main topic page for triggers & sounds
- Types of Trigger: summary of trigger types
Legal: Quick Q: How do I make one ElevatorTrigger to trigger 2 events? I need them both to be triggered in the Event> Event...
Tarquin: Trigger a Dispatcher. And have you edited this page text in MS Word? some ' characters have been turned into Evil Entities
Legal: Nope, sorry, wish I had Anyway, the problem is that I have to trigger an ElevatorTrigger with an ElevatorTrigger... But it doesn't work with a Dispatcher. So, I have to either A; Trigger 2 events with one ElevatorTrigger, or B; Find a workaround.
The workaround I have is to add an attachmover to move the first ElevatorTriggers away, but I'd like to avoid more movers.
Tarquin: Ah. Hm. Move this discussion to ElevatorTrigger. I think the on ly thing to do is subclass & rewrite the bad code
Tarquin: WHy can't both the ElevatorMovers have the same Tag? If not, subclass and put:
var(Events) AuxEvent; function Touch( actor Other ) { local ElevatorMover EM; if( IsRelevant( Other ) ) { // Call the ElevatorMover's Move function if( AuxEvent != '' ) foreach AllActors( class 'ElevatorMover', EM, AuxEvent) EM.MoveKeyframe( GotoKeyFrame, MoveTime ); if( bTriggerOnceOnly ) // Ignore future touches. SetCollision(False); } super.Touch( Other ); }
Legal: Sorry, can't move now, tomorrow. Anyway, thanks for the code, now how do I add this mover? (The command line) I need it to make a door be opened from one side, but still I need to blow it from any side. It all works, or it should, I think. In a hurry, bye.
Tarquin: that's an ElevatorTrigger subclass ....
MythOpus: Trigger Type Shoot doesn't seem to work for me at all anymore :S