ceriux
Adventurer
anyways the other day i was playing opposing force and i saw it had ropes like hl2.... and i was wondering if thothie can add that in anyway? could help with more puzzles in maps?
128
Reply to: 21
France
#22. Re: Because i was bored
First, the whole system is made in the client side :
void SpriteTracer( vec3_t pos, vec3_t oldpos, int modelindex, float r, float g, float b, float a )
{
BEAM *pTracer = gEngfuncs.pEfxAPI->R_BeamPoints(
pos,
oldpos,
modelindex,
0.1, // life
0.3, // width
0.0, // amplitude
a,
0,
0,
0,
r,
g,
b
);
if( pTracer )
{
//gEngfuncs.Con_Printf( "Okay\n" );
pTracer->flags |= FBEAM_FADEIN;
}
}
That is the main function, it creates a temporary ( with life ) beam beetween the last position and the current position of your defined point ( endpos of a laser traceline for ex. ). Thus, that create each frame a beam that die 0.1 (sec.?) after, then make this tracer effect.
static vec3_t oldpos = end;
SpriteTracer( end, oldpos, LaserSightIndex, 0.7, 0.0, 0.0, 0.3 );
oldpos = end;
Where "end" is your position where you want to draw the tracer. The modelindex is the indexe ( int ) of the precached sprite, you can call him by:
int LaserSightIndex = gEngfuncs.pEventAPI->EV_FindModelIndex( "sprites/laserbeam.spr" );
after precaching it in the server side :
PRECACHE_MODEL( "sprites/laserbeam.spr" );
( this one for the laserbeam.spr is already made in the code ).
Enjoy ;).