• Please provide a basic technique for adding new weapons to a source mod
    4 replies, posted
I have looked on the valve developer community page, I have downloaded other people mods and played around with all the weapon related files, I have extracted and modified components from the sourcesdk cache but I'm unable to find an easy combination to add a new weapon to a source mod. All I would like to do is understand the process of registering a new weapon (something like a basic modification of a crowbar) so it appears in my weapon selection ingame (as a duplicate or new weapon). There are a lot of obvious documents available that point towards the adding of a new weapon but I have not yet managed to implement the information they provide correcty. e.g [url]http://www.moddb.com/games/half-life-2/tutorials/adding-a-new-weapon[/url] Can someone please articulate information like this on adding new weapons to source mods so myself and anyone else (since I couldn't find this topic for searching) can easily perform this process and do it correctly. Thankyou in advance to anyone who is willing to help.
create a new weapon class (weapon_whatever.cpp) and copy over an existing weapon, renaming the classnames. in c__hl2_weapon_stubs add in the weapon name. add a script file weapon_whateverthenamewas.txt done
Wow, it is really that easy? Thankyou heaps, just one thing to confirm: weapon_whatever.cpp is in client/hl2 weapon_whateverthenamewas is in scripts/ c_weapon__stubs_hl2 is in client/hl2 in my mod and is spelt that way also what is the basic requirements of the contents of c_weapon__stubs, what is the format? mine looks like this: #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_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 ); STUB_WEAPON_CLASS( weapon_slam, Weapon_SLAM, C_BaseHLCombatWeapon ); STUB_WEAPON_CLASS( weapon_crowbar, WeaponCrowbar, C_BaseHLBludgeonWeapon ); STUB_WEAPON_CLASS( weapon_laser, WeaponLaser, C_BaseHLBludgeonWeapon ); is that right? You obviously know what you are doing, it would be of great help if you reply. [editline]15th May 2011[/editline] What I would really like for this is if someone were to provide the directories of a working set of scripts and .cpp files they used to add a weapon to their mod, for example: "This is an example of what I used to add a weapon to my mod: Mymod/client/hl2/weapon_spoon.cpp - This is the .cpp of the weapon itself Mymod/client/hl2/c_weapon__stubs_hl2.cpp - This is the .cpp to define the weapons Mymod/scripts/weapon_spoon - This is the script for the weapon" And perhaps provide some examples of the basics of the contents of the files? Now, the above cant be right because I tried it and got nothing, what am I doing wrong? Thankyou again to anyone who responds (I'm really desperate, I just tried a mod someone else made and the weapons didn't work at all even in the unedited version!)
yeah thats right but.. STUB_WEAPON_CLASS( weapon_laser, WeaponLaser, C_BaseHLBludgeonWeapon ); is WeaponLaser inheriting off Bludgeonweapon or BaseCombatWeapon
It's meant to be a modification of the crowbar, see this is why I need help, I'm getting all the little details wrong.
Sorry, you need to Log In to post a reply to this thread.