Skip to content

TE_ELIGHT

wootguy edited this page Nov 29, 2025 · 4 revisions

A spherical dynamic light that fades over time and only affects point entities. This appears to be the same effect used with the EF_MUZZLEFLASH effect (seen with the gauss gun primary fire).

I can't figure out how to set up the light properly. It just looks like crap no matter what I try.

Parameters

Type Name Description
Vector pos Center point for the effect
float radius Radius of the light sphere
RGBA c Light RGBA
uint8_t life Time to display the light (seconds * 0.1)
float decayRate Light fade speed

Example Usage

void te_elight(CBaseEntity* target, Vector pos, float radius=1024.0f, 
    RGBA c=PURPLE, uint8_t life=16, float decayRate=2000.0f, 
    int msgType=MSG_BROADCAST, edict_t* dest=NULL)
{
    MESSAGE_BEGIN(msgType, SVC_TEMPENTITY, dest);
    WRITE_BYTE(TE_ELIGHT);
    WRITE_SHORT(target->entindex());
    WRITE_COORD(pos.x);
    WRITE_COORD(pos.y);
    WRITE_COORD(pos.z);
    WRITE_COORD(radius);
    WRITE_BYTE(c.r);
    WRITE_BYTE(c.g);
    WRITE_BYTE(c.b);
    WRITE_BYTE(life);
    WRITE_COORD(decayRate);
    MESSAGE_END();
}

Clone this wiki locally