Load up bg_misc.c and go down to line 373 and add the following.
Code Sample
// OICW PICKUP
{
"pickup_weapon_OICW",
"sound/player/pickup/weapon.wav",
{ "models/weapons/oicw/world/oicwworld.glm",
0, 0, 0},
/* icon */ "gfx/menus/hud/weapon_icons/oicw_icon",
"gfx/menus/weapon_renders/oicw",
"an",
/* pickup */ "OICW",
30,
IT_WEAPON,
WP_OICW,
/* precache */ "",
/* sounds */ "",
OUTFITTING_GROUP_PRIMARY,
},
That code links the WP_ name to the pickup name and is used for placing weapons in radiant as well (go down a few posts to see that part) The Completed code should look similar to this.
Code Sample
"pickup_weapon_AK_74",
"sound/player/pickup/weapon.wav",
{ "models/weapons/ak74/world/ak74world.glm",
0, 0, 0},
/* icon */ "gfx/menus/hud/weapon_icons/ak74_icon",
"gfx/menus/weapon_renders/ak74",
"an",
/* pickup */ "AK74 Assault",
30,
IT_WEAPON,
WP_AK74_ASSAULT_RIFLE,
/* precache */ "",
/* sounds */ "",
OUTFITTING_GROUP_PRIMARY,
},
// OICW PICKUP
{
"pickup_weapon_OICW",
"sound/player/pickup/weapon.wav",
{ "models/weapons/oicw/world/oicwworld.glm",
0, 0, 0},
/* icon */ "gfx/menus/hud/weapon_icons/oicw_icon",
"gfx/menus/weapon_renders/oicw",
"an",
/* pickup */ "OICW",
30,
IT_WEAPON,
WP_OICW,
/* precache */ "",
/* sounds */ "",
OUTFITTING_GROUP_PRIMARY,
},
/*QUAKED pickup_weapon_M60 (0 .6 .6) (-15 -15 -15) (15 15 15)
Machinegun, uses 7.62 rounds
*/
{
"pickup_weapon_M60",
"sound/player/pickup/weapon.wav",
{ "models/weapons/m60/world/m60world.glm",
0, 0, 0},
/* icon */ "gfx/menus/hud/weapon_icons/m60_icon",
"gfx/menus/weapon_renders/m60",
"a",
/* pickup */ "M60 Machinegun",
30,
IT_WEAPON,
WP_M60_MACHINEGUN,
/* precache */ "",
/* sounds */ "",
Save and close bg_misc.c and open up bg_player.c
Go down to line 39 and change
Code Sample
{ MODELINDEX_WEAPON_AK74,MODELINDEX_WEAPON_M4, MODELINDEX_WEAPON_USAS12, MODELINDEX_WEAPON_MSG90A1, MODELINDEX_WEAPON_M60, MODELINDEX_WEAPON_RPG7, MODELINDEX_WEAPON_MM1, -1, -1, -1 },
to this
Code Sample
{ MODELINDEX_WEAPON_AK74, MODELINDEX_WEAPON_M4, MODELINDEX_WEAPON_USAS12, MODELINDEX_WEAPON_MSG90A1, MODELINDEX_WEAPON_M60, MODELINDEX_WEAPON_RPG7, MODELINDEX_WEAPON_MM1, MODELINDEX_WEAPON_OICW, -1, -1 },
Save and close bg_player.c and open up bg_weapons.c
Go down to line 22 and change
Code Sample
"AK74", // WP_AK74_ASSAULT_RIFLE,
"MSG90A1", // WP_MSG90A1_SNIPER_RIFLE,
to
Code Sample
"AK74", // WP_AK74_ASSAULT_RIFLE,
"OICW", // WP_WP_OICW,
"MSG90A1", // WP_MSG90A1_SNIPER_RIFLE,
Save and close bg_weapons.c and open up bg_weapons..h go down to line 76ish and insert the following line
Code Sample
WP_OICW,
it should look like
Code Sample
WP_AK74_ASSAULT_RIFLE,
WP_OICW,
WP_MSG90A1,
Save and close bg_weapons.h and open up inv.h go down to line 64 and insert the following line
Code Sample
MODELINDEX_WEAPON_OICW, //16
It should end up looking similar to this
Code Sample
MODELINDEX_WEAPON_AK74, //15
MODELINDEX_WEAPON_OICW, //16
MODELINDEX_WEAPON_M60, // 16 +1
This is the end of the code changes
Compiling and Running
Once you have made all of the changes and saved all the code run the all.bat which will compile your code and place it in the \base\vm directory in the SDK. Copy all the .qvm files to your mods vm directory e.g. sof2/mymod/vm. Then to run your mod copy the shortcut for sof2 multiplayer and change the line to read similar to this
G:\sof2\SoF2MP.exe +set fs_game mymod +set sv_pure 0
Run this new link and start up a ctf or inf server join the game open up the console and type while the games is loading you should see OICW added to the preaching list
you will have to setup g_availibleweapons. the setting should be like this
0 = disabled
1 = dm / tdm
2 = inf / ctf / elim / dm / tdm
the weapons in order are ...
"M1911A1","US SOCOM","M590","Micro Uzi","M3A1","USAS-12","M4", "AK74","OICW","MSG90A1","M60","MM1",&
;quo
t;RPG7"
the g_availibleweapons setting should be
2222222222211
You will have to restart the map to apply these changes you should then be able to get your brand new OICW .
Credits
?Raven Software for making the game
?Sevensins for his tutorial on compiling the SDK
?My mum for making me cups of tea during development
That’s it. I hope this has shed some light on adding weapons to SOF2. Now get modding and make some really cool mods.
Contact me by either of the following
Email/MSN Messenger : jamesgutt@hotmail.com
IRC : irc.gamesnet.net in #coding
Code Sample
// OICW PICKUP
{
"pickup_weapon_OICW",
"sound/player/pickup/weapon.wav",
{ "models/weapons/oicw/world/oicwworld.glm",
0, 0, 0},
/* icon */ "gfx/menus/hud/weapon_icons/oicw_icon",
"gfx/menus/weapon_renders/oicw",
"an",
/* pickup */ "OICW",
30,
IT_WEAPON,
WP_OICW,
/* precache */ "",
/* sounds */ "",
OUTFITTING_GROUP_PRIMARY,
},
That code links the WP_ name to the pickup name and is used for placing weapons in radiant as well (go down a few posts to see that part) The Completed code should look similar to this.
Code Sample
"pickup_weapon_AK_74",
"sound/player/pickup/weapon.wav",
{ "models/weapons/ak74/world/ak74world.glm",
0, 0, 0},
/* icon */ "gfx/menus/hud/weapon_icons/ak74_icon",
"gfx/menus/weapon_renders/ak74",
"an",
/* pickup */ "AK74 Assault",
30,
IT_WEAPON,
WP_AK74_ASSAULT_RIFLE,
/* precache */ "",
/* sounds */ "",
OUTFITTING_GROUP_PRIMARY,
},
// OICW PICKUP
{
"pickup_weapon_OICW",
"sound/player/pickup/weapon.wav",
{ "models/weapons/oicw/world/oicwworld.glm",
0, 0, 0},
/* icon */ "gfx/menus/hud/weapon_icons/oicw_icon",
"gfx/menus/weapon_renders/oicw",
"an",
/* pickup */ "OICW",
30,
IT_WEAPON,
WP_OICW,
/* precache */ "",
/* sounds */ "",
OUTFITTING_GROUP_PRIMARY,
},
/*QUAKED pickup_weapon_M60 (0 .6 .6) (-15 -15 -15) (15 15 15)
Machinegun, uses 7.62 rounds
*/
{
"pickup_weapon_M60",
"sound/player/pickup/weapon.wav",
{ "models/weapons/m60/world/m60world.glm",
0, 0, 0},
/* icon */ "gfx/menus/hud/weapon_icons/m60_icon",
"gfx/menus/weapon_renders/m60",
"a",
/* pickup */ "M60 Machinegun",
30,
IT_WEAPON,
WP_M60_MACHINEGUN,
/* precache */ "",
/* sounds */ "",
Save and close bg_misc.c and open up bg_player.c
Go down to line 39 and change
Code Sample
{ MODELINDEX_WEAPON_AK74,MODELINDEX_WEAPON_M4, MODELINDEX_WEAPON_USAS12, MODELINDEX_WEAPON_MSG90A1, MODELINDEX_WEAPON_M60, MODELINDEX_WEAPON_RPG7, MODELINDEX_WEAPON_MM1, -1, -1, -1 },
to this
Code Sample
{ MODELINDEX_WEAPON_AK74, MODELINDEX_WEAPON_M4, MODELINDEX_WEAPON_USAS12, MODELINDEX_WEAPON_MSG90A1, MODELINDEX_WEAPON_M60, MODELINDEX_WEAPON_RPG7, MODELINDEX_WEAPON_MM1, MODELINDEX_WEAPON_OICW, -1, -1 },
Save and close bg_player.c and open up bg_weapons.c
Go down to line 22 and change
Code Sample
"AK74", // WP_AK74_ASSAULT_RIFLE,
"MSG90A1", // WP_MSG90A1_SNIPER_RIFLE,
to
Code Sample
"AK74", // WP_AK74_ASSAULT_RIFLE,
"OICW", // WP_WP_OICW,
"MSG90A1", // WP_MSG90A1_SNIPER_RIFLE,
Save and close bg_weapons.c and open up bg_weapons..h go down to line 76ish and insert the following line
Code Sample
WP_OICW,
it should look like
Code Sample
WP_AK74_ASSAULT_RIFLE,
WP_OICW,
WP_MSG90A1,
Save and close bg_weapons.h and open up inv.h go down to line 64 and insert the following line
Code Sample
MODELINDEX_WEAPON_OICW, //16
It should end up looking similar to this
Code Sample
MODELINDEX_WEAPON_AK74, //15
MODELINDEX_WEAPON_OICW, //16
MODELINDEX_WEAPON_M60, // 16 +1
This is the end of the code changes
Compiling and Running
Once you have made all of the changes and saved all the code run the all.bat which will compile your code and place it in the \base\vm directory in the SDK. Copy all the .qvm files to your mods vm directory e.g. sof2/mymod/vm. Then to run your mod copy the shortcut for sof2 multiplayer and change the line to read similar to this
G:\sof2\SoF2MP.exe +set fs_game mymod +set sv_pure 0
Run this new link and start up a ctf or inf server join the game open up the console and type while the games is loading you should see OICW added to the preaching list
you will have to setup g_availibleweapons. the setting should be like this
0 = disabled
1 = dm / tdm
2 = inf / ctf / elim / dm / tdm
the weapons in order are ...
"M1911A1","US SOCOM","M590","Micro Uzi","M3A1","USAS-12","M4", "AK74","OICW","MSG90A1","M60","MM1",&
;quo
t;RPG7"
the g_availibleweapons setting should be
2222222222211
You will have to restart the map to apply these changes you should then be able to get your brand new OICW .
Credits
?Raven Software for making the game
?Sevensins for his tutorial on compiling the SDK
?My mum for making me cups of tea during development
That’s it. I hope this has shed some light on adding weapons to SOF2. Now get modding and make some really cool mods.
Contact me by either of the following
Email/MSN Messenger : jamesgutt@hotmail.com
IRC : irc.gamesnet.net in #coding
Code Sample
/*QUAKED pickup_weapon_OICW (0 .6 .6) (-15 -15 -15) (15 15 15)
OICW, uses bullets
*/