With this mod, you can create Content Patcher content packs that specify certain items as wearable by certain NPCs.
Wearables are not limited to items that are normally giftable - you can specify any item as wearable and give it to an assigned NPC.
Wearables can be assigned arbitrary slot names (e.g. "hat") and they will randomly choose a single item with that slot name to wear on a given day.
Wearables can be assigned a percent chance to be worn on any given day.
To remove a wearable item from an NPC's clothing list, try to gift them the same item again (it won't be given and the item will be removed from the NPC's clothing list).
Wearables are worn by editing character and portrait sprite sheets directly when loaded, so if you use custom character sheets you may have to adjust the clothing sprite sheets accordingly.
Content Packs
Here is an example content.json file:
{ <br /> "Format": "1.23.0", <br /> "Changes": [ <br /> { <br /> "Action": "EditData", <br /> "Target": "aedenthorn.NPCClothing/dictionary", <br /> "Entries": { <br /> "hat_0": { <br /> "id": "hat_0", <br /> "giftName": "Cowboy Hat", <br /> "giftReaction": "like", <br /> "clothingSlot": "hat", <br /> "spriteTexturePath": "aedenthorn.NCFHatsCP/hat_0_sprite", <br /> "portraitTexturePath": null, <br /> "spriteOffsets": [ <br /> { <br /> "offset": { <br /> "X": 0, <br /> "Y": -3 <br /> }, <br /> "names": [ <br /> "Demetrius" <br /> ], <br /> "ages": null, <br /> "genders": null <br /> } <br /> ], <br /> "portraitOffsets": null, <br /> "namesAllow": [ <br /> "Demetrius", <br /> "Abigail", <br /> "George", <br /> "Evelyn" <br /> ], <br /> "namesForbid": null, <br /> "agesAllow": null, <br /> "gendersAllow": null, <br /> "skinColors": null, <br /> "percentChance": 100, <br /> "zIndex": 0, <br /> } <br /> } <br /> }, <br /> { <br /> "Action": "Load", <br /> "Target": "aedenthorn.NCFHatsCP/hat_0_sprite", <br /> "FromFile": "assets/hat_0_sprite.png" <br /> } <br /> ] <br />}
The dictionary path for Target is aedenthorn.NPCClothing/dictionary. Entry explanations:
- id is arbitrary, but should be the same as the entry key
- giftName is the name of the item (not the display name) - if omitted, this clothing will be worn without having given any gift.
- giftReaction is only for items that are normally not giftable. One of love, like, dislike, hate, neutral.
- clothingSlot - arbitrary slot name; only one clothing item of a given slot can be worn at a time.
- spriteTexturePath - fake path to the sprite texture for Content Patcher. This will overlay on top of the character's sprite sheet.
- portraitTexturePath - same for portrait texture (you can omit either for clothing to only be shown in sprite or portrait).
- spriteOffsets - pixel offsets allow you to use a single tile sheet for different size characters by name, age, or gender. Ages are child, teen, adult; genders are male, female, undefined.
- portraitOffsets - same.
- namesAllow - list of names to allow.
- namesForbid - list of names to forbid (all other villagers will be allowed to wear).
- agesAllow - list of ages to allow. Ages are child, teen, adult.
- gendersAllow - list of genders to allow. Genders are male, female, undefined.
- skinColors - ignore for now.
- percentChance - percent chance of wearing this clothing on any given day (use Content Patcher for other wearing logic).
- zIndex - arbitrary integer specifying draw order (clothing with higher numbers will be drawn on top of those with lower numbers).
Textures
Textures will be scanned for non-transparent pixels, which will be overlaid on top of the existing pixel, except when the new pixel's opacity is less than 10%. Use such almost-transparent pixels to tell the mod to replace the existing sprite pixel with a transparent pixel (useful for covering hair, for example).
Mods that use this framework:
Technical
Requires SMAPI, uses Harmony.
Implements a Generic Mod Config Menu interface to change config settings in-game.
Compatible with Mod Updater for automatic updates.
Code is at https://github.com/aedenthorn/StardewValleyMods.
If you want to complain or ask for help or help me test my mods, you can visit my Discord server.
A list of all my mods for Stardew Valley is available at https://www.nexusmods.com/stardewvalley/articles/895.