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

UE2:ScriptedLight (U2XMP)

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
U2XMP Object >> Actor >> Light >> ScriptedLight
Package: 
Engine
Direct subclasses:
AR_LightEffect, SR_LightEffect, DP_LightEffect, ER_EMPExplosion, GL_EMPEffect, LR_LightEffect, P_LightEffect, S_LightEffect

NEW: ScriptedLight $Author: Mfox $ $Date: 6/25/02 11:36p $ $Revision: 3 $ Name: ScriptedLight.uc Author: Aaron R Leiby Date: 07 December 1999 Description: A light that can be scripted to change its properties over time. How to use this class:

Set up some templates by filling in the ScriptedLightData array.

(Slot 0 is associated with the letter A. 1 is B, 2 is C, etc.)

TweenToTime is the amount of time it takes to reach the desired

settings. The color will tween using the associated RGB values

(rather than HSB) to avoid rainbow effects that would be caused by iterating across Hue values. If you want the transition to happen instantly, simply leave this value at zero.

Duration is the amount of time the light will remain at the desired

settings for that template, once it reaches it. Once again, this

value can be left at zero if you simply want it to reach the settings and then continue onto the next settings. Most likely, you won't want both TweenToTime and Duration to be zero, since the settings won't show up in that case.

Brightness, Hue and Saturation are same as the settings for any

other light. They get converted to RGB values under the hood for

smooth transitioning, but that shouldn't affect how you use them.

Once you have a few templates filled in, you can then create a

Script using that data by filling in the LightScript string.

Note: You should only use the capital letters A...Z. All other ASCII values are undefined. You can use any slot in the ScriptedLightData array. There's nothing sacred about starting with ABC. If you want, you can go right to the end and start with XYZ, or whatever your heart desires. Personally, I don't know what letter the number 14 represents without singing through my alphabet, counting on my fingers. So usually starting with ABC is easiest. I doubt most lights will use more than the first couple slot. In any case, I've provide a quick reference chart to allow you to look up the associated letters. This Script can include any of the set templates, in any order, and may be repeated as many times as desired. (Example: ABCB) This will Use template A, then B, then C, then back to B, then it will start all over again with ABCBABCBABCB... forever. Obviously this will allow for some cool effects.

Finally, you can use the LightScriptTimeOffset, to offset the starting

time for the first template to be used. This is generally used to

make lights that "propogate" -- first one turns on, then the next, then the next... light runner lights at an airport. This value is in seconds. Because this time is only taken into account when the light is first created, it makes it hard to visualize how it will all come out in the editor. In an effort to cater to this, if you turn off real-time mode in the perspective window (the little joystick icon) for more than 3 seconds (or do any other operation that will stop time for more than 3 seconds -- light rebuilding the level or lighting or whatever), this will reset the lights, and they will all start over at the same time, bringing them back into sync.

Quick Reference:

A=0 B=1 C=2 D=3 E=4 F=5 G=6 H=7 I=8 J=9 K=10 L=11 M=12 N=13 O=14 P=15 Q=16 R=17 S=18 T=19 U=20 V=21 W=22 X=23 Y=24 Z=25

Properties[edit]

Property group 'ScriptedLight'[edit]

bInitiallyOn[edit]

Type: bool


Default value: True

bRandomizeScript[edit]

Type: bool


bReset[edit]

Type: bool


LightScript[edit]

Type: string

Repeating light sequence.

LightScriptRampDown[edit]

Type: string

Script executed when turned off (non-repeating).

LightScriptRampUp[edit]

Type: string

Script executed when turned on (non-repeating).

LightScriptTimeOffset[edit]

Type: float

Countdown before execution once turned on.

ProximityTypes[edit]

Type: name

Array size: 8


Default value: Pawn

ScriptedLightData[edit]

Type: ScriptedLightInfo

Array size: 26

ABCDEF...Z

TimerDuration[edit]

Type: float


Internal variables[edit]

NextScriptedLight[edit]

Type: ScriptedLight

Modifiers: private


SL_Brightness[edit]

Type: float

Modifiers: private, transient


SL_BrightnessRate[edit]

Type: float

Modifiers: private, transient


SL_Color[edit]

Type: Object.Vector

Modifiers: private, transient


SL_ColorRate[edit]

Type: Object.Vector

Modifiers: private, transient


SL_Countdown[edit]

Type: float

Modifiers: private, transient


SL_DesiredBrightness[edit]

Type: byte

Modifiers: private, transient


SL_DesiredColor[edit]

Type: Object.Vector

Modifiers: private, transient


SL_Duration[edit]

Type: float

Modifiers: private, transient


SL_Index[edit]

Type: int

Modifiers: private, transient


SL_Initialized[edit]

Type: bool

Modifiers: private, transient


SL_LastBrightness[edit]

Type: float

Modifiers: private, transient


SL_LastColor[edit]

Type: Object.Vector

Modifiers: private, transient


SL_RampingDown[edit]

Type: bool

Modifiers: private, transient


SL_RampingUp[edit]

Type: bool

Modifiers: private, transient


SL_TweenBrightness[edit]

Type: float

Modifiers: private, transient


SL_TweenColor[edit]

Type: Object.Vector

Modifiers: private, transient


SL_TweenTime[edit]

Type: float

Modifiers: private, transient


Default values[edit]

Property Value
bStatic False
LightType LT_Scripted

Structs[edit]

ScriptedLightInfo[edit]

float TweenToTime 
float Duration 
Doesn't include TweenToTime.
byte Brightness 
byte Hue 
byte Saturation 

Functions[edit]

Events[edit]

PreBeginPlay[edit]

simulated event PreBeginPlay ()

Overrides: Light.PreBeginPlay


Other instance functions[edit]

TurnOff[edit]

public simulated function TurnOff ()


TurnOn[edit]

public simulated function TurnOn ()


States[edit]

ProximityBased[edit]

Modifiers: simulated

ProximityBased.BeginState[edit]

public simulated event BeginState ()

Overrides: Object.BeginState (global)


ProximityBased.EndState[edit]

public simulated event EndState ()

Overrides: Object.EndState (global)


ProximityBased.Touch[edit]

public simulated event Touch (Actor Other)

Overrides: Actor.Touch (global)


ProximityBased.UnTouch[edit]

public simulated event UnTouch (Actor Other)

Overrides: Actor.UnTouch (global)


ProximityBased.ValidTouch[edit]

protected simulated function bool ValidTouch (Actor Other)


TriggerControl[edit]

Modifiers: simulated

TriggerControl.Trigger[edit]

simulated function Trigger (Actor Other, Pawn EventInstigator, optional name EventName)

Overrides: Actor.Trigger (global)


TriggerControl.UnTrigger[edit]

simulated function UnTrigger (Actor Other, Pawn EventInstigator, optional name EventName)

Overrides: Actor.UnTrigger (global)


TriggerTimed[edit]

Modifiers: simulated

TriggerTimed.Timer[edit]

simulated event Timer ()

Overrides: Actor.Timer (global)


TriggerTimed.Trigger[edit]

simulated function Trigger (Actor Other, Pawn EventInstigator, optional name EventName)

Overrides: Actor.Trigger (global)


TriggerToggle[edit]

Modifiers: simulated

TriggerToggle.Trigger[edit]

simulated function Trigger (Actor Other, Pawn EventInstigator, optional name EventName)

Overrides: Actor.Trigger (global)