Skip to content

TE_USERTRACER

wootguy edited this page Nov 29, 2025 · 4 revisions

Shoots a customizable bullet tracer.

Due to the low precision of the life parameter, the tracer distance is much less accurate than TE_TRACER.

Parameters

Type Name Description
Vector pos Center point for the effect
Vector dir Direction of the tracer
float speed Initial tracer speed. The default speed is 6000
uint8_t RGBA Tracer RGBA (index in [Engine Pallete #2](Temporary-Entities#engine-pallete-2)). Only values 0-12 are allowed. The default RGBA index is 4.
uint8_t life Time to display tracer (seconds * 0.1)
uint8_t length Tracer sprite length

Example Usage

void te_usertracer(Vector pos, Vector dir, float speed=6000.0f, 
    uint8_t life=32, uint RGBA=4, uint8_t length=12,
    int msgType=MSG_BROADCAST, edict_t* dest=NULL)
{
    Vector velocity = dir*speed;
    MESSAGE_BEGIN(msgType, SVC_TEMPENTITY, dest);
    WRITE_BYTE(TE_USERTRACER);
    WRITE_COORD(pos.x);
    WRITE_COORD(pos.y);
    WRITE_COORD(pos.z);
    WRITE_COORD(velocity.x);
    WRITE_COORD(velocity.y);
    WRITE_COORD(velocity.z);
    WRITE_BYTE(life);
    WRITE_BYTE(RGBA);
    WRITE_BYTE(length);
    MESSAGE_END();
}

Clone this wiki locally