Weapon
Updated for version 3.38. Thanks Pawcio for pretty much all of this info. This info here is mostly based of his template.
This page is missing some information.
You should read this to understand some things about the XML files in BeardLib.
Module Definition
The module is inherited from ItemModuleBase. So base parameters can be found there.
This modules let's you add weapons.
Module name
The name of the module you use as the meta of the module definition is 'WeaponMod' or 'WeaponModModule' if _force_search
is set to true in the module definition.
XML Structure
Many values are optional if their based on weapon already defines them and you don't wish to change them.
<weapon id ...>
<weapon id ...>
id
String
Unique ID of weapon
name_id
String
desc_id
String
Optional localization ID for the description of the gun. Defaults to bm_w_id
_desc
unlock_level
Number
Required reputation level to unlock
based_on
String
ID of weapon base that the custom weapon will be based on
weapon_hold
String
Optional parameter that is only needed if custom weapon is using incorrect hold animation - In most cases ID is same as used in based_on
global_value
String
texture_bundle_folder
String
Folder to contain the icon. The path will be guis/dlcs/texture_bundle_folder
/textures/pd2/mods/icons/weapons/id
. Defaults to "mods"
animations
Table
A table of animation group used by custom weapon:
CLIP_AMMO_MAX
Number
Rounds in magazine/etc
NR_CLIPS_MAX
Number
How many magazines/etc that weapon can have. Note: Both CLIP_AMMO_MAX and NR_CLIPS_MAX are used to calculate total ammo of weapon in this case: 30 * 5 = 150 total ammo
ammo_pickup
Number
Optional index used for ammo pickup that defines how min and max values for ammo pickup are calculated. The indices:As we said, this is optional and you can pretty much use the based on's AMMO_PICKUP.
AMMO_PICKUP
Table
Optional value if you want to set the AMMO_PICKUP manually without using premade indices. The table needs to have 2 values in the 1st index the low number and in 2nd the high
muzzleflash
String
Optional in-game path to muzzle flash effect
muzzleflash_silenced
String
Optional in-game path to muzzle flash effect when suppressor is attached
shell_ejection
String
Optional in-game path to effect used for ejecting cases
categories
Table
Optional ategories that weapons will be present this also has effect on player weapon skills. This can be assault_rifle
, smg
, shotgun
, pistol
, lmg
, snp
, grande_launcher
, revolver
, akimbo
, saw
, flamethrower
, bow
, crossbow
. Akimbos use both their original category and akimbo
, and rpgs use grenade_launcher
. This is optional of course if the based on weapon already defined them.
stats
Table
Unique stats of custom weapon. Available stats parameters and values:
damage
Base damage of weapon. Max value should be no more than 180 (Damage can be increased further by using "stats_modifiers")
spread
Base accuracy of weapon. 1 value = 4 accuracy - Game calculate it using: Value4-4 = accuracy in-game. Example - 17 value = 174-4=64 accuracy.
spread_moving
NOT USED BY GAME (But just in case use same value as for "spread")
recoil
Base stability of weapon 1 value = 4 stability - Game calculate it using: Value4-4 = stability in-game. Example - 16 value = 164-4=60 stability.
zoom
Base zoom value used when aiming down sights.
concealment
Base concealment of weapon.
suppression
Base suppression value.
use_data
Table
Has a value named selection_index
Inventory slot of weapon: 1 - Secondary 2 - Primary
fire_mode_data
Table
Has a value named fire_rate
Fire rate value: Fire rate in 60 / RPM = Value. Example 60 / 800 RPM = 0.075
stats_modifiers
Table
Has a value named damage
Modifier that will multiply damage by value. Note: This modifier also applies to attachments.
sounds
Table
animations
Table
Has a value named reload_name_id
ID of reload animation
And any other value from WeaponTweakData. There are more that are not listed here yet
<factory id ...>
<factory id ...>
Holds more data for the weapon.
id
String
Unique factory ID of weapon. Defaults to wpn_fps_id
of <weapon>
unit
String
Optional path to weapon base unit. Leave empty to use the based on's unit
stock_adapter
String
Optional parameter only needed if weapon will be using AR-15 Stocks. ID = Attachment that use "stock_adapter" type and will be added to connect weapon model with AR-15 stock models.
animations
Table
Some weapons bases use own animations table if custom weapon is missing animations check if chosen base has animations table in the weaponfactorytweakdata script.
optional_types
Table
adds
Table
Adds additional attachments to specific attachment - like rails for sights or gadgets. Contains tables that have their meta as weapon mod ids and inside of these tables are the parts you want to add when using that part
override
Table
Allows to override data of attachments used by weapon. Contains tables that have their meta as weapon mod ids and the values of the table contains any data of a weapon mod you wish to change like unit
, a_obj
,etc
default_blueprint
Table
List of attachments IDs (all in a value_node) the weapon has by default. Any changes to this list require to sell old gun and repurchase it
uses_parts
Table
IDs of the parts that the gun uses. You must also include the default_blueprint parts!
skip_thq_parts
Boolean
Used only for NPC bows
*These are all of the values for factory
<stance/>
<stance/>
Data for the "stance" of the weapon or basically where the guns is on the screen or how much rotated it is. There's one for standing (standard), aiming (steelsight), crouching(crouched), and bipod. The module will inherit the stance of the based on weapon regardless. Example of modifying the stance:
You can get the values for position (vector3) and rotation (Rotation) using a mod called PVM Using that mod you can pretty much change the stance to your liking.
The icon
The icon will be stored in guis/dlcs/mods/textures/pd2/blackmarket/icons/weapons and will be named id
.texture then add it using AddFiles.
Template
Since this template is more complex and requires other modules (other than the usual AddFiles, Localization) You pretty much should depend on the template. Download template here
Last updated