Tutorial: How to Add a False Dependency for Load Orders

From Stardew Modding Wiki
Jump to navigation Jump to search

PLEASE NOTE: This method has been largely obsoleted with 1.6's mod Load Order, but may still be useful for 1.5 content mods.

False dependencies are one method of managing load orders for Stardew Valley mods. Say that you have two mods that you would like to use together: Mod A, Incredible Items, changes every item sprite, while Mod B, New Apple Sprite, changes only a single item sprite. By default, SMAPI will load every mod in alphabetical order and so there will be no problems here since Incredible Items will replace everything and then New Apple Sprite will overwrite only Incredible Items' apple sprite. However, if the mod names are not conveniently in alphabetical order - for example, if you would like to use Mod C, Beautiful Apple, instead - then adding a false dependency will tell SMAPI to load one mod after another.

Instructions:

1) Open the manifest.json file of the mod you want to load second, overwriting the first mod, and check if there is already a Dependencies section. If there is, go to Step 2B.

2A) If there isn't a Dependencies section, you'll need to add one. The manifest.json code should look similar to this:

{
	"Name": "Mod Name",
	"Author": "Mod Author",
	"Version": "1.0.0",
	"Description": "Description of the mod.",
	"UniqueID": "ModAuthor.SecondMod",
	"MinimumApiVersion": "3.0.0",
	"UpdateKeys": [ "ModDrop:1073357"],
	"ContentPackFor": {
		"UniqueID": "Pathoschild.ContentPatcher",
		"MinimumVersion": "1.19.0"
	    },
}

Find the third curly bracket (the } symbol) from the bottom and if there is no comma, add one. After that, add a new line and paste in the following code:

"Dependencies": [
		{
			"UniqueID": "ModAuthor.ModName",
			"IsRequired": false,
		},

2B) If there is an existing Dependencies section, find the third curly bracket from the bottom, add a new line, and paste in the following code:

		{
			"UniqueID": "ModAuthor.ModName",
			"IsRequired": false,
		},

3) Open the manifest.json of the mod you want to load first, being overwritten by the second mod. Find the UniqueID line and copy its data; as seen in the example, it will likely be in the format ModAuthor.ModName. 4) Go back to the manifest.json of the second mod and paste the unique ID into the Unique ID line of the Dependencies section. It should look like this:

{
	"Name": "Mod Name",
	"Author": "Mod Author",
	"Version": "1.0.0",
	"Description": "Description of the mod.",
	"UniqueID": "ModAuthor.SecondMod",
	"MinimumApiVersion": "3.0.0",
	"UpdateKeys": [ "ModDrop:1073357"],
	"ContentPackFor": {
		"UniqueID": "Pathoschild.ContentPatcher",
		"MinimumVersion": "1.19.0"
	    },
	"Dependencies": [
		{
			"UniqueID": "ModAuthor.FirstMod",
			"IsRequired": false,
		},
    ]
}

5) Save the manifest.json, go to https://smapi.io/json/manifest, and validate it to make sure that there are no missing commas or other errors. If everything is fine, the false dependency has been added and the load order will work.

Additional Notes:

  • A false dependency is called so because of the ["IsRequired": false,] line of code. False tells SMAPI that the dependency is not mandatory and is only there for load order purposes, allowing Mod B to still work if Mod A is not installed. Setting this to true will tell SMAPI that the dependency is required and Mod B will not load if Mod A is not installed.
  • Manifest dependencies will take priority over alphabetical load order. Another method of forcing a specific load order is to rename the mod folder so that it has "z_" at the front of the folder name, so that it will load later in the alphabet, but this is not always reliable due to SMAPI's loading preferences.
  • If you try to use the altered mod and it creates red text in your SMAPI console, go back to Step 5 and validate your manifest.