 |
| Figure 1 |
|
Create your light by right clicking on the 2D view and choosing "light"
from the entity menu (FIGURE 1). Setup any values you would like by
pressing ' n ' when the light is selected (shift + left click on the
light to select it). Next, in the entity properties window, click
the check box for "DYNAMIC". Finally, give your light a
group_name by typing "group_name" into the "key"
text box and name it "light01" in the "value"
text box. This group_name of "light01" will be used in the
script file to control its dynamic behavior.
I will assume you know how to create a script file for your level.
If not, seek out a tutorial on scripting for EF2.
To make your light dynamic and flicker on and off you need to have
this line of code in a thread.
$world.light_lightstyle( "light01", "aaaaazzzzzaaaaazzzzzjjaaaaaazzzzaaaajaaaajzzzzzazazazajjzaaaaazzkahjszwufkjaz",
0 );
You will always write $world.light_lightstyle. That is a special
function that allows you to control your specific lights. You see
"light01" is in quotes, this tells the function which light
entity you want it to control. The actual controlling of the flickering
pattern comes in where you see all the letters, 'a', 'z', etc. Pitch
black is 'a' and full bright is 'z'. "aaaa" is pitch black
for four seconds because each letter represents one second. So "zz"
would be full bright for two seconds. The final 0 can be either 0
or 1. 0. '0' indicates this pattern loops continuously while '1' indicates
it only happens once.
Play around with the different letter combinations you can come up
with for different flickering results. You can look at the dlights.scr
file included in the zip file (at the bottom of this tutorial) to
experiment.
Another lighting command is $world.light_fade and you use it as $world.light_fade(
"light02", 0, 10 );. "light02" is the group_name
of the light you want to fade from default brightness down to 0 brightness
(pitch black) over 10 seconds.
This concludes the dynamic lights tutorial.
http://game.rbkdesign.com/ef2/example_maps/dlights.zip
Includes (1) dlights.bsp, (1) dlights.map, (1) dlights.scr