Modding:NPC data

From Stardew Valley Wiki
Jump to: navigation, search


This page provides an overview of what's needed to create a custom NPC. This is an advanced guide for mod developers.

Before reading this page, see Modding:Editing XNB files for the basic concepts.

Files to edit

To create a new NPC, you need to edit a number of different files. However, you don't need any programming experience and it can be done with Content Patcher (with some caveats).

Basic info

The Data\NPCDispositions asset contains basic information for your character, including their name, birthday, relations to other characters, personality, and whether they can be dated.

The file has one row per NPC like this:

   Abigail: "teen/rude/outgoing/neutral/female/datable/Sebastian/Town/fall 13/Caroline 'mom' Pierre 'dad'/SeedShop 1 9/Abigail"

The key (before the colon) is the internal name which uniquely identifies that NPC. This name isn't shown to the player, but will be used when referencing the NPC in other files. The value contains the following fields:

index field example purpose
0 age teen Whether the NPC is a child, teen, or adult. TODO: what does this affect?
1 manners rude Whether the NPC is polite, rude, or neutral. This affects some generic dialogue lines.
2 social anxiety outgoing Whether the NPC is outgoing, shy, or neutral. This affects some generic dialogue lines.
3 optimism neutral Whether the NPC is positive, negative, or neutral. TODO: what does this affect?
4 gender female Whether the NPC is male or female. This affects dialogue, whether children in marriage are obtained through adoption or pregnancy, and the reserved frames' positions on the spritesheet.
5 datable datable Whether the NPC is datable or non-datable. This toggles the romance features (e.g. 'single' label in the social menu, bouquet gifting, and marriage).
6 love interest Sebastian unused
7 home region Town Whether the NPC lives in the Desert, Town, or Other. This is used when improving friendship points for all NPCs in a given region, which is currently only used for the Luau friendship boost (which only affects NPCs in the Town region).
8 birthday fall 13 The season and day for the NPC's birthday.
9 relationships Caroline 'mom' Pierre 'dad' This determines special generic Dialogue for revealing likes and dislikes to family members. May also affect the inlaw_<NPC> dialogue.
10 default map & position SeedShop 1 9 The location name and tile position where the NPC starts and ends each day.
11 display name Abigail The NPC name shown to the player.

Gift tastes

The Data\NPCGiftTastes asset contains their gift preferences (e.g. which gifts they love or hate), and their responses when they receive one. See Modding:Gift taste data for more info.

The file has one row per NPC like this:

   Abigail: "I seriously love this! You're the best, @!/66 128 220 226 276 611/Hey, how'd you know I was hungry? This looks delicious!//What am I supposed to do with this?/-5 -75 -79 16 245 246/What were you thinking? This is awful!/330/You brought me a present? Thanks.// " #!String

The line can be broken down into 5 pairs of dialogue + item IDs in this order: Love, Like, Neutral, Dislike, Hate. If a dialogue field is empty, the game will use a generic dialogue text. See Modding:Object data for the item IDs.

Overworld sprites

The overworld sprites are stored in Characters/NpcName, including movement and animation frames. Each frame is exactly 16x32 pixels, and some positions are reserved for certain actions:

  • the first sixteen frames are generic movement (four frames per direction);
  • frames 33 (female) and 35 (male) must be the kissing sprite if they're marriageable;
  • frames 40–47 (female) and 44–47 (male) must be the Flower Dance dance, if they participate;
  • frames 36–38 (female) 48–50 (male) are reserved for marriageable NPCs (Contains Wedding sprite).


The dialogue portraits are stored in Portraits/NpcName. Each frame is exactly 64x64 per portrait. The first six represent specific emotions (see Modding:Dialogue#Portrait commands), followed by any number of custom portraits. The first portrait is used when the dialogue doesn't specify one. Each NPC can have up to 12 portraits.


Their schedule file tells the game where the NPC starts and moves based on on the time. You need to add strings to a separate schedules file found in the Strings folder to allow custom dialogue. See Modding:Schedule data for more info.

Dialogue and events

The NPC dialogue and events are stored in several files; see Modding:Dialogue and Modding:Event data for more info.


Festivals are tricky things. Everyone in the vanilla game is added to the festival map by placing tiles on the Set-Up and MainEvent map layers from a character tilesheet that draws from NPCDispositions to get exactly who to place. This is not ideal for custom NPCs, since you have no way of knowing where on the NPCDispositions data list your NPC goes when a player is using multiple custom NPCs. For this reason, it is recommended to use TMXLoader, as it has a festival addition function to add your character to the Festival Maps, since it will draw upon your character's internal name instead of their position on the list. It's fairly easy to do, and there's an explanation on the TMXLoader Nexus Description.

Adding your NPC

Here's how you'd create an example NPC we'll name Dobson:

  1. Create an empty Content Patcher content pack. By convention, we'll name the folder [CP] Dobson.
  2. Create the following files:
    • assets/dialogue.json containing the dialogue.
    • assets/marriageDialogue.json containing the marriage dialogue (if applicable).
    • assets/sprites.png containing their overworld sprites.
    • assets/portraits.png containing their portraits.
    • assets/schedule.json containing their schedule data.
  3. Edit the content.json to load the files:
      "Format": "1.5",
      "Changes": [
          "LogName": "Sprites", 
          "Action": "Load",
          "Target": "Characters/Dobson",
          "FromFile": "assets/sprites.png",
          "LogName": "Portraits",
          "Action": "Load",
          "Target": "Characters/Portraits/Dobson",
          "FromFile": "assets/portraits.png",
          "LogName": "Dialogue",
          "Action": "Load",
          "Target": "Characters/Dialogue/Dobson",
          "FromFile": "assets/dialogue.json",
          "LogName": "Marriage Dialogue",
          "Action": "Load",
          "Target": "Characters/Dialogue/MarriageDialogueDobson",
          "FromFile": "assets/marriageDialogue.json",
          "LogName": "Schedule",
          "Action": "Load",
          "Target": "Characters/schedules/Dobson",
          "FromFile": "assets/schedule.json",
          "LogName": "NPC Dispositions",
          "Action": "EditData",
          "Target": "Data/NPCDispositions",
          "Entries": {
            "Dobson": "adult/rude/neutral/positive/male/datable//Town/summer 7//BusStop 19 4/Dobson"
          "LogName": "Gift tastes",
          "Action": "EditData",
          "Target": "Data/NPCGiftTastes",
          "Entries": {
            "Dobson": "You're giving this to me? This is amazing!/207 232 233 400/Thank you! This is a very interesting specimen./-5 -79 422/...What is this?/80 330/This is disgusting./2/That was very thoughtful of you./-4/ ",

That's it! If you load your game, the NPC should appear. If you want to create events, don't forget to add that file too.