Adding NPCs (YW2)
Written by @n123original on Discord. This guide assumes you already know how to navigate romfs and use CfgBin Editor. If not, please read the starting guide.
Registering the NpcBin
- First, navigate to
data/res/map/common, and copynpc_common.npcbin. - Next, rename your copied file to
<NPC>.npcbin.<NPC>is a placeholder for your NPC’s internal name, for example, one might rename their file tosuperCoolNPC.npcbin.
- Next, navigate to
data/res/map/<MAP>/<MAP>here is a placeholder, for example, Uptown Springdale would bet101g00.
- Next, open the
npc.pck, and place your newly created.npcbininside this.pck. - Finally, save the
npc.pck.
Registering NPCSet
- Next, outside of the
.pck, open<MAP>_npc_set*.cfg.bin.<MAP>here is a placeholder, for example, Uptown Springdale would bet101g00.- The
*is a versioning placeholder. Meaning instead of justt101g00_npc_set.cfg.bin, files such ast101g00_npc_set_0.01b.cfg.binmay also exist. Pick the file with the highest version.
- Next, duplicate an
NPC_BASE_*entry, the new entry should appear at the end of the tree. - Next, set the
NPCIDto the CRC-32 hash of your NPC’s internal name. - Next, set the
BaseIDto your NPC’sBaseID. This determines the model used. - Next, pick an
NPCType. TheNPCTypedetermines the icon used on the minimap, here is a list:
Yo-kai Watch 2 NPCTypes:
- N/A (Used for cars)
- N/A
- Human (Blue Circle with Eyes)
- Yo-kai (Purple Whisp with Eyes)
- Shop (Green Circle with Eyes)
- Animal (Small Blue Circle with Eyes)
- Enemy (Red & Yellow Wisp with Eyes)
- Wayfarer Manor (Light Blue Wisp with Eyes)
- Locked Area (Lock Icon)
- Yo-kai2 (Darker Blurry Purple Whisp with Eyes)
- Eyepo Tail Right (Circle with Eyepo icon pointing south-east)
- Eyepo Tail Left (Circle with Eyepo icon pointing west, slightly to the south)
- Comic Book (Open blue book with blank pages)
- Medallium
- Human2 (Appears identical?)
- Blue Range (Old Lady Event)
- Bony War (Red Wisp with Eyes)
- Fleshy Ally (Blue Wisp with Eyes)
- Bony War Rock (Red Rock)
- Fleshy War Rock (Blue Rock)
- Bony Range (Bony War Red Circle)
- N/A (E-rank door doesn’t exist, hence there is no texture)
- D-Rank Watch Lock (Blue Watch Lock)
- C-Rank Watch Lock (Green Watch Lock)
- B-Rank Watch Lock (Red Watch Lock)
- A-Rank Watch Lock (Gold Watch Lock)
- S-Rank Watch Lock (Purple Watch Lock)
27+ are unregistered in Yo-kai Watch 2.
- Next, set all the other parameters to
0. - Next, increment (increase by 1) the
ChildCountof theNPC_BASEtree that contains the entries. - Next, click on the
NPC_APPEARtree. Take note of theChildCount. - Next, duplicate an
NPC_PRESET_*entry, the new entry should appear at the end of the tree. - Next, set the
NPCIDto your NPC’s ID. - Next, set the
NPCAppearStartPosto theChildCountyou have noted down earlier. - Next, set the
NPCAppearLengthto 1. - Next, increment (increase by 1) the
ChildCountof theNPC_PRESETtree that contains the entries. - Next, duplicate an
NPC_APPEAR_*entry, the new entry should appear at the end of the tree. - Next, set the first parameter to your NPC’s internal name.
- Next, set the
Cond(4th) and the 6th param to 0. - If you want to set a condition for the NPC to appear, change the
Condto the CExpression you wish to use. - Next, set the other parameters to
-1. - Finally, increment (increase by 1) the
ChildCountof theNPC_APPEARtree that contains the entries.
This is sufficient to have an NPC. But chances are, you want your NPC to do something.
[!WARNING] For now, this guide will not cover making the NPC actually talk, but will cover making it execute a trigger, and therefore running XQ.
Registering NPCTalk
- Next, open
<MAP>_npc_talk*.cfg.bin.<MAP>here is a placeholder, for example, Uptown Springdale would bet101g00.- The
*is a versioning placeholder. Meaning instead of justt101g00_npc_talk.cfg.bin, files such ast101g00_npc_talk_0.03d.cfg.binmay also exist. Pick the file with the highest version.
- Next, click on the
TALK_CONFIGtree. Take note of theChildCount. - Next, duplicate a
TALK_INFO_*entry, the new entry should appear at the end of the tree. - Next, set the
TalkConfigStartPosto theChildCountyou have noted down earlier. - Next, set the
TalkConfigLengthto 1. - Next, set the
NPCIDto your NPC’s ID. - Next, increment (increase by 1) the
ChildCountof theTALK_INFOtree that contains the entries. - Next, duplicate a
TALK_CONFIG_*entry, the new entry should appear at the end of the tree. - Next, set the first param to 1.
- Next, set every other param to 0.
- Next, set
ConditionalCondto 0. - Next, decide on whether you want your NPC to execute a trigger (and thus run XQ).
- If so, create an NPCTrigger (type 11) with your
NPCIDas theTriggerID. - Next, compile the CExpression
RunTrigger(0x<TriggerID)e.g., forTriggerID0x12345678, this would beRunTrigger(0x12345678). - Next, set that as your
TrigCond. - Next, increment (increase by 1) the
ChildCountof theTALK_CONFIGtree that contains the entries.