TFE Mod Overrides

From DF21 Wiki

On this page we will discuss how to override The Force Engine (TFE) mod configurations. We will discuss using a custom mod configuration file that looks like this.

What is a Mod Configuration File?

You can change many different aspects of your mod by placing a configuration file called MOD_CONF.txt inside your mod's GOB archive (using a tool like Conman ). When present, this file will make TFE act differently than it would in a regular game. You could change the amount of lives you have on start, and what weapons are available. You can even start the mission wearing a Gas Mask! Note: The Dark Forces Remaster only loads MOD_CONF from the GOB!

The MOD_CONF.txt should look like this in your GOB...

Now that you know where to place the configuration file, lets look inside it!

How do I create or edit a MOD_CONF.txt file and what is JSON?

Simply open your favorite text editor (like Notepad) and create a new file. Then you will be able to edit the text as necessary. The file itself is in the format of a JSON like the level metadata.txt. You can read about the format here --> JSON Tutorial . Basically, you surround each section with brackets { and } putting configuration data inside each section. Any word has to be surrounded with quotation marks. Each configuration is in the format of KEY : VALUE

And example could be "hello" : "world" or "dark" : "forces". In this case the name of the key is hello or dark and the value is world or forces. Then you surround everything with brackets.

{"hello" : "world"}

That's what a valid configuration looks like above. You can also place one configuration inside another.

{"hello" : {"dark": "forces"}}

So in the case above the key hello is equal to another key-value pair called {"dark" :"forces"}. You can put as many as you want inside each other.

If you have multiple values just add commas between them.

{"name" : "Kyle", "lastname" : "Katarn", "Age" : 25, ...... etc... }

IMPORTANT!!! It is very easy to make a typo in your JSON file. Go to this website, paste your MOD_CONF.txt contents and verify that there are no errors --> https://jsonlint.com/

Remember after you create your MOD_CONF.txt to add it your GOB archive.

What is the structure of a MOD_CONF.txt file?

Below is a an example of a level configuration.

At the top is the key TFE_OVERRIDES. This tells the game that everything inside is used as configuration for TFE.

{
    "TFE_OVERRIDES": {
        "levelOverrides": {
            "SECBASE.LEV": {
                "pistol": "false",
                "rifle": "true",
                "power": 300,
                "detonator": 5,
                "shields": 150
            },
            "TALAY.LEV": {
                "bryarOnly" : "true",
                "lives": 1
            }
        }
    }
}

Inside the overrides section is the levelOverrides section. This tells the game that there will be configuration for each level name that you define.

Inside the levelOverrides section is a comma-separated listing of levels you want to override. For example if you want to change the behavior of SECBASE you would add SECBASE.LEV configuration and if you want to configure TALAY then you would write down TALAY.LEV. You can add as many as you want depending on how many maps you have in your GOB.

Structure of a Level Override Section

Lets look at the detail of level override section. You will see that it is a listing of key-value pairs. Some of them are set to true or false and some have numerical values.

SECBASE.LEV

Lets look at the section for SECBASE.LEV

"SECBASE.LEV": 
{
   "pistol": "false",
   "rifle": "true",
   "power": 300,
   "detonator": 5,
   "shields": 150
}

What each key does is change the behavior of the level in the game. Lets look at the part that says

   "pistol": "false",

In this case, the key is pistol and the value is false. This means that it will remove the pistol from the mission's inventory. Lets continue...

   "rifle": "true",

In this case, the key is rifle and the value is true. This means that the game will add the rifle to your inventory.

   "power": 300,

In this case, the key is power and the value is 300. This means that the game will set the repeater ammo power to 300 units. Notice that there are no quotes around 300 - that's because we don't need to do that when dealing with numbers.

   "detonator": 5,

In this case, the key is detonator and the value is 5. This means that the game will set the thermal detonator to 5.

   "shields": 150

In this case, the key is shields and the value is 150. This means that the game will set the shields to 150. Note that there is no comma after 150 .

Remember, all of these changes only apply to the SECBASE.LEV mission!

TALAY.LEV

Now lets look at the next section for TALAY.LEV.

"TALAY.LEV": {
   "bryarOnly" : "true",
   "lives": 1
}

Here, we have two key - value pairs.

   "bryarOnly" : "true",

In this case, the key is bryarOnly and the value is true. This means that the game will remove your entire inventory and give you only a bryar pistol!

   "lives": 1

In this case, the key is lives and the value is 1 This means that the game will give you only 1 life!

Full Configuration Details

Now that you know how everything works lets go over each key and what it does!

Weapons and Inventory

When you set the value to "true" item will be added. When set to "false" the item will be removed from the player's inventory. So if your key is "pistol" then the two values you can set are either "true" or "false".

pistol -     Add or Remove the Bryar Pistol from the inventory
rifle -      Add or Remove the E-11 Imperial Rifle from the inventory
autogun -    Add or Remove the Repeater Gun from the inventory
mortar -     Add or Remove the Packard Mortar from the inventory
fusion -     Add or Remove the Fusion Cutter from the inventory
concussion - Add or Remove the Concussion Rifle from the inventory
cannon -     Add or Remove the Dark Trooper Cannon from the inventory
mask -       Add or Remove the Gas Mask from the inventory
goggles -    Add or Remove the Night Vision Goggles from the inventory
cleats -     Add or Remove the Ice Cleats from the inventory
Ammunition and Health

These typically set your a numeric value for your ammunition and health. Just give the value nice whole numbers between 0 and the Max.

energy -    Set the Energy (For E-11) ammunition to a specific value. Max is 999
power -     Set the Power (For the Repeater) ammunition to a specific value. Max is 999
plasma -    Set the Power (For the DT Cannon) ammunition to a specific value. Max is 999
detonator - Set the Thermal Detonator count. Max is 999.
shell  -    Set the Mortar Shells (for the Packard Mortar Cannon) to a specific value. Max is 999.
mine -      Set the Imperial Mine count. Max is 999.
missile -   Set the DT Weapon missiles to a specific value.  Max is 99.
shields -   Set your shields to a specific value. Max is 999.
health -    Set your health to a specific value. Max is 999.
lives -     Set your lives to a specific value. Max is 9.
battery -   Set your battery to a specific value. This is a percentage between 0 and 100. 
Custom Numerical Overrides
defaultWeapon -   Set your starting equipped weapon. 0 is fists, 1 is Bryar ... 9 is the DT Cannon. Values between 0 and 9. 
Custom Overrides

We have some custom overrides for your mod.

enableMask -        Start the mission with your Gas Mask on.
enableCleats-       Start the mission with your Ice Cleats on.
enableNightVision - Start the mission with your Night Vision enabled.
enableHeadlamp-     Start the mission with your Head Lamp on. 
bryarOnly -         Start your mission with no inventory except a bryar pistol and 100 ammo just like the first misison.