TFE Weapon Data: Difference between revisions

From DF21 Wiki
(Start page)
 
No edit summary
Line 23: Line 23:
|-
|-
| yPos || Y (vertical) offset on the screen.
| yPos || Y (vertical) offset on the screen.
|}
=== Weapon data ===
{| border=1 cellpadding=6px
|-
! 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; lower numbers give greater consistency of aim.
|-
| ammo || string || Type of main ammo used by the weapon. Options are <code>ammoEnergy</code>, <code>ammoPower</code>, <code>ammoDetonator</code>, <code>ammoShell</code>, <code>ammoMine</code>, <code>ammoPlasma</code>, <code>ammoMissile</code>
|-
| secondaryAmmo || string || Secondary ammo for the Assault Cannon. This ammo displays as the smaller green numbers on the right HUD.
|}
|}

Revision as of 05:19, 16 February 2025

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; lower numbers give greater consistency of aim.
ammo string Type of main ammo used by the weapon. Options are ammoEnergy, ammoPower, ammoDetonator, ammoShell, ammoMine, ammoPlasma, ammoMissile
secondaryAmmo string Secondary ammo for the Assault Cannon. This ammo displays as the smaller green numbers on the right HUD.