Mod Definition File - Titanfall-Mods/Titanfall-2-Icepick GitHub Wiki

The mod definition file tells the Icepick important information about your mod, such as it's name, what it does, and how to load your mod files into the game. The mod definition file needs to be added and set up with an ApiId if you are going to upload your mod to Titanfall Mods.

mod.json

The mod definition is a json file that sits in the root directory of your mod. It will tell the Icepick what your mod is, what it does, how to contact you, and any custom files you want to include.

To create it, simply create a plain text file in your mods directory and rename it to mod.json. eg. data/mods/MyName.MyCoolMod/mod.json

Keys

These are the available keys to use for your mod.json file to change how it is loaded.

Key Description Required
ApiId Your unique mod identifier, used to check for updates with the Titanfall Mods server. Yes
Name Sets the name of your mod in the Icepick launcher. Yes
Description Sets the subtitle of mod in the Icepick launcher. Yes
Authors An array of strings detailing who made the mod. No
Contacts An array of strings detailing who to contact about the mod. No
Version A string of what version the mod is. Used primarily for the mod developer themselves. No
CustomScripts An array of CustomScript objects which tell the TTF2SDK how to load your scripts. Yes if you have new script files

CustomScripts

The Icepick can load custom scripts into the game if you do not simply want to replace an existing one. These must be added to the CustomScripts array of your mod.json file.

Each custom script must be a new json object in the array.

Key Description Required
Path Path to the script file to load, relative to your mods path. Yes
RunOn An rson string of which contexts to run the script in. eg. CLIENT Yes
ClientCallback The name of the function to load if loading on the Client context. eg. Toolgun_Client_Init If RunOn specifies CLIENT
ServerCallback The name of the function to load if loading on the Server context. eg. Toolgun_Server_Init If RunOn specifies SERVER

RunOn

This section tells the Icepick how to load your script and which contexts to load it in. It uses the same format used in scripts.rson (if you are familiar with that.) Available contexts are:

  • CLIENT Load on Client.
  • SERVER Load on Server.
  • UI Load on Client user-interface.
  • SP Load in Singleplayer only.
  • MP Load in Multiplayer only. This is useless for custom scripts as multiplayer is unavailable while using the Icepick.

You are able to combine multiple contexts using boolean logic operators ( ||, &&, (, and ) ) to load a single script across multiple contexts. Examples:

  • SERVER Load on just the server.
  • CLIENT || SERVER Load on Client or Server (will be loaded by both Client and the Server.)
  • SP && CLIENT Load on the Client in Singleplayer only.
  • SP && (CLIENT || SERVER) Load on the Client or Server in Singleplayer only.

ApiId

An ApiId allows you to upload your mod to Titanfall Mods for others to download it, and allows the launcher to check for updates to your mod so that users can always get the latest version!

To get an ApiId for your mod, follow the instructions below.

  • You will need to first sign in to Titanfall Mods.
  • Go to the Dashboard and create a mod.
  • Choose to Edit the mod in the Dashboard, and you will see the mods ApiId listed under Mod Info.
  • Copy the ApiId into your mod.json as ApiId. "ApiId" : "xxxxxxxxxxxxxxxxx"
  • Your mod is now setup with the Titanfall Mods server!

Example

{
	"ApiId" : "QYvjkbc2tjhkPdisn",
	"Name" : "Example Mod",
	"Description" : "This example mod will load a custom file.",
	"Authors" : [
		"James Wilkinson"
	],
	"Contacts" : [
		"[email protected]"
	],
	"Version" : "0.1",
	"CustomScripts": [
		{
			"Path": "scripts/cl_my_custom_file.nut",
			"RunOn": "CLIENT",
			"ClientCallback": "MyClientInitFunction"
		},
		{
			"Path": "scripts/sv_my_server_file.nut",
			"RunOn": "SERVER",
			"ServerCallback": "MyServerInitFunction"
		},
		{
			"Path": "scripts/sh_my_shared_file.nut",
			"RunOn": "SERVER || CLIENT",
			"ClientCallback": "ExampleMod_Cl_Init",
			"ServerCallback": "ExampleMod_Sv_Init"
		}
	]
}