Lights in GTA 2 Coding
You usually set up lights in the map editor, but you can also add them during a mission. For example, player goes to rob a bank and sound and flashing lights appears.
LIGHT uniquename
Like sound, this reserves a spot for a light later on. To activate it, add this code:
uniquename = CREATE_LIGHT ( X , Y , Z ) radius intensity ( red , green , blue ) ondelay offdelay random
Seems strange doesn’t it? This is what the parameters mean:
| Range | Description | |
|---|---|---|
Radius
| 0 to 8
| Radius of the light effect in cubes. |
Intensity
| 0 to 255
| Brightness of the light. |
red
| 0 to 255
| How much of each colour to add in normal RGB notation. |
green
| ||
blue
| ||
Ondelay
| 0 to 255
| Time a flashing light shines for. 20 is a fairly decent speed.
|
offdelay
| 0 to 255
| Time a flashing light stays dark for. |
Random
| 0 to 255
| sets the maximum number of frames to randomise the delay timings by. |
Let me show you an example:
light01 = CREATE_LIGHT ( 12.5 , 56.5 , 3.0 ) 8 255 ( 255 , 255 , 255 ) 0 0 0
If you want to create a light straight off, add this code:
LIGHT uniquename ( X , Y , Z ) radius intensity ( red , green , blue ) ondelay offdelay random
Again, I'll show an example:
LIGHT light02 = ( 67.5 , 78.5 , 2.0 ) 8 255 ( 255 , 0 , 0 ) 0 0 0
That code would create a red light at those coordinates.
Editing Lights
As well as creating lights, you can also edit them too with these 3 commands:
CHANGE_INTENSITY ( lightname , newintensity )
CHANGE_COLOUR ( lightname , newred , newgreen , newblue )
CHANGE_RADIUS ( lightname , newradius )
Again, they are all simple to use. The lightname is a light you created by the way. Your codes could look like this:
CHANGE_INTENSITY ( light03 , 150 )
CHANGE_COLOUR ( light04 , 255 , 0 , 255 )
CHANGE_RADIUS ( light05 , 8 )
(Originally written by Chris “Pyro” Hockley and formatted by Ben “Cerbera” Millard with full permission.)