A_AttachLightDef

bool A_AttachLightDef (Name lightid, Name lightdef)

Usage

Attaches a dynamic light defined in GLDEFS to the calling actor.

Contrast to A_AttachLight which allows you to define, finely tune and control the light spawned, this function can be useful if you have a pre-existing definition you want to reuse multiple times.

Can be removed with A_RemoveLight.

Parameters

  • lightid: an identifier for the light.
  • lightdef: the dynamic light to attach, as defined in GLDEFS.

Return value

(Need more info)

Examples

// GLDEFS
flickerlight2 FLAMETHROWER_LIGHT_ATTACH
{
    color 1.0 0.6 0.0
    size 80
    secondarySize 96
    interval 1
    offset 0 40 0
}

// ZScript
...
States
{
Ready:
    // Call this before the loop
    FLMG A 0 Bright A_AttachLightDef('FlamethrowerLight', 'FLAMETHROWER_LIGHT_ATTACH');
    FLMG ABCD 2 Bright A_WeaponReady;
    // I call this beforehand... don't know if it's necessary
    FLMG D 0 Bright A_RemoveLight('FlamethrowerLight');
    Loop;

Deselect:
    // Remove the light when deselecting the weapon
    FLMG H 0 A_RemoveLight('FlamethrowerLight');
    FLMG HGFE 1 A_Lower;
    Wait;

Fire:
    // Remove the light when firing (other lights can be attached here too)
    FLMG B 0 Bright A_RemoveLight('FlamethrowerLight');
    ...
}

See also

This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.