Hit Me Twice
Code to be Added or Changed
g_weapon.c
This can all be done in g_weapon.c, located in the game folder of your source. Open up the file and you should see this:
/*
===================
MACHINEGUN
===================
*/
Near the bottom of this call you should see:
if ( traceEnt->takedamage) {
G_Damage( traceEnt, ent, ent, forward, tr.endpos,
damage, 0, MOD_MACHINEGUN);
}
}
Now add another part to it underneath like this:
if ( traceEnt->takedamage) {
G_Damage( traceEnt, ent, ent, forward, tr.endpos,
damage, 0, MOD_MACHINEGUN);
G_Damage( traceEnt, ent, ent, forward, tr.endpos,
damage, 0, MOD_MACHINEGUN);
}
}
What this does is it makes the second bullet we are creating per shot actually hurt the target. Next we will add the bit which actually draws the second bullet. Scroll down till you see this: (it’s near the bottom)
/*
===============
FireWeapon
===============
*/
Then in this function find this:
case WP_MACHINEGUN:
if ( g_gametype.integer != GT_TEAM ) {
Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE );
} else {
Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_TEAM_DAMAGE );
}
break;
And replace it with this:
case WP_MACHINEGUN:
if ( g_gametype.integer != GT_TEAM ) {
Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE );
Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE );
} else {
Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_TEAM_DAMAGE );
Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_TEAM_DAMAGE );
}
break;
Tah dah! Compile it and you’re ready to go. |