Skip to content

TE_BEAMFOLLOW

wootguy edited this page Nov 29, 2025 · 4 revisions

A beam trail that follows a moving entity. The trail will kill itself if the entity is stopped and doesn't start moving within 1 second, or if the beam catches up with itself after the entity has stopped moving.

Parameters

Type Name Description
CBaseEntity* target Entity target for the beam to follow
const char* sprite Sprite used to display the beam
uint8_t life Time before the trail fades out (seconds * 0.1)
uint8_t width Width of the beam (units * 0.1)
RGBA c RGBA and brightness of the beam

Example Usage

void te_trail(CBaseEntity* target, const char* sprite="sprites/laserbeam.spr", 
    uint8_t life=100, uint8_t width=2, RGBA c=PURPLE,
    int msgType=MSG_BROADCAST, edict_t* dest=NULL)
{
    MESSAGE_BEGIN(msgType, SVC_TEMPENTITY, dest);
    WRITE_BYTE(TE_BEAMFOLLOW);
    WRITE_SHORT(target->entindex());
    WRITE_SHORT(MODEL_INDEX(sprite));
    WRITE_BYTE(life);
    WRITE_BYTE(width);
    WRITE_BYTE(c.r);
    WRITE_BYTE(c.g);
    WRITE_BYTE(c.b);
    WRITE_BYTE(c.a);
    MESSAGE_END();
}

Clone this wiki locally