Wavelength Logo
tl.jpg (2351 bytes) blank.gif (837 bytes) tr.jpg (2446 bytes)
blank.gif (837 bytes)
Exploding Rounds for the Python by Chris Whitman
blank.gif (837 bytes)
Just add the following in combat.cpp under the traceattack line in the case BULLET_PLAYER_357 statement (About line 1497):

MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, tr.vecEndPos );
WRITE_BYTE( TE_EXPLOSION );
WRITE_COORD( tr.vecEndPos.x );
WRITE_COORD( tr.vecEndPos.y );
WRITE_COORD( tr.vecEndPos.z );
WRITE_SHORT( g_sModelIndexFireball );
WRITE_BYTE( 5 ); // scale
WRITE_BYTE( 15 ); // framerate
WRITE_BYTE( TE_EXPLFLAG_NONE );
MESSAGE_END();

tr is a line representing the path of the bullet, tr.vecEndPos is a vector representing the end of the line (With x,y, and z, as the x,y, and z coordinates of that vector), g_sModelIndexFireball is the ball of flame that appears for the explosion.

So what are MESSAGE_BEGIN and MESSAGE_END? As far as I can tell, these are used to send special messages to the game server. They seem to be used mostly to create temporary effects, like explosions and such. I'm not sure what MSG_PAS means, but I believe it's the recipient of the message. SVC_TEMPENTITY means that we're creating a temporary entity (The explosion effect), and tr.vecEndPos is the position of the effect. The code that follows looks like a packet of byte, float, float, float, short int, byte, byte, byte. The first param is the code for the type of effect. The next three are the effect coordinates, followed by the model that accompanies the effect (The explosion sprite), followed by the scale and framerate of the model, followed by a flag to pass extra miscellanious information about the effect. MESSAGE_END probably sends the packet.

Try changing the values for scale and framerate, or change the model index to either g_sModelIndexWExplosion or g_sModelIndexSmoke.  Actually, you could even set it to g_sModelIndexBloodSpray or g_sModelIndexBubbles, but it might look a little odd. All the available models are defined in weapons.h as externs at line 360, properly defined in weapons.cpp about line 40, and precached (loaded) in weapon.cpp at line 395. You can add your own effects if you want.

 

blank.gif (837 bytes)
bl.jpg (2471 bytes) blank.gif (837 bytes) br.jpg (2132 bytes)