
Posted
by Thp (12.79.114.*) on April
29, 2000 at 15:01:21:
In reply to: A
Brief History of How to Add Weapons posted by Thp (12.79.122.*) on April 29,
2000 at 09:29:31
|
: 9.
Change the MOD_RAILGUN to MOD_DEATHRAY, and copy the Weapon_Railgun function
in p_weapon.c, along with its related functions, change all
"Railgun" to "DeathRay", and modify the functions to your
heart's content. Okay, I'm back. Lemme
clarify. 9a. change MOD_RAILGUN to
MOD_DEATHRAY. Open p_client.c, search through to where it reads "case
MOD_RAILGUN:". add another entry like thus: case MOD_DEATHRAY:
to read
Also change the call to
"fire_rail" to call a function named "fire_deathray". 9c. Open g_weapon.c now,
and add a function thusly to the end of it:
// ... // Insert your code
to fire the weapon here. // ... }
Essentially, try to copy
as much code as you can from the original Q2 weapons, because they're
well-written and tested, then just change the parts you want to alter. An example: In my mod,
the Death Ray is a different-skinned railgun, and has a slightly different
behavior in which it fires a random number of beams in a shotgun-like spread
that do a very high *total* damage. The fire_deathray function simply chooses
a random number of rays, then divides the "damage" value by that
number. Then it loops through a block which is essentially the same as
fire_rail that many times, so the sum total of all the damage delivered is
300. I copied the bulk of the code from the railgun, and modified only the
effects and control. : -- Thp |