TFE Weapon Data

From DF21 Wiki
Revision as of 05:36, 16 February 2025 by Jerethk (talk | contribs)

Weapon data has been externalised to a JSON file in The Force Engine. The data is located in ExternalData\DarkForces\weapons.json.

Altering the data in weapons.json will alter the way that weapons behave. If the JSON file is removed, renamed or corrupted, weapons will not work correctly. (In this case, an error message will be logged.)

Note that all text in the JSON is case insensitive (uppercase, lowercase or a mixture may be used). The weapons and their properties can be listed in any order.

Mods

A customised version of weapons.json can be included in a mod's ZIP file. A modded weapons.json will take precedence over the base version.

Modded versions of weapons.json need to include definitions for all 10 of the weapons plus the gasmask. If any weapon definitions are missing, they will not work when the game is played.

Note about offsets

xPos and yPos offsets are based on a screen with width 320 pixels and height 200 pixels.

Gasmask

The JSON also contains data for the gasmask.

texture The texture (BM) to use for the gasmask.
xPos X (horizontal) offset on the screen.
yPos Y (vertical) offset on the screen.

Weapon data

Property Type Description
frameCount number (integer) Number of animation textures
textures array of string Texture names. Number of entries should match frameCount
xPos array of integers X offsets for each texture. Number of entries should match frameCount
yPos array of integers Y offsets for each texture. Number of entries should match frameCount
wakeupRange number (integer) Enemies within this range (in DF units) will be alerted when the weapon fires
variation number (integer) Aim variability. A higher number will cause the weapon to "spray" more randomly; lower numbers give greater consistency of aim.
ammo string Type of main ammo used by the weapon. The count is shown as the large red numbers in the HUD. Options are ammoEnergy, ammoPower, ammoDetonator, ammoShell, ammoMine, ammoPlasma, ammoMissile
secondaryAmmo string Secondary ammo for the Assault Cannon. Same options as above. This ammo count displays as the smaller green numbers on HUD.
primaryFireConsumption number (integer) Amount of ammo consumed per primary fire shot.
secondaryFireConsumption number (integer) Amount of ammo consumed per secondary fire shot.