Skip to content

Using Mappet with CustomNPCs

McHorse edited this page Aug 13, 2022 · 3 revisions

Even though CustomNPCs mod is sort of an alternative to Mappet, Mappet has some weak sides (specifically NPCs), so this page should document some tips and tricks that you can use in order to use powerful parts of both mods to its full potential. Without further ado, here are the tips:

1. Making CustomNPCs use morphs

If you want to use a custom model for a CustomNPCs' NPC, there is no really way to do it out of the box. The only way to make CustomNPCs' NPCs to have custom models is by using Metamorph's client side feature called entity selectors. This feature has its own dedicated video tutorial, and there is a section on 02:54 that shows how to use it with CustomNPCs.

The major drawback of this feature is that it's client sided. So if you would want to enforce the model on a server, you would need to make sure that players will have the same configuration files (entity selectors are located in config/metamorph/selectors.json).

2. Connecting Mappet dialogues to CustomNPCs

The easiest way to make CustomNPCs open a dialogue upon right clicking them is by following these steps:

  1. Spawn an NPC using Npc Wand (brown hoe).
  2. Grab Scripter item (brown shovel), and right click the NPC while holding Scripter item.
  3. Click on No where it says Enabled (the button should switch to Yes). This is very important, otherwise it won't work!
  4. Click on + button, which is on the right next to the Settings tab.
  5. Insert following script:
function interact(event)
{
    event.npc.executeCommand("/mp dialogue open " + event.player.name + " dialogue_id")
}

Where dialogue_id is dialogue's ID (name in the sidebar). This tip is possible thanks to Jvonlins!

3. Quests kill objective featuring a CustomNPCs' NPC

To allow Mappet quests to target CustomNPCs' NPCs as a kill objective, follow these steps:

  1. Spawn an NPC using Npc Wand (brown hoe).
  2. Grab Scripter item (brown shovel), and right click the NPC while holding Scripter item.
  3. Click on No where it says Enabled (the button should switch to Yes). This is very important, otherwise it won't work!
  4. Click on + button, which is on the right next to the Settings tab.
  5. Insert following script:
function init(event)
{
    event.npc.getNbt().setInteger("quest_target", 1);
}

Where quest_target could be literally any string key, and 1 could also be different value. Then in a quest:

  1. Create Kill objective (click + on the right of Objectives, and Add Kill Objective).
  2. Click Pick entity ID... and find in the list customnpcs:customnpc.
  3. Insert into Matching NBT: {ForgeData:{quest_target:1}}.
  4. Change Count to something other than 0.

After that, this quest should be able to recognize killing of an NPC you configured with quest_target data script as a kill objective. If you can't kill a CustomNPCs' NPC, use the Npc Wand item on it, click Advanced tab, Factions, and pick Aggressive. After that, you should be able to kill that NPC (you may want to change Stats > Respawn options as well).

For different NPCs, you can give them different values other than quest_target or 1. When changing that for different NPCs, make sure to reflect those changes in Matching NBT field.

Special thanks to dyamo for giving a tip to use ForgeData to match the kill objective with an NPC.

Clone this wiki locally