Modding Weapons

Faulk_Wulf

Newbie
Joined
Nov 21, 2004
Messages
166
Reaction score
0
So I have hit the Start A New Mod Button. And I have a file full of *.cpp / *.h files. I can tell that this is most if not all the coding for a given item. For the actual properties of the weapon would I have to do anything more then copy and paste "weapon_pistol.cpp / .h" and rename it to "weapon_*.cpp / .h" and change the settings to what I wish?

Any other file I need to modify? (For now I am just going to use the pistol or 357 model.) Any help would be greatly appreciated.

Thank you for your time.
 
Okay okay, so I found something at Valve-ERC. Still have a question:

"Step 4:
Your work on the server side is done. Now open up your client project, and go to the file c_weapon__stubs_hl2.cpp. Add your weapon to the list of stubs, following a similar format as the rest of them."

But my "C_weapon__stubs_hl2.cpp" says the following:

Code:
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//

#include "cbase.h"
#include "c_weapon__stubs.h"
#include "basehlcombatweapon_shared.h"
#include "c_basehlcombatweapon.h"

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"


STUB_WEAPON_CLASS( cycler_weapon, WeaponCycler, C_BaseCombatWeapon );

STUB_WEAPON_CLASS( weapon_binoculars, WeaponBinoculars, C_BaseHLCombatWeapon );
STUB_WEAPON_CLASS( weapon_bugbait, WeaponBugBait, C_BaseHLCombatWeapon );
STUB_WEAPON_CLASS( weapon_crowbar, WeaponCrowbar, C_BaseHLBludgeonWeapon );
STUB_WEAPON_CLASS( weapon_flaregun, Flaregun, C_BaseHLCombatWeapon );
STUB_WEAPON_CLASS( weapon_annabelle, WeaponAnnabelle, C_BaseHLCombatWeapon );
STUB_WEAPON_CLASS( weapon_slam, Weapon_SLAM, C_BaseHLCombatWeapon );
STUB_WEAPON_CLASS( weapon_gauss, WeaponGaussGun, C_BaseHLCombatWeapon );
STUB_WEAPON_CLASS( weapon_cubemap, WeaponCubemap, C_BaseCombatWeapon );
STUB_WEAPON_CLASS( weapon_alyxgun, WeaponAlyxGun, C_HLSelectFireMachineGun );
STUB_WEAPON_CLASS( weapon_citizenpackage, WeaponCitizenPackage, C_BaseHLCombatWeapon );
STUB_WEAPON_CLASS( weapon_citizensuitcase, WeaponCitizenSuitcase, C_WeaponCitizenPackage );


#ifndef HL2MP
STUB_WEAPON_CLASS( weapon_ar2, WeaponAR2, C_HLMachineGun );
STUB_WEAPON_CLASS( weapon_frag, WeaponFrag, C_BaseHLCombatWeapon );
STUB_WEAPON_CLASS( weapon_rpg, WeaponRPG, C_BaseHLCombatWeapon );
STUB_WEAPON_CLASS( weapon_pistol, WeaponPistol, C_BaseHLCombatWeapon );
STUB_WEAPON_CLASS( weapon_shotgun, WeaponShotgun, C_BaseHLCombatWeapon );
STUB_WEAPON_CLASS( weapon_smg1, WeaponSMG1, C_HLSelectFireMachineGun );
STUB_WEAPON_CLASS( weapon_357, Weapon357, C_BaseHLCombatWeapon );
STUB_WEAPON_CLASS( weapon_crossbow, WeaponCrossbow, C_BaseHLCombatWeapon );
#endif

This is in a folder called "hl2_hud", but I couldn't find it in any other folder. So how do I add the new weapon to this list as the instructions said to? (The "new" gun is called "weapon_deagle.cpp")

Thank you.

[EDIT] Also? Where the heck is the ammo defined at?
 
Try STUB_WEAPON_CLASS( weapon_deagle, [whatever you named your class minus the C], C_BaseHLCombatWeapon );

That's following the same design at least.
 
Ah. Thanks. I will try that.

(My ammo Q was about making NEW ammo types, not about where it states the ammo in the weapon itself.)

Also, if I had new models, where would they go? Just make model folder and throw them in there?
 
I want to test this new weapon. But where do I save the map to?

\<mod name>\maps ?
\src\maps ?
\maps\ ?

And come to think of it... Don't I need an FGD? (I can probably console the gun with "give" as per the tutorial.) But what if I want to put one in my map?

Thanks.
 
Don't get ahead of yourself :).

Set the Source SDK Launcher (The steam list) to your mod name then launch hammer. Make your map (a hollowed box with an info_player_start will do). Compile (called run in the file menu) it. Then launch the game using the .bat script in the game folder. type map <yourmapname> to load the map. then give <weaponname> /
 
Faulk_Wulf said:
So I have hit the Start A New Mod Button. And I have a file full of *.cpp / *.h files. I can tell that this is most if not all the coding for a given item. For the actual properties of the weapon would I have to do anything more then copy and paste "weapon_pistol.cpp / .h" and rename it to "weapon_*.cpp / .h" and change the settings to what I wish?

Any other file I need to modify? (For now I am just going to use the pistol or 357 model.) Any help would be greatly appreciated.

Thank you for your time.

For a good article concerning cloning of a weapon,
check this article : http://www.sourcewiki.org/wiki/index.php/Cloning_A_weapon_in_SP_source
 
Thank you. Any other information/suggestions are welcome!
 
Back
Top