I love the smell of UnrealEd crashing in the morning. – tarquin

Legacy:TriggerLight

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UT :: Actor (UT) >> Light (UT) >> TriggerLight (Package: Engine and UnrealShare)
UT2003 :: Actor >> Light >> TriggerLight (Package: Gameplay)

A light actor that can be made to turn on and off using a Trigger actor. A map's lighting must be rebuilt for the effect to be visible. In UnrealEd 2, the TriggerLight will appear lit in UnrealEd even if it will be initially off in the game. In later versions it appears unlit.

Notes[edit]

  • Keep in mind that in the newer Unreal Engine builds dynamic lights shine through solid walls. So plan ahead if you don't want the light to appear in other rooms.

Jacen When it says "newer Unreal Engine builds", does that mean older builds or more recent builds?

  • For some reason there are two identical TriggerLight classes in the Engine and UnrealShare packages in Unreal and UT. You shouldn't worry about that too much, though.
  • Since UT2003, Dynamic lighting is considered inferior to Projectors. Although dynamic lighting is still available, it will tax CPU cycles and cause some visual problems both online and offline.

Properties[edit]

Object Group[edit]

InitialState 
Make sure TriggerToggle/TriggerTurnsOn/TriggerTurnsOff is selected

TriggerLight Group[edit]

bool bDelayFullOn 
Whether the brightness should smoothly fade between 0 and the initial LightBrightness value.
bool bInitiallyOn 
Whether the light is initially on. For instance, if the state is set to "TriggerTurnsOff" you must set this to true for something to happen.
float ChangeTime 
This sets the amount of time (in seconds) for the light to fade between its set brightness and zero.
float RemainOnTime 
Only used by TriggerPound state. How long the TriggerPound effect lasts.

Daemonica: Does bDelayFullOn work properly with ChangeTime in UT2003... I've tried using it and the light works spot on with static meshes, but doesn't "fade" in or out on bsp. Any pointers here?

UnrealScript-only[edit]

float Alpha 
float Direction 
Whether the light currently goes on or off.
float InitialBrightness 
Saved initial LightBrightness value.
float poundTime 
How long the TriggerPound effect already lasts.
Actor SavedTrigger 

States[edit]

TriggerTurnsOn 
Light turns on when triggered and then stays on.
TriggerTurnsOff 
Light turns off when triggered and then stays off.
TriggerToggle 
Light flips between on / off each time its triggered
TriggerControl 
Light turns on when triggered, and switches off when the untriggered (eg the player steps out of the trigger's range)
TriggerPound 
From the code, it looks like the light should fade up and down repeatedly for the time specified in the RemainOnTime property.

Scripting[edit]

The TriggerLight class is pretty much the canonical way to perform gradual changes using the Tick() function.

The general approach is to have a float variable somewhere that tracks the property's interpolated value. Then, in the Tick event, use DeltaTime to gradually increment or decrement the variable (depending on whether its target value is currently 0 or 255), and clamp it at 0.0 and 255.0. Then, set the property based on the float's value.

The DeltaTime parameter of the Tick event is there to accommodate the differences between frame rate of different users, or even the time between any two frames on the same computer, which may change.

Related Topics[edit]