A_AttachLightDef
Jump to navigation
Jump to search
native bool A_AttachLightDef (Name lightid, Name lightdef)
Usage
Attaches a dynamic light defined in GLDEFS to the calling actor. In contrast to A_AttachLight, which allows you to fully define and control the light at spawn, this function spawns a specific predefined light.
Can be removed with A_RemoveLight.
Parameters
- Name lightid
- An identifier for the light. Can be any name. If a new light is created with the same id, it'll replace the old one.
- Name lightdef
- The dynamic light to attach, as defined in GLDEFS.
Return value
Returns true
when the dynamic light has been spawned. If the specified lightdef doesn't exist, returns false
instead.
Examples
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]];
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');
...
}