UE2:ScriptedLight (U2XMP)

From Unreal Wiki, The Unreal Engine Documentation Site
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

Property group 'ScriptedLight'

bInitiallyOn

Type: bool


Default value: True

bRandomizeScript

Type: bool


bReset

Type: bool


LightScript

Type: string

Repeating light sequence.

LightScriptRampDown

Type: string

Script executed when turned off (non-repeating).

LightScriptRampUp

Type: string

Script executed when turned on (non-repeating).

LightScriptTimeOffset

Type: float

Countdown before execution once turned on.

ProximityTypes

Type: name

Array size: 8


Default value: Pawn

ScriptedLightData

Type: ScriptedLightInfo

Array size: 26

ABCDEF...Z

TimerDuration

Type: float


Internal variables

NextScriptedLight

Type: ScriptedLight

Modifiers: private


SL_Brightness

Type: float

Modifiers: private, transient


SL_BrightnessRate

Type: float

Modifiers: private, transient


SL_Color

Type: Object.Vector

Modifiers: private, transient


SL_ColorRate

Type: Object.Vector

Modifiers: private, transient


SL_Countdown

Type: float

Modifiers: private, transient


SL_DesiredBrightness

Type: byte

Modifiers: private, transient


SL_DesiredColor

Type: Object.Vector

Modifiers: private, transient


SL_Duration

Type: float

Modifiers: private, transient


SL_Index

Type: int

Modifiers: private, transient


SL_Initialized

Type: bool

Modifiers: private, transient


SL_LastBrightness

Type: float

Modifiers: private, transient


SL_LastColor

Type: Object.Vector

Modifiers: private, transient


SL_RampingDown

Type: bool

Modifiers: private, transient


SL_RampingUp

Type: bool

Modifiers: private, transient


SL_TweenBrightness

Type: float

Modifiers: private, transient


SL_TweenColor

Type: Object.Vector

Modifiers: private, transient


SL_TweenTime

Type: float

Modifiers: private, transient


Default values

Property Value
bStatic False
LightType LT_Scripted

Structs

ScriptedLightInfo

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

Functions

Events

PreBeginPlay

simulated event PreBeginPlay ()

Overrides: Light.PreBeginPlay


Other instance functions

TurnOff

public simulated function TurnOff ()


TurnOn

public simulated function TurnOn ()


States

ProximityBased

Modifiers: simulated

ProximityBased.BeginState

public simulated event BeginState ()

Overrides: Object.BeginState (global)


ProximityBased.EndState

public simulated event EndState ()

Overrides: Object.EndState (global)


ProximityBased.Touch

public simulated event Touch (Actor Other)

Overrides: Actor.Touch (global)


ProximityBased.UnTouch

public simulated event UnTouch (Actor Other)

Overrides: Actor.UnTouch (global)


ProximityBased.ValidTouch

protected simulated function bool ValidTouch (Actor Other)


TriggerControl

Modifiers: simulated

TriggerControl.Trigger

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

Overrides: Actor.Trigger (global)


TriggerControl.UnTrigger

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

Overrides: Actor.UnTrigger (global)


TriggerTimed

Modifiers: simulated

TriggerTimed.Timer

simulated event Timer ()

Overrides: Actor.Timer (global)


TriggerTimed.Trigger

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

Overrides: Actor.Trigger (global)


TriggerToggle

Modifiers: simulated

TriggerToggle.Trigger

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

Overrides: Actor.Trigger (global)