Entities 220: Lesson 1
Dynamic Lights and Light Switches

Entities are the core of any map - whether they are brush-based entities (like func_train, trigger_multiple, etc) or static entities (like NPCs and info entities).  Brush-based entities primarily make your map interesting to interact with.  Static entities typically make your map fun to play and interesting to look at.  Because most brush-based entities are covered in Brushes 201, we will be primarily covering static entities here.

Generally speaking though, the first thing to remember is that the entity definition files for SP and MP are different.  Many entities that are in SP were taken out of MP (such as rain) for various reasons.  Thus, always makes sure you know the capabilities of the engine you're working with.  Also, a lot of the entity help files were taken out of the MP engine for no real specific reason (such as dynamic light codes), and thus their settings are only listed in SP.

Speaking of which, that's what we'll look at first!  Dynamic lights are an important part of maps as they make areas much more visually interesting.  The disadvantage, however, is that they are much more processor intensive.  They also don't affect r_speeds, so you must remember to take them into account when looking at your levels.  For our example this class, make a large room (768x768x512 should do it) and then make a small square building inside.

In the top corner of your little room, make a small ceiling florescent light figure.  For this one, I just made a simple rectangular brush and textured the bottom with impdetention/deathconlight.


Make sure that you use a light texture for this light.  If you use a light shader, check in the appropriate .shader file (in base/shaders/ - for this file, you would look in imperial.shader) to see if that shader has the line q3map_surfacelight.  If it does, you can't use it.  This is because shaders with that parameter emit their own light - when you add a dynamic light entity to a shader that is already emitting light, it'll look strange.

Next add a spotlight pointing at the florescent light.  Remember to use an info_null to target it.

Next, because we want the light to encompass the entire size of the florescant light, select the light and enter thet key radius and a value equal to the length of the light (determine it with the Q Key), plus a few grid units.  In mine, the light is 80 units long, so I set radius to 85.

Next add the key style.  This will be what you use to determine what type of dynamic light it will be - what type of flicker or pulsation it will emit.  You can find the whole list in the entity's help file (just under the large list of entity names in the Entity window) in the SP entity defs.  If you are using the MP entity defs, you will need to switch to SP for the list.  For your convenience, this is the list, as presented in the SP help file::

1 FLICKER (first variety)
2 SLOW STRONG PULSE
3 CANDLE (first variety)
4 FAST STROBE
5 GENTLE PULSE 1
6 FLICKER (second variety)
7 CANDLE (second variety)
8 CANDLE (third variety)
9 SLOW STROBE (fourth variety)
10 FLUORESCENT FLICKER
11 SLOW PULSE NOT FADE TO BLACK
12 FAST PULSE FOR JEREMY
13 Test Blending

Mode 13 is a sort of multi-color disco light.  But be warned, it lags the most of all dynamic lights.

So what if you wanted a light switch to trigger your florescent lights?  Simple.  First, make a physical switch on the wall.  Next, make a small rectangular brush in front the switch.  Cover it in the system/trigger shader.  Right-click in the 2D View and make it into a trigger_multiple.  Set your trigger_multiple to set PLAYERONLY, FACING, and USE_BUTTON to make it a player-activated use button.  Remember, light switches have nothing to do with the physical switch itself - it is the trigger entity in front of it that actually turns on the light.

You will also need to set an angle for the USE_BUTTON flag.  You need to set the trigger to be turned toward the wall with the switch on it.  This will prevent a player from being turned in any direction when he presses his Use button to turn the light on...  unless of course you want him to be able to.  (:

Next, you need to add the key wait and a value of 1.  The reason you do this is so that the switch doesn't keep turning on and off at the speed of light.  (The wait key prevents the trigger from being fired until its time (in seconds) is complete).

If you want the switch to make a noise when you hit it (and I know you do), simply add the key noise and a value for the sound, such as sound/movers/switches/button_01.mp3.

Voila!  A dynamic light that you can turn on and off!

Back to Home