TFE Custom Logics: Difference between revisions

From DF21 Wiki
No edit summary
(wip)
Line 16: Line 16:


You can have as many logic .JSON files as you want, and each .JSON file can contain as many logics as you want. If multiple logics are loaded that have the same name, only the first one encountered with that name will be used. If you have multiple .JSON files, the order in which they are loaded by TFE is unpredictable, so the only way to be sure that your logics work the way you intend is to avoid duplicate names.
You can have as many logic .JSON files as you want, and each .JSON file can contain as many logics as you want. If multiple logics are loaded that have the same name, only the first one encountered with that name will be used. If you have multiple .JSON files, the order in which they are loaded by TFE is unpredictable, so the only way to be sure that your logics work the way you intend is to avoid duplicate names.
=== Logic JSON structure ===
<code>
{
  "logics": [
      {
        "logicName": "LogicA",
        "data": {
            "alertSound": "alert1.voc",
            "painSound": "pain1.voc",
            "hitpoints": 25,
            "projectile": "rifle_bolt"
        }
      },
      {
        "logicName": "LogicB",
        "data": {
            "alertSound": "alert2.voc",
            "painSound": "pain2.voc",
            "hitpoints": 39,
            "speed": 20,
            "projectile": "thermal_det",
            "dropItem": "energy"
        }
      }
  ]
}
</code>

Revision as of 06:53, 27 October 2024

This article explains how to use custom (user-defined) AI logics in TFE.

This feature allows modders to create new enemy logics that behave similarly to the "standard" (non-boss) enemies in Dark Forces, for example Officers, Stormtroopers, Bossk, Probe Droids.

JSON locations

Custom logics are defined in JSON files. TFE will search for and load logics from all logic .JSON files found in these locations

  • DARK\Logics
  • TheForceEngine\Mods\Logics

where DARK is your Dark Forces game directory which TFE is pointing to.

In addition, if you are running a Mod from a ZIP, TFE will look for a \Logics subfolder inside the ZIP and load logics from any .JSON files found there.

Logics loaded from a Mod will take preference over any logics found in other locations that have the same name.

You can have as many logic .JSON files as you want, and each .JSON file can contain as many logics as you want. If multiple logics are loaded that have the same name, only the first one encountered with that name will be used. If you have multiple .JSON files, the order in which they are loaded by TFE is unpredictable, so the only way to be sure that your logics work the way you intend is to avoid duplicate names.

Logic JSON structure

{

  "logics": [
     {
        "logicName": "LogicA",
        "data": {
           "alertSound": "alert1.voc",
           "painSound": "pain1.voc",
           "hitpoints": 25,
           "projectile": "rifle_bolt"
        }
     },
     {
        "logicName": "LogicB",
        "data": {
           "alertSound": "alert2.voc",
           "painSound": "pain2.voc",
           "hitpoints": 39,
           "speed": 20,
           "projectile": "thermal_det",
           "dropItem": "energy"
        }
     }
  ]

}