Add new weapon

Get technical support about the C++ source code and about Lua scripts for maps, entities, GUIs, the console, materials, etc. Also covered are the Cafu libraries and APIs, as well as compiling, linking, and the build system.
Sebapugliese
Posts: 5
Joined: 2012-02-01, 21:36

Add new weapon

Postby Sebapugliese » 2012-02-03, 15:08

Hello it`s my Sebastian.
I want to add a new model of weapon, as I do???. I've seen a bit of code and my attention weapon.cpp file, this is a template file to integrate a new weapon???, Or are the files "cw_weapon_name.cpp" and files "weapon_weapon_name.cpp" which would be amended to add a new model of weapon, the weapon slot that handles file. Thanks for your help
User avatar
Carsten
Site Admin
Posts: 2143
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Add new weapon

Postby Carsten » 2012-02-05, 19:52

Hi Sebastian,

well, adding a new weapon requires adding both the "world model", which is what you see in the levels before you walk over it to pick it up, as well as adding anything that is needed when the player is actively carrying the weapon.

I suggest you look at the source code of an existing weapon as an example, which should give you a good and detailed idea about adding your own.

For example, for the shotgun, in Games/DeathMatch/Code, look at:

Constants_WeaponSlots.hpp
cw_Shotgun.hpp
cw_Shotgun.cpp
GameImpl.cpp
HumanPlayer.cpp
WeaponShotgun.hpp
WeaponShotgun.cpp


(Search these files for the term "shotgun" to find the relevant lines of code.)
Best regards,
Carsten

Return to “Coding and Scripting”

Who is online

Users browsing this forum: No registered users and 1 guest