Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

lightstyle

From Quake Wiki

void lightstyle(float layer, string sequence)

Usage[edit]

Changes the current lighting sequence on the passed light layer. Any lights using that layer will have their lighting changed, so unique layers should be used for decoupled lights. 0 is the default light layer for most lights, so it's usually best to avoid changing this one.

Parameters[edit]

  • layer
The light layer to modify. This can be a value from 0 to 63. Layers 32 to 62 are used for toggleable lights.
  • sequence
The lighting sequence to apply. This must be a character from "a" to "z". "a" is minimum brightness while "z" is maximum brightness. "m" is considered normal lighting. By combining multiple characters an animation sequence can be made for the lights. This animates at 10 FPS meaning a sequence of "abcdefghijkm" will go from pitch dark to normal lighting in 1.1 seconds. This loops infinitely so care should be taken into what the light does after reaching the end of the sequence.

Example[edit]

// This function toggles a light on and off
void UseLight()
{
    if (self.spawnflags & LIGHT_OFF)
    {
        lightstyle(self.style, "m");
        self.spawnflags &= ~LIGHT_OFF;
    }
    else
    {
        lightstyle(self.style, "a");
        self.spawnflags |=  LIGHT_OFF;
    }
}