Changes

→‎Portraits: remove broken hotlinked image (images should be uploaded to the wiki with an open license instead)
Line 6: Line 6:     
==Files to edit==
 
==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 {{nexus mod|1915|Content Patcher}}.
+
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 [[Modding:Content Patcher|Content Patcher]].
    
===Basic info===
 
===Basic info===
The <tt>Data\NPCDispositions</tt> asset contains basic information for your character, including their name, birthday, relations to other characters, personality, and whether they can be dated.
+
The <samp>Data\NPCDispositions</samp> 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:
 
The file has one row per NPC like this:
Line 27: Line 27:  
| 0
 
| 0
 
| age
 
| age
| <tt>teen</tt>
+
| <samp>teen</samp>
| Whether the NPC is a <tt>child</tt>, <tt>teen</tt>, or <tt>adult</tt>. This affects generated dialogue lines (e.g. a child would say ''stupid'' and an adult would say ''depressing''), generic dialogue (e.g. a child would respond to dumpster diving with "''Eww... What are you doing?''" and a teen would say "''Um... Why are you digging in the trash?''"), and the gift they choose as [[Feast of the Winter Star|a secret gift-giver]]. Children are also excluded from item delivery quests.
+
| Whether the NPC is a <samp>child</samp>, <samp>teen</samp>, or <samp>adult</samp>. This affects generated dialogue lines (''e.g.,'' a child would say ''stupid'' and an adult would say ''depressing''), generic dialogue (''e.g.,'' a child would respond to dumpster diving with "''Eww... What are you doing?''" and a teen would say "''Um... Why are you digging in the trash?''"), and the gift they choose as [[Feast of the Winter Star|a secret gift-giver]]. Children are also excluded from item delivery quests.
 
|-
 
|-
 
| 1
 
| 1
 
| manners
 
| manners
| <tt>rude</tt>
+
| <samp>rude</samp>
| Whether the NPC is <tt>polite</tt>, <tt>rude</tt>, or <tt>neutral</tt>. This affects some generic dialogue lines.
+
| Whether the NPC is <samp>polite</samp>, <samp>rude</samp>, or <samp>neutral</samp>. This affects some generic dialogue lines.
 
|-
 
|-
 
| 2
 
| 2
 
| social anxiety
 
| social anxiety
| <tt>outgoing</tt>
+
| <samp>outgoing</samp>
| Whether the NPC is <tt>outgoing</tt>, <tt>shy</tt>, or <tt>neutral</tt>. This affects some generic dialogue lines.
+
| Whether the NPC is <samp>outgoing</samp>, <samp>shy</samp>, or <samp>neutral</samp>. This affects some generic dialogue lines.
 
|-
 
|-
 
| 3
 
| 3
 
| optimism
 
| optimism
| <tt>neutral</tt>
+
| <samp>neutral</samp>
| Whether the NPC is <tt>positive</tt>, <tt>negative</tt>, or <tt>neutral</tt>. ''Unused.''
+
| Whether the NPC is <samp>positive</samp>, <samp>negative</samp>, or <samp>neutral</samp>. ''Unused.''
 
|-
 
|-
 
| 4
 
| 4
 
| gender
 
| gender
| <tt>female</tt>
+
| <samp>female</samp>
| Whether the NPC is <tt>male</tt>, <tt>female</tt>, or <tt>undefined</tt>. This affects dialogue, whether children in marriage are obtained through adoption or pregnancy, and the reserved frames' positions on the spritesheet.
+
| Whether the NPC is <samp>male</samp>, <samp>female</samp>, or <samp>undefined</samp>. This affects dialogue, whether children in marriage are obtained through adoption or pregnancy, and the reserved frames' positions on the spritesheet.
 
|-
 
|-
 
| 5
 
| 5
 
| datable
 
| datable
| <tt>datable</tt>
+
| <samp>datable</samp>
| Whether the NPC is <tt>datable</tt> or <tt>not-datable</tt>. This toggles the romance features (e.g. 'single' label in the social menu, bouquet gifting, and marriage).
+
| Whether the NPC is <samp>datable</samp>, <samp>not-datable</samp>, or <samp>secret</samp>. The former two toggle the romance features (''e.g.,'' 'single' label in the social menu, bouquet gifting, and marriage), while <samp>secret</samp> is used exclusively for Krobus, who cannot be married but can be made a roommate.
 
|-
 
|-
 
| 6
 
| 6
 
| love interest
 
| love interest
| <tt>Sebastian</tt>
+
| <samp>Sebastian</samp>
 
| ''Unused.''
 
| ''Unused.''
 
|-
 
|-
 
| 7
 
| 7
 
| home region
 
| home region
| <tt>Town</tt>
+
| <samp>Town</samp>
| Whether the NPC lives in the <tt>Desert</tt>, <tt>Town</tt>, or <tt>Other</tt>. 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 <tt>Town</tt> region).
+
| Whether the NPC lives in the <samp>Desert</samp>, <samp>Town</samp>, or <samp>Other</samp>. 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 <samp>Town</samp> region).
 
|-
 
|-
 
| 8
 
| 8
 
| birthday
 
| birthday
| <tt>fall 13</tt>
+
| <samp>fall 13</samp>
 
| The season and day for the NPC's birthday.
 
| The season and day for the NPC's birthday.
 
|-
 
|-
 
| 9
 
| 9
 
| relationships
 
| relationships
| <tt>Caroline 'mom' Pierre 'dad'</tt>
+
| <samp>Caroline 'mom' Pierre 'dad'</samp>
| This affects generic dialogue for revealing likes and dislikes to family members. May also affect the inlaw_<NPC> dialogue. Can be empty if not applicable (e.g. <code>/fall 13//SeedShop 1 9/</code>).
+
| This affects generic dialogue for revealing likes and dislikes to family members. May also affect the inlaw_<NPC> dialogue. Can be empty if not applicable (''e.g.,'' <code>/fall 13//SeedShop 1 9/</code>).
 
|-
 
|-
 
| 10
 
| 10
 
| default map & position
 
| default map & position
| <tt>SeedShop 1 9</tt>
+
| <samp>SeedShop 1 9</samp>
 
| The location name and [[Modding:Modder Guide/Game Fundamentals#Tiles|tile position]] where the NPC starts and ends each day.
 
| The location name and [[Modding:Modder Guide/Game Fundamentals#Tiles|tile position]] where the NPC starts and ends each day.
 
|-
 
|-
 
| 11
 
| 11
 
| display name
 
| display name
| <tt>Abigail</tt>
+
| <samp>Abigail</samp>
 
| The NPC name shown to the player.
 
| The NPC name shown to the player.
 
|}
 
|}
    
===Gift tastes===
 
===Gift tastes===
The <tt>Data\NPCGiftTastes</tt> 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 <samp>Data\NPCGiftTastes</samp> 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:
 
The file has one row per NPC like this:
Line 94: Line 94:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
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.
+
The line can be broken down into 5 pairs of dialogue + item IDs in this order: Love, Like, Dislike, Hate, Neutral. If a dialogue field is empty, the game will use a generic dialogue text. See [[Modding:Items]] for the object IDs.
    
====Birthday gift responses====
 
====Birthday gift responses====
The <tt>Strings\StringsFromCSFiles</tt> asset contains the generic responses given by NPCs to birthday gifts based on their gift preferences and manners. These shared strings can be customized for a specific NPC by editing them conditionally, such as only on the NPC's (non-shared) birthday. The following criteria are used to select from among the strings:
+
The <samp>Strings\StringsFromCSFiles</samp> asset contains the generic responses given by NPCs to birthday gifts based on their gift preferences and manners. These shared strings can be customized for a specific NPC by editing them conditionally, such as only on the NPC's (non-shared) birthday. The following criteria are used to select from among the strings:
    
{| class="wikitable"
 
{| class="wikitable"
Line 105: Line 105:  
! chance
 
! chance
 
! string
 
! string
 +
! english string
 
|-
 
|-
 
| rowspan="4" | love, like
 
| rowspan="4" | love, like
 
| rowspan="2" | rude
 
| rowspan="2" | rude
 
| 50%
 
| 50%
| <tt>NPC.cs.4274</tt>
+
| <samp>NPC.cs.4274</samp>
 +
| <samp>"You remembered my birthday? I'm impressed. Thanks.$h"</samp>
 
|-
 
|-
 
| 50%
 
| 50%
| <tt>NPC.cs.4276</tt>
+
| <samp>NPC.cs.4276</samp>
 +
| <samp>"Oh, is it my birthday today? I guess it is. Thanks. This is nice.$h/Oh, is it my birthday today? I guess it is. Thanks. This is nice.$h"</samp>
 
|-
 
|-
 
| rowspan="2" | polite, neutral
 
| rowspan="2" | polite, neutral
 
| 50%
 
| 50%
| <tt>NPC.cs.4275</tt>
+
| <samp>NPC.cs.4275</samp>
 +
| <samp>"A birthday gift? That's very kind of you! I love it.$h"</samp>
 
|-
 
|-
 
| 50%
 
| 50%
| <tt>NPC.cs.4277</tt>
+
| <samp>NPC.cs.4277</samp>
 +
| <samp>"You remembered my birthday! Thank you. This is great.$h"</samp>
 
|-
 
|-
 
| rowspan="2" | dislike, hate
 
| rowspan="2" | dislike, hate
 
| rude
 
| rude
 
| 100%
 
| 100%
| <tt>NPC.cs.4278</tt>
+
| <samp>NPC.cs.4278</samp>
 +
| <samp>"It's my birthday and you give me this? Is this some kind of joke?$s/It's my birthday and you give me this? Is this some kind of joke?$s"</samp>
 
|-
 
|-
 
| polite, neutral
 
| polite, neutral
 
| 100%
 
| 100%
| <tt>NPC.cs.4279</tt>
+
| <samp>NPC.cs.4279</samp>
 +
| <samp>"Oh... It's for my birthday? ... Thanks.$s/Oh... It's for my birthday? ... Thanks.$s"</samp>
 
|-
 
|-
 
| rowspan="2" | neutral
 
| rowspan="2" | neutral
 
| rude
 
| rude
 
| 100%
 
| 100%
| <tt>NPC.cs.4280</tt>
+
| <samp>NPC.cs.4280</samp>
 +
| <samp>"For my birthday? Thanks."</samp>
 
|-
 
|-
 
| polite, neutral
 
| polite, neutral
 
| 100%
 
| 100%
| <tt>NPC.cs.4281</tt>
+
| <samp>NPC.cs.4281</samp>
 +
| <samp>"Oh, a birthday gift! Thank you./Oh, a birthday gift! Thank you."</samp>
 
|}
 
|}
 +
 +
The <samp>$h</samp> and <samp>$s</samp> are [[Modding:Dialogue#Portrait_commands|portrait commands]] that select the portrait image of the character to use.
    
===Overworld sprites===
 
===Overworld sprites===
The overworld sprites are stored in <tt>Characters/NpcName</tt>, including movement and animation frames. Each frame is exactly 16x32 pixels. Here's an [https://cdn.discordapp.com/attachments/156109690059751424/729807097835028540/unknown.png example sprite guide], courtesy of TheLimeyDragon#1993 on Discord. Some positions are reserved for certain actions:
+
 
 +
[[File:Abigail-sprite-sheet.png|thumb|The sprite sheet for Abigail.]]
 +
 
 +
The overworld sprites are stored in <samp>Characters/NpcName</samp>, including movement and animation frames. Each frame is exactly 16x32 pixels. Here's an [https://cdn.discordapp.com/attachments/156109690059751424/729807097835028540/unknown.png example sprite guide], courtesy of TheLimeyDragon#1993 on Discord. Some positions are reserved for certain actions:
 
<ul>
 
<ul>
 
<li>the first sixteen frames are generic movement (four frames per direction);</li>
 
<li>the first sixteen frames are generic movement (four frames per direction);</li>
Line 204: Line 218:     
===Portraits===
 
===Portraits===
The dialogue portraits are stored in <tt>Portraits/NpcName</tt>. 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.
+
[[File:Modding - creating an XNB mod - example portraits.png|thumb|Abigail's portrait sprite sheet.]]
   −
Here's an [https://cdn.discordapp.com/attachments/156109690059751424/729820558966915122/unknown.png example portrait guide], courtesy of TheLimeyDragon#1993 on Discord.
+
The dialogue portraits are stored in <samp>Portraits/NpcName</samp>. 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.
    
===Schedule===
 
===Schedule===
Line 215: Line 229:     
===Festivals===
 
===Festivals===
Custom NPCs should be added to festivals via the <tt>Set-Up_additionalCharacters</tt> field in the [[Modding:Festival_data#Data_file|festival's data file]]. You may also want to visit [https://stardewmodding.wiki/wiki/Custom_NPC_Tiles Custom NPC festival tile positions] to check the positions of various existing NPCs for compatibility purposes.
+
Custom NPCs should be added to festivals via the <samp>Set-Up_additionalCharacters</samp> and <samp>MainEvent_additionalCharacters</samp> fields in the [[Modding:Festival_data#Data_file|festival's data file]]. You may also want to visit [https://stardewmodding.wiki.gg/wiki/Custom_NPC_Tiles Custom NPC festival tile positions] to check the positions of various existing NPCs for compatibility purposes.
   −
(Prior to Stardew Valley 1.5, {{nexus mod|1820|TMX}} was the recommended tool for adding festival spots.)
+
(Prior to Stardew Valley 1.5, {{nexus mod|1820|TMXL}} was the recommended tool for adding festival spots.)
 +
 
 +
===Movie theater===
 +
An NPC's taste in movies and concessions are stored in <samp>Data\MoviesReactions.xnb</samp> and <samp>Data\ConcessionTastes.xnb</samp>, respectively. See [[Modding:Movie theater data]] for details on how these function.
 +
 
 +
===Spouse room===
 +
If your NPC will be a marriage candidate, note that you can add a spouse room for them much more easily after game version 1.5.5. See [[Modding:Migrate_to_Stardew_Valley_1.5.5#Custom_spouse_rooms]] for details.
 +
 
 +
===Sleep animation===
 +
When the NPC goes to bed, they'll play the looping sleep animation set via <samp>{{t|lowercase NPC name}}_sleep</samp> in <samp>Data/animationDescriptions</samp>, if it exists. For example, this content pack adds a sleep animation for an NPC named 'Pufferbob':
 +
{{#tag:syntaxhighlight|
 +
{
 +
    "Format": "{{Content Patcher version}}",
 +
    "Changes": [
 +
        {
 +
            "Action": "EditData",
 +
            "Target": "Data/animationDescriptions",
 +
            "Entries": {
 +
                "pufferbob_sleep": "50/50/50" // note: make name lowercase
 +
            }
 +
        }
 +
    ]
 +
}
 +
|lang=json}}
 +
}
    
==Adding your NPC==
 
==Adding your NPC==
Line 223: Line 261:     
<ol>
 
<ol>
<li>[https://github.com/Pathoschild/StardewMods/blob/develop/ContentPatcher/docs/author-guide.md#format Create an empty Content Patcher content pack]. By convention, we'll name the folder <tt>[CP] Dobson</tt>.</li>
+
<li>[https://github.com/Pathoschild/StardewMods/blob/develop/ContentPatcher/docs/author-guide.md#format Create an empty Content Patcher content pack]. By convention, we'll name the folder <samp>[CP] Dobson</samp>.</li>
 
<li>Create the following files:
 
<li>Create the following files:
* <tt>assets/dialogue.json</tt> containing the dialogue.
+
* <samp>assets/dialogue.json</samp> containing the dialogue.
* <tt>assets/marriageDialogue.json</tt> containing the marriage dialogue (if applicable).
+
* <samp>assets/marriageDialogue.json</samp> containing the marriage dialogue (if applicable).
* <tt>assets/sprites.png</tt> containing their overworld sprites.
+
* <samp>assets/sprites.png</samp> containing their overworld sprites.
* <tt>assets/portraits.png</tt> containing their portraits.
+
* <samp>assets/portraits.png</samp> containing their portraits.
* <tt>assets/schedule.json</tt> containing their schedule data.
+
* <samp>assets/schedule.json</samp> containing their schedule data.
 
</li>
 
</li>
<li>Edit the <tt>content.json</tt> to load the files:
+
<li>Edit the <samp>content.json</samp> to load the files:
 
{{#tag:syntaxhighlight|
 
{{#tag:syntaxhighlight|
 
{
 
{
Line 239: Line 277:  
             "Action": "Load",
 
             "Action": "Load",
 
             "Target": "Characters/Dobson",
 
             "Target": "Characters/Dobson",
             "FromFile": "assets/sprites.png",
+
             "FromFile": "assets/sprites.png"
 
         },
 
         },
 
         {
 
         {
 
             "Action": "Load",
 
             "Action": "Load",
 
             "Target": "Portraits/Dobson",
 
             "Target": "Portraits/Dobson",
             "FromFile": "assets/portraits.png",
+
             "FromFile": "assets/portraits.png"
 
         },
 
         },
 
         {
 
         {
 
             "Action": "Load",
 
             "Action": "Load",
 
             "Target": "Characters/Dialogue/Dobson",
 
             "Target": "Characters/Dialogue/Dobson",
             "FromFile": "assets/dialogue.json",
+
             "FromFile": "assets/dialogue.json"
 
         },
 
         },
 
         {
 
         {
 
             "Action": "Load",
 
             "Action": "Load",
 
             "Target": "Characters/Dialogue/MarriageDialogueDobson",
 
             "Target": "Characters/Dialogue/MarriageDialogueDobson",
             "FromFile": "assets/marriageDialogue.json",
+
             "FromFile": "assets/marriageDialogue.json"
 
         },
 
         },
 
         {
 
         {
 
             "Action": "Load",
 
             "Action": "Load",
 
             "Target": "Characters/schedules/Dobson",
 
             "Target": "Characters/schedules/Dobson",
             "FromFile": "assets/schedule.json",
+
             "FromFile": "assets/schedule.json"
 
         },
 
         },
 
         {
 
         {
Line 266: Line 304:  
             "Entries": {
 
             "Entries": {
 
                 "Dobson": "adult/rude/neutral/positive/male/datable//Town/summer 7//BusStop 19 4/Dobson"
 
                 "Dobson": "adult/rude/neutral/positive/male/datable//Town/summer 7//BusStop 19 4/Dobson"
             },
+
             }
 
         },
 
         },
 
         {
 
         {
Line 272: Line 310:  
             "Target": "Data/NPCGiftTastes",
 
             "Target": "Data/NPCGiftTastes",
 
             "Entries": {
 
             "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/ ",
+
                 "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/ "
             },
+
             }
 
         },
 
         },
 
         {
 
         {
Line 280: Line 318:  
             "Entries": {
 
             "Entries": {
 
                 "Dobson0": "I can't believe I am about to be married!$h",
 
                 "Dobson0": "I can't believe I am about to be married!$h",
                 "Dobson1": "I hope I don't get cold feet",
+
                 "Dobson1": "I hope I don't get cold feet"
             },
+
             }
         },
+
         }
 
     ]
 
     ]
 
}
 
}
Line 294: Line 332:  
[[Category:Modding]]
 
[[Category:Modding]]
    +
[[es:Modding:Datos de NPC]]
 
[[pt:Modificações:Dados do NPC]]
 
[[pt:Modificações:Dados do NPC]]
 
[[ru:Модификации:О NPC]]
 
[[ru:Модификации:О NPC]]
translators
8,404

edits