Exploding Machine Gun
Bullets - By Unknown
Load up the code,
then open g_weapon.c and scroll down to line
152, it will look like something like this
: if ( traceEnt->takedamage) {
G_Damage( traceEnt, ent, ent, forward,
tr.endpos, damage, 0, MOD_MACHINEGUN);
}
This is the actual health inflicting function call.
Comment this out by placing ' // ' in front of each line, so
it will look like this : // if (
traceEnt->takedamage) { // G_Damage(
traceEnt, ent, ent, forward, tr.endpos, //
damage, 0, MOD_MACHINEGUN); // }
If you compiled
now, you wouldn't get any actual damage, but it would give a
visual (and audio) apperance. So the bullets do their job, the
only difference is that it forgets to inflict damage.
Now we
need to code another way to inflict damage, in a line just
above the previous four write this : G_RadiusDamage (tr.endpos, ent, damage * 1.2,
damage * 3, NULL, MOD_MACHINEGUN);
I'll explain what you
just did :
* You called a radius
damage infliction or the explosion (G_RadiusDamage)
* It's at position 'tr.endpos'
* 'ent' is an
attacker entity (whom to give frags and everything associated
to that)
* then it inflicts
'damage *
1.2' (we need more because acutally explosive
bullets do more damage by nature)
* with explosion radius 'damage * 3'
(again based on my own opinion, play with it and previus one
if you want to)
* then
'NULL'
is an entity whom we won't give any damage, in this case
there's no one, you can specify 'ent' here, so you'll never
die from your own explosive bullets!
* the last one (MOD_MACHINEGUN) is telling what
Method Of Death is used (ex. for obituary messages).
|