NPC Helper 2/Docs

Create an NPC

Replacing images from other mods

How NPC Helper 2 chooses between the images of an NPC's own mod and the outfit and portrait packs that change it, what is replaced, and what the log says.

An NPC's images can come from more than one mod: the NPC's own mod, and any number of outfit packs and portrait packs that change her. This page explains which image the game ends up using. It applies to sprites and portraits alike, and needs NPC Helper 2.4.3 or later.

Which mods are looked at#

NPC Helper 2 looks in the content packs for NPC Helper 2, the mods whose manifest.json says ContentPackFor Framework.Mod.NpcHelper. In each one it looks only in NPCs/<Npc>/sprites and NPCs/<Npc>/portraits, where <Npc> is the NPC's name. It never scans the rest of the Mods folder, and it never reads images from a mod that is not a content pack for NPC Helper 2.

How an image is chosen#

Every image has a name: Default, Marriage (portraits only), or a variant name such as Beach_Summer, Hospital, summer or spring13. Sprites and portraits are separate: sprites/Default.png and portraits/Default.png are different images and are decided one at a time.

For each name, NPC Helper 2 collects the files with that name:

  1. The NPC's own mod, if it has one.
  2. Each other content pack that has one, in folder order.

The last one in that list is used. So an image in another mod replaces the NPC's own image of the same name, and when several other mods have the same name, the last of them in folder order wins. An image with a name nobody else has is simply added.

Names are matched without regard to case, so Beach_Summer.png and beach_summer.png are the same image. Festival names are matched by the festival: spring13.png, Spring13.png and Spring_13.png are all the Egg Festival.

What each name does#

Name In sprites/ In portraits/
Default The NPC's main sprite sheet. Another mod's Default.png replaces it everywhere. The NPC's main portrait sheet.
Marriage Not used. The portrait shown during the wedding vows.
<Location>, <Season>, <Location>_<Season> An outfit for that place and season. The same, for portraits.
<festival ID>, Festival A festival outfit. The same, for portraits.

For where each outfit is worn, and which one wins when several apply to the same moment, see Image variants. That order is a separate step: it picks among the outfits that exist. This page decides what the files behind those names are.

Folder order#

When more than one other mod has the same name, the order is the order of the mods' folders, compared by their whole path in plain character order: digits first, then capital letters, then lowercase letters. The folder that comes later wins. For example, Mods/Anime Portraits comes before Mods/Zen Portraits, so with both installed the portraits of Zen Portraits are used.

Players can change which one wins by removing one of the mods. Authors should not depend on the order. Say on the mod page that the pack conflicts with other packs for the same NPC.

Examples#

NPC's own mod Other mods Result
sprites/Default.png Outfit pack has sprites/Default.png The outfit pack's sprite.
sprites/Hospital.png Outfit pack has sprites/Hospital.png The outfit pack's image.
sprites/Hospital.png Outfit pack has sprites/Beach_Summer.png Both are available: Hospital.png in the hospital, Beach_Summer.png at the beach in summer.
portraits/Default.png Portrait pack A and portrait pack B both have portraits/Default.png The one in the folder that comes later.
portraits/Default.png and portraits/Hospital.png Portrait pack has only portraits/Default.png The pack's Default.png, but her own Hospital.png in the hospital.
sprites/Default.png Portrait pack has portraits/Default.png Her own sprite and the pack's portrait. They are separate.
No sprites/Default.png Outfit pack has sprites/Default.png The outfit pack's sprite. The missing image is no longer reported.

What the log says#

When another mod takes part, NPC Helper 2 says which image it chose and which it replaced:

text
sprites/Default.png comes from mod 'Dr. Rei - Beach Outfit', replacing the NPC's own pack.
sprites/Beach_Summer.png comes from mod 'Dr. Rei - Beach Outfit'.
portraits/Default.png comes from mod 'Zen Portraits', replacing the NPC's own pack, mod 'Anime Portraits' (several mods provide it; the last one in folder order is used).
  • The first line replaces the NPC's own image.
  • The second is an image the NPC did not have, so nothing is replaced.
  • The third is a choice between several mods. It names the one used, and every one it replaced, the NPC's own pack first.

The mod's name in these messages is its folder name. For a pack that adds no NPC, the log also lists what the pack contains, for example Outfit pack for Rei: sprites Beach_Summer; portraits Beach_Summer.

An image in the NPC's own mod that nobody replaces is not mentioned.

Portrait scale of each file#

A portrait that comes from another mod is read at the scale that mod sets with PortraitScale in its mod.toml. If it sets none, the portrait is read at the NPC's scale. This is decided for each file, so one NPC can show a normal-size portrait from her own mod in one place and a 2x portrait from a portrait pack in another. See Choose the portrait scale.

Replacing the main sprite#

A sprites/Default.png from another mod is used for every frame of the NPC, so it must have the frames the NPC needs: the four walking rows, and for a marriageable NPC the spouse kiss (frame 28), the wedding frames (36 to 38), and the sleeping frame set as SleepFrame in her [Home] table. NPC Helper 2 checks the sprite sheet it ends up using, including one that comes from another mod, and warns about each empty or missing frame.

Outfits that come from another mod are not checked. If an outfit can be worn while the NPC kisses, sleeps or marries, make sure it has those frames. See Sprites.

What a pack cannot replace#

Only the images in sprites/ and portraits/. A pack that changes an NPC cannot change her dialogue, schedule, gifts, events, marriage text or any other data. A translation pack can change her text. See Localization.