General

PlayerModelNpcs Integration

The PlayerModelNpcs mod lets server staff place NPCs in game and give them a look and a dialogue in its editor. With the framework installed next to it, those NPCs can also give quests, accept and complete quests from their dialogue and write to the quest journal. You set all of this up in game; no entity files are needed.

💡 See also: Quest Givers (per-NPC config, appearance commands) - Dialogues (trigger reference) - Quest Journal


What you get

Nothing to enable: when both mods are loaded, the framework adds two behaviors to the PlayerModelNpcs NPC entity (playermodelnpcs:playermodelnpc):

  • questgiver: the NPC can have a quest list. The framework does not make these NPCs invulnerable; damage stays as PlayerModelNpcs sets it.
  • alegacyvsquest:dialoguequests: the NPC's dialogue can run quest triggers.

The PlayerModelNpcs editor gets:

WhereWhat
NPC editor, NPC tabQuests… button: the NPC's quest list. Copy look button: copies the NPC's appearance
Dialogue component editor, trigger listalegacyquest-accept, alegacyquest-complete, alegacyquest-action, alegacyquest-journal, openquests, with input fields for their data

Both buttons need the controlserver privilege. If a PlayerModelNpcs update changes its editor, the framework writes a warning to the server log and leaves the editor as it is. The triggers still work when typed into the dialogue JSON, and the quest list can be set with a command.


Give an NPC quests

  • Place the NPC and open its editor.
  • On the NPC tab press Quests….
  • Fill in the quest ids and save. The window refuses ids that do not exist.
FieldMeaning
QuestsQuests this NPC offers (rotating pool, see Quest Givers)
Always questsQuests that are always offered
One quest at a timeThe player can hold only one quest from this NPC
Max available questsHow many pool quests are offered at once
Reputation NPCReputation id for quests that need reputation with this NPC

You must be within 64 blocks of the NPC. The same settings are stored on each NPC on its own, so two PlayerModelNpcs NPCs can offer different quests.

Without the editor, look at the NPC and use the command:

/avq entities npcquests quests mypack:firewood, mypack:wolves
/avq entities npcquests always mypack:intro
/avq entities npcquests show

All modes are listed under Per-NPC configuration.

How players open the quest window

  • NPC without a dialogue: a plain right-click opens the quest window.
  • NPC with a dialogue: add a player option whose trigger is openquests. The optional trigger data is the start tab (0 quests, 2 reputation, 3 shop).

Quests from the dialogue

Instead of the quest window you can run a quest entirely from dialogue lines. Pick the trigger in the dialogue component editor, or write it in the dialogue JSON:

TriggerDataWhat it does
alegacyquest-acceptquestGives the player the quest. Does not check requirements: hide the option with conditions yourself. An already active quest is ignored
alegacyquest-completequest, forceHands in the active quest. Without force its objectives must be done
alegacyquest-actionaction, questRuns an action string, for example giveitem game:bread 2
alegacyquest-journaltitle, text, entry, questWrites to the Quest Journal

About the journal trigger:

  • text is required.
  • With quest, the entry goes under that quest. Without it, it becomes a note grouped under the NPC's name.
  • title defaults to the NPC's name; entry defaults to the title.
  • The same line is added only once, so talking to the NPC again does not duplicate it.

Showing the right options

When a dialogue starts, the framework sets these variables for the player (replace <id> with the quest id):

VariableValue
player.questactive_<id>1 while the quest is active
player.questcompleted_<id>1 after it was completed
player.queststage_<id>Current stage, starting at 1
player.questcompletable_<id>1 when the quest (or its current stage) can be handed in

Use them in the conditions of dialogue options: offer "accept" only when the quest is neither active nor completed, and "hand in" only when questcompletable is 1.

Example

A guard who gives one quest and takes it back:

{
  "components": [
    {
      "code": "offer",
      "owner": "player",
      "type": "talk",
      "text": [
        {
          "value": "I can help with the wolves.",
          "jumpTo": "accept",
          "conditions": [
            { "variable": "player.questactive_mypack:wolves", "isNotValue": "1" },
            { "variable": "player.questcompleted_mypack:wolves", "isNotValue": "1" }
          ]
        },
        {
          "value": "The wolves are dead.",
          "jumpTo": "handin",
          "conditions": [ { "variable": "player.questcompletable_mypack:wolves", "isValue": "1" } ]
        },
        { "value": "Goodbye.", "jumpTo": "close" }
      ]
    },
    {
      "code": "accept",
      "owner": "npc",
      "type": "talk",
      "trigger": "alegacyquest-accept",
      "triggerdata": { "quest": "mypack:wolves" },
      "text": [ { "value": "Five of them. Be careful." } ]
    },
    {
      "code": "handin",
      "owner": "npc",
      "type": "talk",
      "trigger": "alegacyquest-complete",
      "triggerdata": { "quest": "mypack:wolves" },
      "text": [ { "value": "Thank you. Here is your pay." } ]
    }
  ]
}

The quest itself (mypack:wolves) is an ordinary quest file in your pack, see Quest Structure. The rewards are given when it is completed, as with any quest giver.


Copying a look to a pack NPC

A PlayerModelNpcs NPC is a good place to try out a look. To move it to an NPC defined in your quest pack:

  • In the NPC editor press Copy look (or look at the NPC and run /avq entities npcappearance copy).
  • Look at the pack NPC and run /avq entities npcappearance paste. The pack NPC needs the alegacyvsquest:npcplayermodel behavior.
  • To put the look into the pack files, run /avq entities npcappearance export guard. The file appears in ModData/alegacyvsquest/appearances/guard.json; copy its fields into the NPC's behavior block.

Model, skin, voice, clothes and held items are copied. Details: Copying looks in game.


Troubleshooting

ProblemCheck
No Quests… buttonYou need controlserver. If the server log says the editor layout changed, use /avq entities npcquests
Right-click opens the dialogue, not the questsThe NPC has a dialogue: add an openquests option
"Accept" does nothingThe quest id must exist (/avq validatepack), and the player must not have it active already
"Hand in" does nothingObjectives are not done yet. Show the option only when questcompletable is 1, or set force

Press ESC to close