Difference between revisions of "Modding:Pets"
(add info from Modding:Migrate to Stardew Valley 1.6 (main author Pathoschild, Tlitookilakin, with formatting fixes by Margotbean)) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
==Data Format== | ==Data Format== | ||
− | You can | + | You can create and customize [[Animals#Cat or Dog|pets]] & pet breeds by editing the <samp>Data/Pets</samp> asset. |
This consists of a string → model lookup, where... | This consists of a string → model lookup, where... | ||
Line 27: | Line 27: | ||
|- | |- | ||
| <samp>BarkSound</samp> | | <samp>BarkSound</samp> | ||
− | | The [[ | + | | The [[Modding:Audio|cue ID]] for the pet's occasional 'bark' sound. |
|- | |- | ||
| <samp>ContentSound</samp> | | <samp>ContentSound</samp> | ||
− | | The [[ | + | | The [[Modding:Audio|cue ID]] for the sound which the pet makes when you pet it. |
|- | |- | ||
| <samp>RepeatContentSoundAfter</samp> | | <samp>RepeatContentSoundAfter</samp> | ||
Line 188: | Line 188: | ||
|- | |- | ||
| <samp>SoundOnStart</samp> | | <samp>SoundOnStart</samp> | ||
− | | ''(Optional)'' The [[ | + | | ''(Optional)'' The [[Modding:Audio|audio cue ID]] for the sound to play when the state starts. If set to <samp>BARK</samp>, the pet's <samp>BarkSound</samp> (or breed's <samp>BarkOverride</samp>) field is used. Defaults to none. |
|- | |- | ||
| <samp>SoundRange</samp><br /><samp>SoundRangeFromBorder</samp> | | <samp>SoundRange</samp><br /><samp>SoundRangeFromBorder</samp> | ||
Line 261: | Line 261: | ||
|- | |- | ||
| <samp>Sound</samp> | | <samp>Sound</samp> | ||
− | | ''(Optional)'' The [[ | + | | ''(Optional)'' The [[Modding:Audio|audio cue ID]] for the sound to play when the animation starts or loops. If set to <samp>BARK</samp>, the pet's <samp>BarkSound</samp> (or breed's <samp>BarkOverride</samp>) field is used. Defaults to none. |
|- | |- | ||
| <samp>SoundRange</samp><br /><samp>SoundRangeFromBorder</samp><br /><samp>SoundIsVoice</samp> | | <samp>SoundRange</samp><br /><samp>SoundRangeFromBorder</samp><br /><samp>SoundIsVoice</samp> | ||
Line 320: | Line 320: | ||
|- | |- | ||
| <samp>CustomFields</samp> | | <samp>CustomFields</samp> | ||
− | | The [[# | + | | The [[Modding:Common_data_field_types#Custom_fields|custom fields]] for this entry. |
|} | |} | ||
+ | ==Spritesheet layout== | ||
+ | ===Explanation=== | ||
+ | Each farm animal's spritesheet must have exactly 4 columns. The sprite size is expected to be 32x32. | ||
+ | |||
+ | The expected rows are: | ||
+ | # move down; | ||
+ | # move right; | ||
+ | # move up; | ||
+ | # move left | ||
+ | # unique animations 1; | ||
+ | # unique animations 2; | ||
+ | # unique animations 3; | ||
+ | # sleep and unique animations 4; | ||
+ | # unique animations 5 | ||
+ | |||
+ | For example, the default layout is: | ||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | 0 (move down 1) | ||
+ | | 1 (move down 2) | ||
+ | | 2 (move down 3) | ||
+ | | 3 (move down 4) | ||
+ | |- | ||
+ | | 4 (move right 1) | ||
+ | | 5 (move right 2) | ||
+ | | 6 (move right 3) | ||
+ | | 7 (move right 4) | ||
+ | |- | ||
+ | | 8 (move up 1) | ||
+ | | 9 (move up 2) | ||
+ | | 10 (move up 3) | ||
+ | | 11 (move up 4) | ||
+ | |- | ||
+ | | 12 (move left 1) | ||
+ | | 13 (move left 2) | ||
+ | | 14 (move left 3) | ||
+ | | 15 (move left 4) | ||
+ | |- | ||
+ | | 16 (unique) | ||
+ | | 17 (unique) | ||
+ | | 18 (unique) | ||
+ | | 19 (unique) | ||
+ | |- | ||
+ | | 20 (unique) | ||
+ | | 21 (unique) | ||
+ | | 22 (unique) | ||
+ | | 23 (unique) | ||
+ | |- | ||
+ | | 24 (unique) | ||
+ | | 25 (unique) | ||
+ | | 26 (unique) | ||
+ | | 27 (unique) | ||
+ | |- | ||
+ | | 28 (sleep 1) | ||
+ | | 29 (sleep 2) | ||
+ | | 30 (unique) | ||
+ | | 31 (unique) | ||
+ | |- | ||
+ | | 32 (unique) | ||
+ | | 33 (unique) | ||
+ | | 34 (unique) | ||
+ | | 35 (unique) | ||
+ | |} | ||
+ | |||
+ | The rows for moving down, right, up, and left will be used when copy/pasting the Walk behavior from the cat, dog, or turtle. If you don't use that behavior, you can actually put things that aren't moving up, down, or left there. However, in the absence of any defined Behavior, the pet will still use frames 28 and 29 for sleeping, and when being pushed it will use frames 0, 4, 8, or 12 depending on which direction the player is pushing from (e.g. if pushing from the left in order to move right, the pet will face right, using frame 4). | ||
[[Category:Modding]] | [[Category:Modding]] |
Latest revision as of 02:54, 1 July 2024
← Index
This page documents how the game stores and parses data for pets. This is an advanced guide for mod developers.
Data Format
You can create and customize pets & pet breeds by editing the Data/Pets asset.
This consists of a string → model lookup, where...
- The key is a unique string ID for the pet (not the pet breed). The vanilla IDs are Cat and Dog.
- The value is a model with the fields listed below.
Basic info
field | effect |
---|---|
DisplayName | A tokenizable string for the pet type's display name (e.g. "cat" or "dog"). For example, the vanilla adoption events show this when Marnie asks if you want to adopt the cat/dog. |
Audio & sprites
field | effect |
---|---|
BarkSound | The cue ID for the pet's occasional 'bark' sound. |
ContentSound | The cue ID for the sound which the pet makes when you pet it. |
RepeatContentSoundAfter | (Optional) The number of milliseconds until the ContentSound is repeated once. This is used by the dog, who pants twice when pet. Defaults to -1 (disabled). |
EmoteOffset | (Optional) A pixel offset for the emote drawn above the pet sprite, specified as an object with X and Y fields. For example, this affects the heart emote shown after petting it. Default none. |
Events
field | effect | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
EventOffset | (Optional) The pixel offset for the pet when shown in events like Marnie's adoption event, specified as an object with X and Y fields. Default none. | ||||||||||||
AdoptionEventLocation AdoptionEventId |
(Optional) If both fields are set, the location and event ID which lets the player adopt this pet. This forces the event to play after 20 days if its preconditions haven't been met yet. Default Farm and none respectively. | ||||||||||||
SummitPerfectionEvent | (Optional) How to render the pet during the summit perfection slideshow. If this isn't set, the pet won't be shown in the slideshow.
This consists of a model with these fields:
|
Gifts
field | effect | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
GiftChance | (Optional) The random probability each day that the pet will give the player a gift from the Gifts list when they interact with the pet. Specified as a value between 0 (never) and 1 (always). Default .2 (20% chance). | ||||||||||||
Gifts | (Optional) The list of gifts that this pet can give if the GiftChance is successful. Default none.
This consists of a list of models with these fields:
|
Behavior
field | effect | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Id | The unique string ID for this entry within the list. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MoveSpeed | (Optional) How quickly the pet can move. Default 2. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SleepOnBedChance SleepNearBedChance SleepOnRugChance |
(Optional) The percentage chances for the locations where the pet will sleep each night, as a decimal value between 0 (never) and 1 (always). Each value is checked in the order listed at left until a match is found. If none of them match, the pet will choose a random empty spot in the farmhouse; if none was found, it'll sleep next to its pet bowl outside. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Behaviors | The pet's possible actions and behaviors, defined as the states in a state machine. Essentially the pet will be in one state at any given time, which also determines which state they can transition to next. For example, a cat can transition from Walk to BeginSitDown, but it can't skip instantly from Walk to SitDownLick.
This consists of a list of models with these fields:
|
Breeds
field | effect | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Breeds | The cosmetic breeds which can be selected in the character customization menu when creating a save. This consists of a list of models with these fields:
|
Advanced
field | effect |
---|---|
CustomFields | The custom fields for this entry. |
Spritesheet layout
Explanation
Each farm animal's spritesheet must have exactly 4 columns. The sprite size is expected to be 32x32.
The expected rows are:
- move down;
- move right;
- move up;
- move left
- unique animations 1;
- unique animations 2;
- unique animations 3;
- sleep and unique animations 4;
- unique animations 5
For example, the default layout is:
0 (move down 1) | 1 (move down 2) | 2 (move down 3) | 3 (move down 4) |
4 (move right 1) | 5 (move right 2) | 6 (move right 3) | 7 (move right 4) |
8 (move up 1) | 9 (move up 2) | 10 (move up 3) | 11 (move up 4) |
12 (move left 1) | 13 (move left 2) | 14 (move left 3) | 15 (move left 4) |
16 (unique) | 17 (unique) | 18 (unique) | 19 (unique) |
20 (unique) | 21 (unique) | 22 (unique) | 23 (unique) |
24 (unique) | 25 (unique) | 26 (unique) | 27 (unique) |
28 (sleep 1) | 29 (sleep 2) | 30 (unique) | 31 (unique) |
32 (unique) | 33 (unique) | 34 (unique) | 35 (unique) |
The rows for moving down, right, up, and left will be used when copy/pasting the Walk behavior from the cat, dog, or turtle. If you don't use that behavior, you can actually put things that aren't moving up, down, or left there. However, in the absence of any defined Behavior, the pet will still use frames 28 and 29 for sleeping, and when being pushed it will use frames 0, 4, 8, or 12 depending on which direction the player is pushing from (e.g. if pushing from the left in order to move right, the pet will face right, using frame 4).