From ZDoom Wiki
Jump to navigation Jump to search

bool A_AttachLight (Name lightid, int type, Color lightcolor, int radius1, int radius2 [, int flags [, Vector3 ofs [, double param [, double spoti [, double spoto [, double spotp]]]]]])

Note: this function is not fully supported by DECORATE. If used from DECORATE, all parameters starting from ofs should be omitted. Consider switching to ZScript to fully utilize this function.


Creates and attaches a dynamic light to the calling actor.

Can be removed with A_RemoveLight.


  • lightid: an identifier for the light.
  • type: the type of the light, which can be one of the following:
    • DynamicLight.PointLight - PointLight. Default setting.
    • DynamicLight.PulseLight - PointLightPulse.
    • DynamicLight.FlickerLight - PointLightFlicker.
    • DynamicLight.RandomFlickerLight - PointLightFlickerRandom.
    • DynamicLight.SectorLight - SectorPointLight.
    • DynamicLight.DummyLight - (Need more info)
    • DynamicLight.ColorPulseLight - (Need more info)
    • DynamicLight.ColorFlickerLight - (Need more info)
    • DynamicLight.RandomColorFlickerLight - (Need more info)
  • lightcolor: the color of the light. This can be a color variable or a string name (such as "Red").
  • radius1: the primary radius of the light.
  • radius2: the secondary radius of the light, primarily for lights that flicker or pulse.
  • flags: this can be combined with the '|' separator. Default is 0.
    • DYNAMICLIGHT.LF_SUBTRACTIVE - Light becomes subtractive (darkening effect).
    • DYNAMICLIGHT.LF_ADDITIVE - Light becomes additive, making the colors whiter.
    • DYNAMICLIGHT.LF_DONTLIGHTSELF - Actor does not light itself.
    • DYNAMICLIGHT.LF_ATTENUATE - Light uses the angle attenuation formula, providing more realistic (if slightly dimmer) illumination on angled surfaces.
    • DYNAMICLIGHT.LF_NOSHADOWMAP - Light will not create shadow maps, which are realistic shadows created from map geometry obscuring other surfaces.
    • DYNAMICLIGHT.LF_DONTLIGHTACTORS - Light will not affect other actors.
    • DYNAMICLIGHT.LF_SPOT - Light is a spot light. Spot lights are in cones like a lamp, or a flash light.
    • DYNAMICLIGHT.LF_DONTLIGHTOTHERS - The light will not light other actors, only the actor that it is attached to.
    • DYNAMICLIGHT.LF_DONTLIGHTMAP - The light will not light up the level geometry, only actors.
  • ofs: the offset of the light as a vector. Default is (0, 0, 0).
  • param: if the light is a pulse light, this represents the interval to switch between the two radii in seconds. Otherwise, it is used for flicker lights (between 0 and 1) to represent the chance to be the first radius or the second. Default is 0.
  • spoti: Sets the inner angle of a spot light. Ignored if not a spot light. Default is 10.
  • spoto: Sets the outer angle of a spot light. Default is 25.
  • spotp: Sets the pitch of the spot light. Default is 0. If set to > 90 or < -90, the light will use the pitch of the actor instead.

Return value

Returns true when the dynamic light has been spawned.


Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.

See also