Controlling dynamic lights
|Note: This feature is for ZScript only.|
By creating and using a PointLight inheriting class, it's possible to change a dynamic light's colors and size. To change its size and color, simply change the dynamic lights arguments.
- args[0,1,2] - Red, green and blue channels respectively. Ranges from 0 - 255 each. The higher the number, the higher the saturation of that color.
- args - The size of the light.
- args - For flicker and pulse lights only, sets the secondary size.
|Note: The DynamicLight class has constants defined for accessing dynamic light args - instead of using 0, 1, 2, 3 and 4, it is advisable to use DynamicLight.LIGHT_RED, DynamicLight.LIGHT_GREEN, DynamicLight.LIGHT_BLUE, DynamicLight.LIGHT_INTENSITY and DynamicLight.LIGHT_SECONDARY_INTENSITY (respectively), for better readable code. The DynamicLight. prefix can be left off if the constants are being used inside a DynamicLight-derived class.|
The following flags are all prefixed by DYNAMICLIGHT. (including the period)
- SUBTRACTIVE - Lights become subtractive (darkening effect).
Dynamic lights utilize the target pointer. This must be given before the light's first tic -- i.e. within (Post)BeginPlay (either one works). Any manipulation to the light must also be performed in the Tick function as it does not use states.
Lights will then automatically position themselves at the actor's location and follow them around -- but unlike regularly assigned dynamic lights, these will not disappear immediately upon the target actor's removal, change of sprite/frame or usage of the Light() property. Book keeping may be required.
On the positive note, there is much more control over the lights, especially with color manipulation and various sizes. Manually spawned lights can have changing arguments which will immediately be reflected in the game.