Modding:NPC data

Revision as of 20:21, 25 November 2018 by MissCoriel (talk | contribs) (How to create a new NPC)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Axe.png
Article Stub

This article is a stub and is missing information. You can help Stardew Valley Wiki by expanding it!

Creating Custom NPCs

Creation of NPCs is a small undertaking, as it requires editing and installing various files of the game. Fortunately, creating NPCs does not require any coding experience and can be done via XNB modding (not recommended) and Content Patcher (very recommended). I. Files When creating a NPC, remember that the following files must be made or edited: ⦁ NPCDispositions.xnb: You need to add in the information of your character here. This will determine their coded name, their birthday, relations to other characters, dispositions, if datable or not. ⦁ NPCGiftTastes.xnb: In order to gain friendship, you need to edit this file in order for the game to know what Items your NPC loves/likes/is neutral/dislikes/hates. See https://stardewvalleywiki.com/Modding:Gift_taste_data for information ⦁ Spritesheet: This is a file you must make on your own. The character sprite sheet will contain the movement and animation frames in rows of 4. The sprites are 16x32 each and cannot exceed that framesize. Certain frames MUST be reserved for certain actions. (such as Frame 33 must be the kissing sprite for marriageable NPCs.) ⦁ Portraits: This is the character's face sprites for dialogue. Each frame is 64x64 pixels and are grouped in rows of 2. In order to have a good universal feel you need to order the first 6 frames as follows: Neutral face, Happy face, Sad Face, Blush, Angry Face, and Unique Face. This represents the universal codes for the game to recognize ($h, $s, $a, $l, $u). As of now you can place up to 12 portraits on one sheet ($11). ⦁ Schedule: This tells the game where the NPC starts and moves to depending on time. You will need to add strings to a separate Schedules file found in the Strings folder to allow custom dialogue. ⦁ Dialogue: This is a file you design usually formated by the name of the NPC (ex: Abigail). It contains the dialogue for day to day speech when you interact with them. For details see: https://stardewvalleywiki.com/Modding:Dialogue ⦁ Marriage Dialogue: Marriage dialogue is needed only if your NPC can be married to the farmer. It is usually formatted as MarriageDialogue<Name> (Ex: MarriageDialogueHaley). This contains specific dialogue for the NPC while married and has special dialogue conditions for being married. There is also a generic Marriage Dialogue you can edit for generic responses. ⦁ Event Presence: This is done by simple event creation. See: https://stardewvalleywiki.com/Modding:Event_data ⦁ Festival Presence: Todo Define how to do this. II. NPC Disposition This file contains some values used by the game that defines the character. Abigail1: "teen2/rude3/outgoing4/neutral5/female6/datable7/Sebastian8/Town9/fall 1310/Caroline 'mom' Pierre 'dad'11/SeedShop 1 912/Abigail13" 1. Coded name: This is what events use to identify your NPC 2. Age: This determines if the NPC is a child, teen(18),adult. As for what it changes, it is not yet known.(TODO: Get better understanding of this value) 3. Disposition: Mostly determines some generic lines that occasionally comes up. The known values are polite, rude, neutral. 4. Specific Disposition: Determines more Generic dialogue, not much else is known. Known values are outgoing, shy, neutral 5. Optimisim: Shows the persons outlook on life.. not sure if it affects generic dialogue. Known values are positive, negative, neutral. 6. Gender: This determines if the NPC is male or female. There is more to it than the gender as it determines if you adopt a baby or become pregnant. This also determines where on the spritesheet your reserved frames must go. 7. Datablility: Only two values are available datable, non-datable. This will tell the game whether to lable them as single and activate the ability to give them a bouquet at 8 hearts and marry them at 10 hearts. 8. Friends or love interests: Usually determines who the NPC is close to. Not required but you have to put the space there (//). 9. Villager: Determines if they are a part of Pelican Town or not. All villagers are labled with the Town value while Krobus, Dwarf, and Wizard are labled with Other. 10. Birthday: This determines the NPC's Birthday. 11. Relations: This value determines parents and siblings. 12. Sleep zone: Determines where the NPC starts and ends every day. 13. Name String: This does not have to match the Code name. This will be the name that appears in text when speaking to the NPC.


III. Gift Tastes This file contains the gift tastes of an NPC.

   Haley: "Oh my god, this is my favorite thing!!/221 421 610 88/1*gasp*...for me? Thank you!/18 60 62 64 70 88 222 223 232 233 234 402 418/2Ugh...that's such a stupid gift./-5 -6 -75 -79 -81 80 -27/3Gross!/-4 2 16 330 74/4Thank you. I love presents.// "

Each bit of dialogue is followed by item codes for various gifts. The order of taste is Love, Like, Neutral, Dislike, Hate. You do not have to make dialogue for every part as there is Generic Dialogue that works with it. It is recommended to put Love, like, dislike and hate dialogue to keep the NPC original. Item codes can be found here: https://stardewvalleywiki.com/Modding:Object_data

IV. Sprites and Portraits

Sprites and portraits can be done in any kind of drawing program. The requirements for each are easy to remember: 16x32 per sprite and 64x64 per portrait. There are only a few rules to remember: Movement Frames: These will be used on the first 16 slots of your spritesheet (4 frames per direction) Kiss Frame: Frame 33 is the kiss frame for Females, Frame 35 is for males Flower Dance: If your NPC is to participate you need to reserve 40 - 47 for Females and 44 - 47 for males. Marriage: If you can marry your NPC, males need Frames 48- 50 to be reserved and 36 - 38 for Females. Portrait Order: The first image is your neutral face, which is used with no emotion codes. The second portrait should always be Happy ($h or $1). Below the first Portrait should be Sad ($s or $2), Next to that is Unique ($3 or $u), Below Sad should be Blush ($l or $4), Next to that is anger ($a or $5). After that you may put your portraits in any order.

V. Schedule See: https://stardewvalleywiki.com/Modding:Schedule_data VI. Dialogue and Marriage Dialogue See: https://stardewvalleywiki.com/Modding:Dialogue VII. Event Presence Just add them in as you would any NPC. See: https://stardewvalleywiki.com/Modding:Event_data


VIII. Adding your NPC via Content Patcher For simplicity, we will call our example NPC Dobson. Your mod should be made in a folder Which we can name [CP]Dobson, you do not have to name it as such but it will help identify your mod in a sea of mod folders. You must have the following files in your mod folder: content.json - the mod file itself. manifest.json - so SMAPI and Content Patch can identify your mod. DialogueDobson.json - This will be Dobson's Dialogue file. MarriageDialogueDobson.json - This is if you wish to marry Dobson DobsonSprite.png - This is Dobson's sprite frames DobsonPortrait.png - This contains Dobson's portraits DobsonSchedule.json - This contains where Dobson goes every day All the files except content.json and manifest.json can also be placed in a folder to keep your mod space clean. (such as you can make an assets folder for it to sit in) 1. Load all the data { "LogName": "Dobson Spitesheet", "Action": "Load", "Target": "Characters/Dobson", "FromFile": "DobsonSprite.png", }, A logname isn't required but you can use Patch Summary to see if it loads or not. The target, Characters/Dobson it is referring to the folder target of Content/Characters/Dobson.xnb, which doesn't exist but will be placed there. The "FromFile" must have the extention on it or it won't recognize your file.. if you placed all the assets in a separate folder then use something like "assets/DobsonSprite.png",. { "LogName": "Dobson Portrait", "Action": "Load", "Target": "Characters/Portraits/Dobson", "FromFile": "DobsonPortrait.png", }, This loads the Portraits into the game. { "LogName": "Dobson Dialogue", "Action": "Load", "Target": "Characters/Dialogue/Dobson", "FromFile": "DialogueDobson.json", }, This will load Dobson's Dialogue into the game. { "LogName": "Dobson Marriage Dialogue", "Action": "Load", "Target": "Characters/Dialogue/MarriageDialogueDobson", "FromFile": "MarriageDialogueDobson.json", }, This will load Dobson's marriage dialogue into the game. Remember that this is not needed if you are not making your NPC marriageable. { "LogName": "DobsonSchedule", "Action": "Load", "Target": "Characters/schedules/Dobson", "FromFile": "DobsonSchedule.json", }, This will load your NPC's Schedule into the game. That does it with your custom files.. now you need to Edit some existing files: { "LogName": "Add Dobson", "Action": "Edit Data", "Target": "Data/NPCDispositions", "Entries": { "Dobson": "adult/rude/neutral/positive/male/datable//Town/summer 7//BusStop 19 4/Dobson", }, }, This will change NPCDispositions and add your NPC in. { "LogName": "Dobson Gifts", "Action": "EditData", "Target": "Data/NPCGiftTastes", "Entries": { "Demetrius: "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/ ", }, }, This adds in the NPC's Gift Tastes. This will complete your character and will appear in a new game wondering around according to their schedule. If you wish to make Heart events for the NPC please see: https://stardewvalleywiki.com/Modding:Event_data