Lights & Torches

Lights & Torches

Classnames: light, light_gem, light_torch_castle/rome/egypt/meso
light_flame_large_yellow/small_yellow,
light_torch_small_walltorch
PoP: light_burner, light_candle, light_lanten
light_newfire, light_palace_torch
Purpose: y°hî ?ôr!
H2 Code: lights.hc, torch.hc
Lots of different types & styles, but their behaviour seems to be pretty much the same. In particular, they can be shot out, or switched on and off, and lamps and torches (lights with models) can be linked to simple lights (with no model) by giving them the same style-value; when a light goes on or off, all those with the same style-value do likewise (however, I find the behavior of switchable lights to be fairly confusing, and seem to spend a lot of time trying to get this section of the Eye right ... it probably still isn't, quite).

Lights can also be used as spotlights, and the light_gem can be usefully used with 3D angles (to put it on the ceiling, or a sloping wall, for example; y-axis points West).

In the MP, but not in original H2, some of the lights can take a HURT spawnflag and then damage things that touch them, amount determined by the dmg key.

Fields

light Value is a number, the light-level, default = 300 (pretty dim), max = 800.
style One of these numbers: Other useful values not known to me.
health Value is a number; specify it and the light can be destroyed. style must be between 32 and 63, and there must also be a targetname value, which needn't connect to anything (if it does, the light will probably be able to be switched on and off, as well as destroyed).
targetname If this is targetted by a button, etc, it will toggle the light between on and off. Light starts on unless spawnflags is set as 1, in which case it starts off.
style Value is a number, used for controlling changing in light-level:
  • 0 - default, OK for switching & shooting out.
  • 1 - fast slight flicker
  • 2 - longer steady fade in & out
  • 3 - erratic fade & flicker
  • 32-63 - shooting, switching, linking banks of lights.
If a triggerring entity (such a button) and a targetted light share the same style-value, and this is between 33 and 63, then all further lights sharing this value turn on or off together. Not appropriate for torches & other visible lights, however, since style-linked torches don't shift to their off-skins. But works for invisible lights linked to a torch.
fadespeed Value is a number, controls speed of change in light-level. Seems a bit flakey in its operation, especially on first toggle. In fact, I still haven't figured out how to make it function in a reliable and reproducible manner.
target Value is a name, targeting an info_null entity that the light is aimed at as a spotlight. Incompatible with angle.
dmg Value is a number, damage done to player when touching. Only works in MP for some kinds of lights, which are, I believe:
  • light_flame_large/small_yellow
  • light_torch_small_walltorch
  • light_newfire
  • light_burner
  • light_palace_torch
The default is .2; 5 seems a bit more realistic, to me!.
spawnflags
  • 1 START_LO light starts at its low value.
  • 2 HURT damages what touches; MP only, some light entities

Example

Suppose we have a button whose target value is t1, and a light_torch_castle with t1 as its targetname-value:

light:
classname light
light_torch_castle 400
health 10
targetname t1
spawnflags 1
button:
classname button
targetname t1

Then you push the button to turn the light on, but then you can smash it out or push the button again to turn it off (of course the button would probably need additional fields such as angle in order to fit into the level right). To link further light entities to the torch (since H2 lights fade rapidly with distance), add a style-field to the torch, with a value between 32 and 63, and share it with the lights.


Back to the list.