Line 1: |
Line 1: |
| ←[[Modding:Index|Index]] | | ←[[Modding:Index|Index]] |
| | | |
− | Animal data is stored in <samp>Content\Data\FarmAnimals.xnb</samp>, which can be [[Modding:Editing XNB files#unpacking|unpacked for editing]]. Here's the raw data as of {{version|1.5.1}} for reference:
| + | This page explains how to create and edit in-game [[Animals|farm animals]]. |
| | | |
− | ===Custom farm animals=== | + | ==Data format== |
− | You can now create and customize [[Animals|farm animals]] by editing the revamped <samp>Data/FarmAnimals</samp> asset. | + | You can add or edit farm animals by editing the <samp>Data/FarmAnimals</samp> [[Modding:Editing XNB files|asset]]. |
| | | |
| This consists of a string → model lookup, where... | | This consists of a string → model lookup, where... |
Line 10: |
Line 10: |
| * The value is a model with the fields listed below. | | * The value is a model with the fields listed below. |
| | | |
− | ====Main info====
| + | ===Main info=== |
| {| class="wikitable" | | {| class="wikitable" |
| |- | | |- |
Line 39: |
Line 39: |
| |} | | |} |
| | | |
− | ====Animal shop====
| + | ===Animal shop=== |
| These fields affect how this farm animal type is shown in [[Marnie's Ranch|Marnie's animal shop]]. Animals are automatically listed if they have a valid <samp>PurchasePrice</samp> value. | | These fields affect how this farm animal type is shown in [[Marnie's Ranch|Marnie's animal shop]]. Animals are automatically listed if they have a valid <samp>PurchasePrice</samp> value. |
| | | |
Line 77: |
Line 77: |
| ! field | | ! field |
| ! effect | | ! effect |
| + | |- |
| + | | <samp>ID</samp> |
| + | | The [[Modding:Common data field types#Unique string ID|unique string ID]] for is purchase type within the current list. |
| |- | | |- |
| | <samp>AnimalIDs</samp> | | | <samp>AnimalIDs</samp> |
Line 88: |
Line 91: |
| |} | | |} |
| | | |
− | ====Hatching====
| + | ===Hatching=== |
| {| class="wikitable" | | {| class="wikitable" |
| |- | | |- |
Line 127: |
Line 130: |
| |} | | |} |
| | | |
− | ====Growth====
| + | ===Growth=== |
| {| class="wikitable" | | {| class="wikitable" |
| |- | | |- |
Line 140: |
Line 143: |
| |} | | |} |
| | | |
− | ====Produce====
| + | ===Produce=== |
| {| class="wikitable" | | {| class="wikitable" |
| |- | | |- |
Line 168: |
Line 171: |
| |- | | |- |
| | <samp>DaysToProduce</samp> | | | <samp>DaysToProduce</samp> |
− | | ''(Optional)'' The number of days between item productions. For example, setting <samp>1</samp> will produce an item every other day. Default 1. | + | | ''(Optional)'' The number of days between item productions. For example, setting <samp>1</samp> will produce an item every day. Default 1. |
| |- | | |- |
| | <samp>ProduceOnMature</samp> | | | <samp>ProduceOnMature</samp> |
Line 221: |
Line 224: |
| | <samp>HarvestTool</samp> | | | <samp>HarvestTool</samp> |
| | ''(Optional)'' The [[#Custom items|tool ID]] with which produced items can be collected from the animal, if the <samp>HarvestType</samp> is set to <samp>HarvestWithTool</samp>. The values recognized by the vanilla tools are <samp>Milk Pail</samp> and <samp>Shears</samp>. Default none. | | | ''(Optional)'' The [[#Custom items|tool ID]] with which produced items can be collected from the animal, if the <samp>HarvestType</samp> is set to <samp>HarvestWithTool</samp>. The values recognized by the vanilla tools are <samp>Milk Pail</samp> and <samp>Shears</samp>. Default none. |
− | | + | |- |
| + | | <samp>CanEatGoldenCrackers</samp> |
| + | | ''(Optional)'' Whether players can feed this animal a golden cracker to double its normal output. Default true. |
| |} | | |} |
| | | |
− | ====Audio & sprite====
| + | ===Audio & sprite=== |
| {| class="wikitable" | | {| class="wikitable" |
| |- | | |- |
Line 237: |
Line 242: |
| |- | | |- |
| | <samp>Texture</samp> | | | <samp>Texture</samp> |
− | | ''(Optional)'' The asset name for the animal's spritesheet. Defaults to <samp>Animals/{{t|ID}}</samp> (like <samp>Animals/Goat</samp> for a [[goat]]). This asset must exist even if you use <samp>Skins</samp> below, since the default appearance is automatically an available skin. | + | | ''(Optional)'' The asset name for the animal's spritesheet. Defaults to <samp>Animals/{{t|ID}}</samp> (like <samp>Animals/Goat</samp> for a [[goat]]). This asset must exist even if you use <samp>Skins</samp> below, since the default appearance is automatically an available skin. See [[#Spritesheet layout|spritesheet layout]]. |
| |- | | |- |
| | <samp>HarvestedTexture</samp> | | | <samp>HarvestedTexture</samp> |
Line 246: |
Line 251: |
| |- | | |- |
| | <samp>UseFlippedRightForLeft</samp> | | | <samp>UseFlippedRightForLeft</samp> |
− | | ''(Optional)'' When the animal is facing left, whether to use a flipped version of their right-facing sprite. Default false. | + | | ''(Optional)'' When the animal is facing left, whether to use a flipped version of their right-facing sprite. See [[#Spritesheet layout|spritesheet layout]] for more info. Default false. |
| |- | | |- |
| | <samp>SpriteWidth</samp><br /><samp>SpriteHeight</samp> | | | <samp>SpriteWidth</samp><br /><samp>SpriteHeight</samp> |
Line 275: |
Line 280: |
| | ''(Optional)'' Overrides the equivalent main field when this skin is selected. Defaults to the main field's value. | | | ''(Optional)'' Overrides the equivalent main field when this skin is selected. Defaults to the main field's value. |
| |} | | |} |
| + | |- |
| + | | <samp>SleepFrame</samp> |
| + | | ''(Optional)'' The sprite index in the texture to display when sleeping. Default 12. |
| + | |- |
| + | | <samp>UseDoubleUniqueAnimationFrames</samp> |
| + | | ''(Optional)'' Whether the texture has two frames for the randomized 'unique' animation instead of one. See [[#Spritesheet layout|spritesheet layout]] for more info. Default false. |
| + | |
| + | The unique animation sprite indexes are: |
| + | * If false: 13 (down), 14 (right), 12 (left if <samp>UseFlippedRightForLeft</samp> is false), and 15 (up). |
| + | * If true: 16 (down), 18 (right), 22 (left), and 20 (up). |
| |- | | |- |
| | <samp>ShadowWhenBaby</samp><br /><samp>ShadowWhenBabySwims</samp><br /><samp>ShadowWhenAdult</samp><br /><samp>ShadowWhenAdultSwims</samp> | | | <samp>ShadowWhenBaby</samp><br /><samp>ShadowWhenBabySwims</samp><br /><samp>ShadowWhenAdult</samp><br /><samp>ShadowWhenAdultSwims</samp> |
Line 297: |
Line 312: |
| |} | | |} |
| | | |
− | ====Player profession effects====
| + | ===Player profession effects=== |
| {| class="wikitable" | | {| class="wikitable" |
| |- | | |- |
Line 313: |
Line 328: |
| |} | | |} |
| | | |
− | ====Behavior====
| + | ===Behavior=== |
| {| class="wikitable" | | {| class="wikitable" |
| |- | | |- |
Line 340: |
Line 355: |
| |} | | |} |
| | | |
− | ====Other====
| + | ===Other=== |
| {| class="wikitable" | | {| class="wikitable" |
| |- | | |- |
Line 355: |
Line 370: |
| ! field | | ! field |
| ! effect | | ! effect |
| + | |- |
| + | | <samp>ID</samp> |
| + | | The [[Modding:Common data field types#Unique string ID|unique string ID]] for this entry within the current list. |
| |- | | |- |
| | <samp>StatName</samp> | | | <samp>StatName</samp> |
Line 370: |
Line 388: |
| |} | | |} |
| | | |
| + | ==Spritesheet layout== |
| + | ===Explanation=== |
| + | Each farm animal's spritesheet must have exactly 4 columns, and at least 5–7 rows (depending on the data fields). The sprite size depends on the [[#Audio & sprite|<samp>SpriteWidth</samp> and <samp>SpriteHeight</samp>]] fields; for example, the default sprite width of 16 pixels means the spritesheet must be exactly 4 × 16 = 64 pixels wide. |
| + | |
| + | The expected rows are: |
| + | # move down; |
| + | # move right; |
| + | # move up; |
| + | # move left ('''only''' if <samp>UseFlippedRightForLeft</samp> is false); |
| + | # unique animations 1; |
| + | # unique animations 2 ('''only''' if <samp>UseDoubleUniqueAnimationFrames</samp> is true); |
| + | # eat. |
| + | |
| + | For example, the default layout (with <samp>UseFlippedRightForLeft</samp> and <samp>UseDoubleUniqueAnimationFrames</samp> both false) 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) |
| + | | 9 (move up) |
| + | | 10 (move up) |
| + | | 11 (move up) |
| + | |- |
| + | | 12 (''unused'') |
| + | | 13 (unique down) |
| + | | 14 (unique right) |
| + | | 15 (unique up) |
| + | |- |
| + | | 16 (eat 1) |
| + | | 17 (eat 1) |
| + | | 18 (eat 1) |
| + | | 19 (eat 1) |
| + | |} |
| + | |
| + | When both are true, that becomes: |
| + | {| 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) |
| + | | 9 (move up) |
| + | | 10 (move up) |
| + | | 11 (move up) |
| + | |- |
| + | | 12 (move left) |
| + | | 13 (move left) |
| + | | 14 (move left) |
| + | | 15 (move left) |
| + | |- |
| + | | 16 (unique down 1) |
| + | | 17 (unique down 2) |
| + | | 18 (unique right 1) |
| + | | 19 (unique right 2) |
| + | |- |
| + | | 20 (unique up 1) |
| + | | 21 (unique up 2) |
| + | | 22 (unique left 1) |
| + | | 23 (unique left 2) |
| + | |- |
| + | | 24 (eat 1) |
| + | | 25 (eat 1) |
| + | | 26 (eat 1) |
| + | | 27 (eat 1) |
| + | |} |
| + | |
| + | ===Pre-1.6 vanilla layouts=== |
| + | Before Stardew Valley 1.6, there were two main spritesheet layouts depending on whether the animal lived in a [[barn]] or [[coop]]. If you want to match the previous spritesheet layouts (e.g. to update a pre-1.6 custom animal), the options to set are: |
| + | <syntaxhighlight lang="js"> |
| + | // for barn animals |
| + | "UseFlippedRightForLeft": true, |
| + | "UseDoubleUniqueAnimationFrames": false |
| + | |
| + | // for coop animals |
| + | "UseFlippedRightForLeft": false, |
| + | "UseDoubleUniqueAnimationFrames": true |
| + | </syntaxhighlight> |
| [[Category:Modding]] | | [[Category:Modding]] |
| | | |
| [[ru:Модификации:Животные]] | | [[ru:Модификации:Животные]] |