User:Pathoschild/Modding:Content Patcher/Tutorial Mod

From Stardew Valley Wiki
Jump to: navigation, search
Modder's guide to Content Patcher SMAPI mascot.png

Getting started

Requirements

You need to install...

You do not need programming experience or special editing software.

Create a content pack

A "content pack" is just a folder with certain files. First, let's create a generic one:

  1. Open your game's Mods folder (located in your game folder).
  2. Add a subfolder for your mod (usually camelcase like YourModName).
  3. Inside the subfolder, add a manifest.json file with this text:
    {
       "Name": "Your Project Name",
       "Author": "your name",
       "Version": "1.0.0",
       "Description": "One or two sentences about the mod.",
       "UniqueID": "YourName.YourProjectName",
       "MinimumApiVersion": "2.5",
       "UpdateKeys": [],
       "ContentPackFor": {
          "UniqueID": "Pathoschild.ContentPatcher"
       }
    }
    
  4. Change the Name, Author, Description, and UniqueID fields in the manifest. You can leave everything else as-is for now. See the manifest format for more info on each field.
  5. Launch the game.

If all goes well, you should see this in the SMAPI console:

[SMAPI] Loaded 1 content pack:
[SMAPI]   Your Project Name 1.0 by your name | for ContentPatcher | One or two sentences about the mod.

[Content Patcher] Ignored content pack 'Your Project Name' because it has no content.json file.

The error about content.json is fine, we'll do that next. If your content pack isn't shown, review the above steps or come ask for help!

Add your changes

The last part is the content.json file. That's just a text files which tells Content Patcher what you want to change.

  1. In your mod folder, add a content.json file with this text:
    {
        "Format": "1.4",
        "Changes": [
            {
                "Action": "EditData",
                "Target": "Data/TV/TipChannel",
                "Entries": {
                    "218": "If you've got your hands on a copper pan, keep an eye out for something sparkly in the water.^There's often good ore in there, free for the taking!"
                }
            }
        ]
    }
    

That's it! That edits the Content/Data/TV/TipChannel.xnb data (without changing the file itself), to change "gold pan" to "copper pan". Now if you launch the game and watch TV on Winter 22 in year 2, you'll see your new text.