|
: please
can some one help i would like add new weapons to my mod i added the bfg suit
Ooo, finally a question I can help with, as I've been adding tons of new
weapons to my mod. Adding a weapon is fairly simple, code-wise. First, you'll
need to have two models you want to use for the weapon (with corresponding
skins): one for when the weapon is "loose" in the world, and one
for the weapon the player sees when (s)he's holding it. You'll also need to
know, for the second one, which frames are for normal pauseness, and which
frames are for firing.
Assuming you have all
that non-coding stuff done, or you can at least copy the models/stuff from
another weapon for the time being, here's how to add a new weapon called the
Death Ray:
1. open g_local.h, and
find line 203 where it reads,
#define WEAP_BLASTER 1
add a line reading
#define WEAP_DEATHRAY 12
to the list. In the same
way, add a line defining a new MOD_DEATHRAY at the end of the list starting
with MOD_BLASTER, or else killing someone with the deathray will result in a
boring "Thp died".
2. open g_items.c, and near the top there's a listing of function prototypes,
starting with Weapon_Blaster(edict_t *ent); and ending with
Weapon_BFG(edict_t *ent);. Add a prototype underneath that,
Weapon_DeathRay(edict_t *ent);
3. scroll down to the loooong array of gitem_ts, and find where there's an
entry with the first string listed as "weapon_railgun". copy the
whole entry, and put it in some convenient spot in the list (I prefer to put
it right after weapon_bfg, so that all the weapons are together, etc.
4. change the duplicate so that the first string reads
"weapon_deathray". (to insert the death ray into a custom map, use
the classname "weapon_deathray" now)
5. Some other changes need to be made to the deathray entry. change
"Weapon_Railgun" to "Weapon_DeathRay".
6. Change the two strings beginning with "models/" to the models
you have in your pakfile. I'm leaving them the same, because I'm too lazy to
change them for this tutorial thingy.
7. change "Railgun" to "Death Ray". (this is the name
used to refer to the item, and what the player will see when he picks up the
item)
8. Where the railgun says "Slugs", change that string to the name
of the ammo you want the Death Ray to use. I felt like making it use Cells.
Also, change the numebr right before that to the amount of ammo per shot. (I
used 10 per shot)
8. 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.
---------------------
Not very helpful, but I'm in a hurry. I'll come back later and clarify a
little.
-- Thp
|