Second Draft - 16-Nov-2004
This tutorial explains various techniques for switching lights on and off, including lights shining through a window.
Note:
This tutorial is for ThiefGold, but the techniques explained here will work the same in Thief2.
To make things clearer, I will be using diagrams with the following symbols:
To start off, create a standard default mission (starting point, scripts loaded, core texture family added, etc).
First we will create a small area in which to play with our light sources:
Reduce the grid size to 13.
Create an air-brush at (x:0,y:40,z:0) with dimensions (d:24,w:16,h:16). This will be our courtyard.
Set the top texture to 'sky-hack' and choose an appropriet texture for the walls and the floor.
Clone this air-brush and move it to location (x:0,y:60,z:0). This will be our house.
Set the top texture of this air-brush to an appropriet ceiling texture.
Clone this air-brush, move it to location (x:-5,y:50,z:-4) and resize it to (d:4,w:4,h:8). This will be our doorway.
Set the top texture of this air-brush to be the same as the texture of the walls.
Clone this air-brush, move it to location (x:5,y:48.5,z:0) and resize it to (d:4,w:1,h:6). This will be our outside window.
Set the bottom texture of this air-brush to be the same as the texture of the walls.
Set the east texture of this air-brush to be 'Stain1' from the 'temple' family.
Clone this air-brush and move it to location (x:5,y:51.5,z:0). This will be our inside window.
Set the west texture of this air-brush to be 'Stain1' from the 'temple' family.
Finally, room-brush the air-brushes.
Let's start with a simple electric light, which can be switched on and off using a pair of buttons.
Create a Pysical>Lights>Lanterns>Sewerlite and place it on the eastern room's southern wall (x:11.10,y:60,z:0).
Open up the lamp's properties and set Renderer>Light>Brightness to zero. Then add the Renderer>AnimLight property.
Set Mode to "maximum brightness", set max brightness to 120, and set radius to 16. Also, min brightness should already be set to zero. Click Ok to return to the property heirachy.
Add the S>Scripts property and for Script 0 type 'AnimLight' (without the quotes). Click Ok and then Done.
Create an Fnord>Traptrig>Relaytrap and an Fnord>Traptrig>Inverter and place them either side of the lamp.
Create a Physical>Gizmo>Buttons>Button and place it on the west wall, just south of the window (x:9.75,y:52.13,z:-1.80). Clone the button and put the clone underneeth the first button (x:9.75,y:52.13,z:-2.20).
Now we need to connect these, using ControlDevice links. (If you don't know how to set up a ContolDevive link, click here).
As shown on the diagram, make a ControlDevice link from the lower button to the inverter, and from the upper button to the relaytrap, then make a ControlDevice link from the inverter to the relaytrap, and from the relaytrap to the lamp.
Ok, let's give the outside window some light as well.
In fact, before we continue, create a Pysical>Lights>Lanterns>Lamppost>Streetlamp in the north-west corner of the courtyard (x:-9.75,y:34.25,z:-1.50). Click on properties and in Renderer>Light set brightness to 120 and radius to 24.
Create an Fnord>Hacklight>Animlightpoint very close to the outside window (x:5.0,y:48.0,z:0.0). Click on properties and in Renderer>AnimLight set Mode to "maximum brightness", set max brightness to 16, set min brightness to 0, and set radius to 4.
As shown on the diagram, make a ControlDevice link from the relaytrap to the light point.
Now, when you switch the lamp in the house on and off, the light in the window also goes on and off!
When you switch the light off and go outside, it can be difficult to find the 'light switch' when you come back in. So let's add some to the entrance!
Clone the first two buttons and move the clones over to the doorway (x:-2). Now link them to the Inverter and the Relaytrap (respectively), just like the first two buttons.
Using this technique, you can add as many 'light switches' as you like.
Finally, let's use a Torch, instead of an electric light, and turn the outside window light on and off in sync with the Torch being extinguished and relit!
First of all, move the Sewerlight to the north wall and delete the ControlDevice link which goes from the Relaytrap to the Animlightpoint.
Now, place a Physical>Lights>Torch on the south wall (where the Sewerlight used to be).
Also create a Tulz>Crystal>WaterCrystal, a Tulz>Crystal>FireCrystal, and a Tulz>Crystal>AirCrystal somewhere in the house.
Click on the Torch, then bring up its properties, and edit Renderer>AnimLight:
For Mode, select "random but coherent".
For millisecs to brighten and millisecs to dim, enter 64.
For max brightness type 80 and for min brightness type 60.
For radius type 16. Click Ok, then Done.
Click on the Animlightpoint, then bring up its properties, and edit Renderer>AnimLight:
For Mode, select "random but coherent".
For millisecs to brighten and millisecs to dim, enter 64.
For max brightness type 18 and for min brightness type 14.
The radius should stay at 4.
The Torch will send an on/off signal whenever it is lit/extinguished, so all that needs doing is to add a ControlDevice link from the Torch to the Animlightpoint.
Now portalise etc., and enjoy the show!
A DarkLoader ready demo showing these techniques can be downloaded from here:
LightsDemoByZaccheus.zip (190KB)
Click on the 'to' object, and remember its id number. Then click on the 'from' object, and click on 'links'. Click on 'Add' and then select ControlDevice (not ~ControlDevice) from the 'Flavour' drop-down box. Also enter the respective id numbers of the 'from' and 'to' objects. Click Ok and Ok again, that's it!