User Tools

Site Tools


dromed:windowlights

On/Off Window Lights with Matching Texture

:T2:

Introduction

It’s common to use a HackLight object (e.g. an OmniLightPoint) to illuminate a window texture. If the player can get inside the building and turn the lights off, it’s a nice touch if the window lights respond accordingly. It also adds to realism if the window texture changes. Even if the player cannot get inside, it can be a nice effect if some lights change during the game.

These lights can also be controlled by the difficulty setting, so an narrow street can be made easier to sneak through on lower difficulty levels.

This tutorial is only relevant if your window texture has an ‘on’ and and ‘off’ version. Most of the window textures in the city family meet this requirement.

Step 1: Set up the window texture

Place a window texture on a wall. Recessing it by 0.5 or 1 foot will allow the surrounding wall to cast a useful shadow.

For this tutorial, city\win324l will be used. It’s ‘off’ counterpart (city\win324) must also be loaded.

Step 2: Let there be AnimLight

Create an AnimLightPoint. The default Anim Light property is suitable for this tutorial. Note that the minimum brightness is not 0. The AnimLight script will turn it off properly however.

Step 3: Texture Change

To the AnimLightPoint object, add the S→Scripts property. Replace AnimLight with TrapTexture and leave Don’t Inherit unchecked.

These properties are also needed (follow the links for more info):

Step 4: Control the AnimLightPoint

Switch

Electric lights will be controlled by a switch. Edit the Tweq→JointState property to use the following values:

  • AnimS: On
  • Joint1AnimS: On

Give the lever a ControlDevice link to the AnimLightPoint (plus the interior lights of course).

Torch

If the inside is lit by a torch, give the torch a ControlDevice link to the AnimLightPoint. No further setup is needed. Torches already send TurnOn/TurnOff when appropriate.

Difficulty

Edit the properties of the AnimLightPoint and add the property Difficulty→Turn On (Off). Select the levels for which the window should illuminated.

Lights off when mission starts

Switch

If the lights are controlled by a lever, edit the Tweq→JointState property. AnimS should be On,Reverse, and if necessary, remove the ‘On’ selection from Joint1AnimS. This setting allows the AnimLightPoint to use the Random but coherent mode.

In Dromed, it doesn’t matter if your window is using the ‘off’ or the ‘on’ texture.

Torch

If the torch uses the default Anim Light mode of maximum brightness, simply change it to minimum brightness (or zero brightness). It’ll send TurnOff to the AnimLightPoint when the game starts.

If the mode is random but coherent, add the property Difficulty→Turn On (Off), but don’t select any numbers. The torch will only turn off when you activate difficulty settings, or test through Thief2.exe.

NOTEME If you test the difficulty using Dromed, be very careful if you’ve also used the Difficulty → Destroy property. See the link for more info.

Alternatively, if you don’t mind using an extra object, set up a switch as described above, but give it a ControlDevice link to the torch rather than the AnimLightPoint.

Strange Things

Assuming the lights are on when the game starts, go into game mode, turn them off, then return to the editor. The 3D view will now show the ‘off’ texture, but if you select the face, Dromed will show that it is still using the ‘on’ texture. The latter is correct.

You can go back in game, turn the lights off and then on, and when you return to editor mode, the 3D view will show the correct texture again. Or you can Portalize/Optimize, or reload the mission.

  • I had such a set up in the first mission of Stones and Glass Houses. A group of window lights were turned on after some event, but there was no way of turning them off. I was often testing this event because it was quite complicated, but I didn’t like having the wrong window textures on this building. I edited one of the window light objects to have a phys model, and a receptron for SlashStim. When I hit it with my sword, it would send a TurnOff to the window lights, thus correcting the texture.
dromed/windowlights.txt · Last modified: 2015/07/22 18:45 by r_soul