Coding Help Mod Id

Rain_0724

Newcomer
I'm not sure where to ask this but I'm wondering what exactly are Mod ids? I was trying to make a npc mod but on this page it mentions Mod Ids and Unique String Id and I just don't get it. Can Somebody help me? (My npc is meant to be a fully social so I was basing it off the example on the wiki page also wondering if someone can explain how to edit the gift taste)
 

Dyanosis

Tiller
When anything refers to the Mod Id, also seen as ModId, Unique Id, Manifest id, it's referring to the UniqueID field in the manifest.json.

It'll look something like this "UniqueID": "Username.ID", or real example (from one of my mods) "UniqueID": "Dyanosis.PlantableTrees". The part you'd be interested in using from there is the Dyanosis.PlantableTrees.

It also sounds like you're making a CP (Content Patcher) mod, so this page would help you. Pathoschild explains everything about what to change, how to determine if it needs to be changed, potential values, etc.

As far as gift tastes goes (assuming you're making a CP mod), you'll need something that looks like the following within your content.json file (or whatever file you put your NPC data into):

JSON:
{
    "Action": "EditData",
    "Target": "Data/NPCGiftTastes",
    "TextOperations": [
        {
            "Operation": "Append",
            "Target": ["Fields", "Your_NPC_Name", "1"],
            "Value": "ID_of_Item",
            "Delimiter": " "
        }
    ]
}
Replace Your_NPC_Name with the name, not the ID, of your NPC. Replace ID_of_Item with the ID of the item you want (this is the unique ID, e.g. (0)422). The last thing in the target array (in the above, the "1") is the index of the gift taste you want to approve. The gift taste indices are as follows:
  • 1 - Love
  • 3 - Like
  • 5 - Dislike
  • 7 - Hate
  • 9 - Neutral
So if you set someone's "3", then it'll set their Like of that item.

Additionally for the gift taste, the "Value" can include multiple items, in the event that you want to set your NPC's gift tastes (say Love) for many items at once. That's where "Delimiter" comes into play because you're telling CP how your items are separated. You could have the Delimiter be anything, but it's best to use a space as no item ID is going to have a space in it (otherwise it'd be very confusing for everyone).

Example of setting Abigail's Love to include Red Mushrooms (ID: (O)420) and Purple Mushrooms (ID: (O)422):
JSON:
{
    "Action": "EditData",
    "Target": "Data/NPCGiftTastes",
    "TextOperations": [
        {
            "Operation": "Append",
            "Target": ["Fields", "Abigail", "1"],
            "Value": "(O)420 (O)422",
            "Delimiter": " "
        }
    ]
}
You can probably find plenty of examples in other Content Patcher mods that add NPCs of how to do this as well, but figured I'd include examples so you don't have to go looking for them if you don't want to.
 

Dyanosis

Tiller
To address the Unique String ID portion, what it means is that your NPC needs to have an ID that is something like Dyanosis.ExampleNPC_Henry.

Let's break down what that ID means:
  • Dyanosis.ExampleNPC - This would be the ModId (aka UniqueID from the manifest.json)
  • _ - Is the separator character so that Content Patcher (or any other mod) knows where your ModId stops and the NPC name begins
  • Henry - The name of the NPC I've created
 
Top