light_spot

Modified

12-Jul-2023

This works as light does, except that the emitted light will be limited to a cone. You can customize cone size and brightness. Perfect for searchlight, car lights, streetlights etc. It's more atmospheric than point light, however areas inside of the cone won't be illuminated enough (higher '-bounce' hlrad compile parameter values may increase brightness outside the light_spot a bit).

Keyvalues


OnDestroy Function ondestroyfn : Name of the function to use from already parsed .as script files when entity is destroyed (killed) in any way. If the function belongs to namespace, you must use prefix with the namespace name (e.g. mynamespace::MyFunction) for the keyvalue.

Name targetname : Set name of light_spot so other entities can trigger it to turn light on and off. Depending on trigger use-type: 'On'- turn light on, 'Off'- turn light off, 'Toggle'- toggle light. Kill-targeting this entity will remove light_spot but won't remove lightstyles (you might want to just turn it off instead).

Target target : The name of an entity in the map that the spotlight will point at (preferably info_null). This will override the spotlight's angles.

Pitch Yaw Roll (X Y Z) angles : Where Z means Y and Y means Z, that is, when you're thinking Hammer-grid. (Hammer uses Z for height and Y for depth, while every other sane 3D-application does this the other way round; nonetheless this keyvalue description has the letters in the conventional order) This, technically, is a 3D-vector containing Euler-angles to describe either the entity's rotation or direction of effect. E.g. a func_door_rotating will use this as its initial rotation, while a trigger_push will keep its original alignment and use this for the direction of its push-effect instead. Euler-angles are a hierarchical system to determine an object's orientation in 3D-space. A yaw-value of 0 would mean the entity would face east. (right in top-down view) 90 would mean it would face north. (up in top-down-view) After yaw, pitch is applied. Think aiming up/down with your character in first person. At last, the roll-value is applied. Think your character falling over sideways in first person. Some entities, mostly point entities, do not use the angles keyvalue for any purpose.

ZHLT Light Fade _fade : Controls light travel distance. You can either make light shorter (higher values above 1.0) or longer (smaller values approaching 0.0). The default value is 1.0.

ZHLT Light Falloff _falloff : This option can change the normal inverse square falloff of lighting in the direct lighting layer with inverse falloff.

  • 0 : Default
  • 1 : Inverse Linear
  • 2 : Inverse Square

Inner (bright) angle _cone : The angle, in inches, in which cone is full-lit. It works separately from outer angle, so you can use either both or one of those keyvalues.

Outer (fading) angle _cone2 : The angle, in inches, in which cone is fading out (outside of inner angle). It works separately from inner angle, so you can use either both or one of those keyvalues.

Pitch pitch : Pitch determines direction of the light, '0' is horizontal, '90' is vertical from top, '-90' is vertical from bottom. You can use info_target as a light target instead.

Brightness _light : Red, green and blue amounts of the light color, from 0 to 255, followed by the brightness, which can have pretty much any value greater than 0. It is not limited to 200 or 255 and can be a decimal, although that level of precision is rarely required.

Is Sky _sky : Makes light_spot simulates light_environment, it will emit light from all sky textures. It's useful for dark maps, models will be displayed correctly within light and light_spot entities, in normal light_environment all model lightning are generated from sky, and point/spot lights are ignored.

  • 0 : No
  • 1 : Yes

Appearance style : Allows you to select a light style. This will only work when a targetname is NOT set. Note that there can be at most 4 different light styles affecting a face in your map. Otherwise, light styles will be discarded from it, causing unrealistic lighting in extreme cases.

  • 0 : Normal
  • 10 : Fluorescent flicker
  • 2 : Slow, strong pulse
  • 11 : Slow pulse, noblack
  • 5 : Gentle pulse
  • 1 : Flicker A
  • 6 : Flicker B
  • 3 : Candle A
  • 7 : Candle B
  • 8 : Candle C
  • 4 : Fast strobe
  • 9 : Slow strobe

Custom Appearance pattern : Allows you to set up a custom appearance of unnamed light. To do this, you will have to enter 1 to 64 chars from the alphabet ('a' to 'z'), whereas 'a' stands for being dark and 'z' for very bright. Normal lights' appearances uses 'm'. The program Custom Lightstyle Generator by Craig "CRAZG" McLaren might help you here. Whatever sequence you enter is stepped through at about 8 Hertz. This will only work when a targetname is set. Note that there can be at most 4 different light styles affecting a face in your map. Otherwise, light styles will be discarded from it, causing unrealistic lighting in extreme cases.

Flags


  • 1 : Initially dark : If set, the light will be turned off at map start. This will only work when a targetname is set. This counts as an additional lightstyle. If you have multiple lights by the same name, they will count as one additional lightstyle, even if some of the lights are initially dark while others are not. Note that there can be at most 4 different light styles affecting a face in your map. Otherwise, light styles will be discarded from it, causing unrealistic lighting in extreme cases.