First, it might be helpful if you download the map that the Lights and Switches tutorials are based on, and have it loaded into the editor before beginning.
You can download the tutorial map HERE. The completed map can be found at the end of this tutorial.
{If you have any problems creating the brushes yourself, you will find the completed light switch etc. behind the player spawn point.}
Part1: The basics
This tutorial will teach you how to make a light turn on and off.
1. Move to point 01 (next to the open doorway), and create a brush 8 x 16 x 2 grid units (you can use the number keys 1 to 4 to change the grid size).
2. Click on the "light_switch" texture in the textures window, then press "S" on the keyboard to bring up the surface inspector and click on "Fit".
3. Move the bottom of the brush up by 3 units so that only the switch texture itself is showing, then place the switch over the number 01.
Press the "Escape" key to deselect the brush.
4. Next, create a brush 16 x 64 x 4 grid units and select the small "safe_side" texture from the textures window, then place the brush on the number 02 texture in the small room.
5. Select only the bottom face of the brush (hold down control+shift then click the left mouse button) and choose the "light6_glow" texture. Press "S" and rotate the texture 90 degrees, click on "Fit" then "Done" (you may also need to use the "V Shift" keys).
Press the "Escape" key to deselect the brush.
6. Right click on the 2d window and select "light". Give it a value of 300 and press "ok"
7. Place the light in the centre of the light brush (in the 2d window), and at a height of about 64 units from the floor.
8. With the light still selected, press "N" and select the following boxes
start_off noincidence //this will give a smoother lighting effect.
then enter the following "Key/Value" settings.
Key targetname Value light1
Key scale Value 0.7 //multiplier for the light intensity, greater than 1 is brighter, between 0 and 1 is dimmer.
Press the "Escape" key to deselect the light.
9. Next, create a brush 24 x 16 x 24 grid units and select the "_trigger" texture from the texture window, then place it over the light switch (flush with the wall).
10. Right click on the 2d window and select "trigger/trigger_multiple". Press "N" on the keyboard and select the following boxes.
player_use //player has to "use" the trigger. player_only //only the player can activate the trigger.
Then enter the following "Key/Value"
Key target Value light1
Press Escape to deselect the brush and save the map.
If you want to add a sound effect, then do the following.
1. Right click on the 2d window and select "target/target_speaker". You can place this anywhere in the room.
2. Press "N" on the keyboard and enter the following "Key/Value" settings
Key targetname Value light1
Key noise Value sound/weapons/ak74/slap.wav (it sounds good… honest)
Finally, select the box "activator" (the sound will on be heard by the person who activated the trigger)
Press Escape to deselect the brush and save the map.
You could compile your map at this stage (using "test" or "full") and try it out, or continue with the rest of this tutorial.
Part2: Automatic light switch
This next section will teach you how to make the lights turn on and off, when the player enters or leaves the room.
1. Create a brush 68 x 8 x 68 grid units and place it in the centre of the first doorway. Then select the "_trigger" texture from the textures window
2. Right click on the 2d window, and select "trigger/trigger_multiple". Press "N" on the keyboard and select the box "player_only"
Then enter the following "Key/Value" settings.
Key target Value light2
Key wait Value 2 //the trigger can't be used again for "2" seconds.
Now close the entity editor.
3. Press the "spacebar" to copy the brush, and place this brush in the other doorway (at the other end of the map).
Press the "Escape" key to deselect the brush.
4. Right click on the 2d window and select "light". Give it a value of 300 and press "ok"
5. Place the light in the centre of one of the textures with the number 03 on it, and at a height of about 64 units from the floor.
6. With the light still selected, press "N" and select the following boxes
start_off noincidence
Then enter the following "Key/Value" settings.
Key targetname Value light2
Key scale Value 0.7
Now close the entity editor
7. Copy this light entity to the other number 03 textures, then press the "Escape" key to deselect the light.
8. Finally, copy the light brush you created in part1 of this tutorial, and place one on each of the number 03 textures.
Press Escape to deselect the brush and save the map.
Compile your map using one of the "test" or "full" options, and try it out.
If you wanted the NPC to turn the lights on, then only have the "npc_only" box selected for the triggers.