How do you add weapons?

Started by apljee, April 29, 2014, 04:22:56 PM

Previous topic - Next topic

apljee

Title says it all, I'm interested in creating a private mod just to add weapons to the game. Thanks.

Architect

I suggest looking into project armoury to see how they do all their weapon and bullet additions. the fastest way to learn how to mod would be to see how other people have done it before you :P
Check out BetterPower+ and all its derivatives by clicking the picture below.

It adds many new methods of power generation and uses for it, as well as other things such as incidents.


jpwrunyan

If you're looking for a sort of "what are the concepts involved?" answer then it's this:

Every gun requires a ThingDef entry with ParentName="BaseGun" attribute.
To work properly, it will need to be assigned a type of projectile in the projectileDef under verb in the gun entry.

Projectiles are also defined with ThingDef and have ParentName="BaseBullet". All the other parameters are pretty self-explanatory if you look in the Core definition file (Mods/Core/Defs/ThingDefs/Weapons_Guns.xml).

But if you are asking about melee weapons, hmm... probably have to use the same idea as a gun but limit the range to something *very* close with an appropriate sound effect and graphic. As mentioned above, check the suggested mods to see if someone else has already done this. Assuming you get that far, the game will probably still say "fire at Bigglesworth (out of range)" in the interface next to "melee attack Bigglesworth" which would be with your fists and not the cutlass.

I could be totally wrong, though, about how to implement this. And I am also confident that melee weapons are coming in the future.