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 copy npc_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 to superCoolNPC.npcbin.
  • Next, navigate to data/res/map/<MAP>/
    • <MAP> here is a placeholder, for example, Uptown Springdale would be t101g00.
  • Next, open the npc.pck, and place your newly created .npcbin inside 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 be t101g00.
    • The * is a versioning placeholder. Meaning instead of just t101g00_npc_set.cfg.bin, files such as t101g00_npc_set_0.01b.cfg.bin may 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 NPCID to the CRC-32 hash of your NPC’s internal name.
  • Next, set the BaseID to your NPC’s BaseID. This determines the model used.
  • Next, pick an NPCType. The NPCType determines the icon used on the minimap, here is a list:

Yo-kai Watch 2 NPCTypes:

  1. N/A (Used for cars)
  2. N/A
  3. Human (Blue Circle with Eyes)
  4. Yo-kai (Purple Whisp with Eyes)
  5. Shop (Green Circle with Eyes)
  6. Animal (Small Blue Circle with Eyes)
  7. Enemy (Red & Yellow Wisp with Eyes)
  8. Wayfarer Manor (Light Blue Wisp with Eyes)
  9. Locked Area (Lock Icon)
  10. Yo-kai2 (Darker Blurry Purple Whisp with Eyes)
  11. Eyepo Tail Right (Circle with Eyepo icon pointing south-east)
  12. Eyepo Tail Left (Circle with Eyepo icon pointing west, slightly to the south)
  13. Comic Book (Open blue book with blank pages)
  14. Medallium
  15. Human2 (Appears identical?)
  16. Blue Range (Old Lady Event)
  17. Bony War (Red Wisp with Eyes)
  18. Fleshy Ally (Blue Wisp with Eyes)
  19. Bony War Rock (Red Rock)
  20. Fleshy War Rock (Blue Rock)
  21. Bony Range (Bony War Red Circle)
  22. N/A (E-rank door doesn’t exist, hence there is no texture)
  23. D-Rank Watch Lock (Blue Watch Lock)
  24. C-Rank Watch Lock (Green Watch Lock)
  25. B-Rank Watch Lock (Red Watch Lock)
  26. A-Rank Watch Lock (Gold Watch Lock)
  27. 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 ChildCount of the NPC_BASE tree that contains the entries.
  • Next, click on the NPC_APPEAR tree. Take note of the ChildCount.
  • Next, duplicate an NPC_PRESET_* entry, the new entry should appear at the end of the tree.
  • Next, set the NPCID to your NPC’s ID.
  • Next, set the NPCAppearStartPos to the ChildCount you have noted down earlier.
  • Next, set the NPCAppearLength to 1.
  • Next, increment (increase by 1) the ChildCount of the NPC_PRESET tree 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 Cond to the CExpression you wish to use.
  • Next, set the other parameters to -1.
  • Finally, increment (increase by 1) the ChildCount of the NPC_APPEAR tree 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 be t101g00.
    • The * is a versioning placeholder. Meaning instead of just t101g00_npc_talk.cfg.bin, files such as t101g00_npc_talk_0.03d.cfg.bin may also exist. Pick the file with the highest version.
  • Next, click on the TALK_CONFIG tree. Take note of the ChildCount.
  • Next, duplicate a TALK_INFO_* entry, the new entry should appear at the end of the tree.
  • Next, set the TalkConfigStartPos to the ChildCount you have noted down earlier.
  • Next, set the TalkConfigLength to 1.
  • Next, set the NPCID to your NPC’s ID.
  • Next, increment (increase by 1) the ChildCount of the TALK_INFO tree 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 ConditionalCond to 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 NPCID as the TriggerID.
  • Next, compile the CExpression RunTrigger(0x<TriggerID) e.g., for TriggerID 0x12345678, this would be RunTrigger(0x12345678).
  • Next, set that as your TrigCond.
  • Next, increment (increase by 1) the ChildCount of the TALK_CONFIG tree that contains the entries.

This site uses Just the Docs, a documentation theme for Jekyll.