Skip to content

Dialogues

McHorse edited this page Jul 29, 2021 · 10 revisions

Dialogues are basically programmable node systems that allow you to create a progressing conversations for your adventure maps. Dialogues are based on event node system so it's possible to execute different actions, or provide different dialogue branches depending on player's state.

Dialogues can be triggered either from triggers or via /mp dialogue open command. Same as with events, dialogue also has a context.

Dialogues can be managed in Mappet dashboard. The fourth panel in the left sidebar opens dialogue editor.

Editing

Once you pick or create a dialogue, you'd see an editor like this:

Dialogue editor

Dialogue node system supports following types of nodes:

  • All event nodes (for exception of Timer node)
  • Reply node allows you to provide dialogue reply options that player can pick from
  • Reaction node allows you to provide dialogue reaction to whomever you have dialogue with
  • Crafting node allows you to provide crafting table that will be offered to the player to trade
  • Quest chain node allows you to provide quests (using quest chains) that will be offered to the player to take or complete
  • Quest node allows you to offer and complete a single quest

Disallowing player to close the dialogue

Can be closed toggle allows to control whether the player can close dialogue screen (by pressing Escape key) in the middle of the dialogue (but not in the end).

Reply node

Reply node provides reply that player can pick from to a specific dialogue reaction. Content field allows you to provide the text that a player will be replying to the dialogue. You can use same formatting as with quest's description. While the color picker underneath allows you to set the main text color.

Content expressions

You can also use expressions within the content field, for example you can say use world_is_day() to say "good morning" or "good night" just like this:

${world_is_day() ? "Hello" : "Good night"}! Looks like you're like planning to travel somewhere. Where are you going?

And depending on the time of the day it will say "Hello!" or "Good night!" If there isn't enough space to edit the Content you can right click on the field to Edit in fullscreen...

Reaction node

Reaction node provides a reaction to either dialogue initiation or to a reply. Content field allows you to provide the text that a player will be replying to the dialogue. You can use same formatting as with quest's description. While the color picker underneath allows you to set the main text color. Same as with reply, you can use expressions.

And the Pick | Edit buttons underneath allow you to pick a morph that will be displayed in the dialogue screen on the right of the main panel. You can use any morph, however, particle with vanilla emission mode and snowstorm morphs won't work! Other morph features like pose animations should be working when transitioning to the next reaction after player picked a reply.

Dialogue reading

Reaction nodes also have two fields related to marking dialogue branches as read. Mark read toggle allows to mark dialogue as read by writing (adding 1) to player's states with key dialogues.DIALOGUE_ID (where DIALOGUE_ID is the name of the dialogue).

Marker field allows to mark a specific branch as read which will be written (adding 1) to player's states with key dialogues.DIALOGUE_ID:MARKER (where DIALOGUE_ID is the name of the dialogue, and MARKER is whatever you provided).

Both of these states you can check either by using dialogue_read("dialogues.DIALOGUE_ID", subject) (or with custom marker dialogue_read("dialogues.DIALOGUE_ID:MARKER", subject)) expression or using dialogue read condition block.

Crafting node

Crafting node offers crafting table to the player within the dialogue by given ID under Crafting table label.

Quest chain node

Quest chain node offers quest(s) to the player based on the quest chain by given ID (you can pick it by clicking Pick quest chain... button).

Subject text field allows you to specify an ID that should match in the quest chain the Quest provider and Quest receiver fields. Same as in Reaction and Reply nodes, Subject text field supports expressions meaning you can pass custom subject value provided through /mp dialogue open's [data] argument.

See quest chains page for more information.

Quest node

Quest node can be used to offer and complete a single quest to the player in the dialogue (you can pick the quest by clicking Pick a quest... button). If the player doesn't have picked quest, then the quest will be offered to accept. If the player has it, but they didn't complete it yet, the quest will be displayed, but you can't do anything about it. Finally, if the player has the quest and completed it, then the player can complete the quest and take the reward.

Once player presses back, accept or complete buttons, the dialogue will continue its flow (there is no support for binary mode or all-or-nothing depending on the state of the quest, so you'll have to implement your own checks manually).

Hierarchy

Same as with events, you have to specify the main node. However, beside specifying main node there are some specific order of node execution you must follow. Take a look at this example:

Sample dialogue

For every stage in the dialogue, you need to have one Reaction node and either:

  • One Quest node
  • One Crafting node
  • One or more Reply nodes

You have to have at least one of those connected to a Reaction node indirectly. However, in the end of the dialogue, they are optional. When there are no replies, quest or crafting nodes in the end it will simply display the content of reaction and will tell player Press Esc key to close the dialogue....

Consider following dialogue:

Sample dialogue with more complexity

You can have additional Condition, Switch and Command nodes anywhere coming out of Reply, Reaction, Craft and Quest nodes, or even in between. The most important part is that per every dialogue stage you'd have one Reaction node connected to multiple Reply nodes, or a single Craft or Quest nodes. However, Reaction node should never be connected to another Reaction node without passing through a Reply, Craft or Quest nodes otherwise only the latest reaction node will get counted.

The final thing to note is that you should connect Reply, Crafting or Quest nodes to another Reaction node when you want to redirect the dialogue back, as you can see with the quest node that is connected back to Hi!. Which will return the place back to the beginning of the dialogue. If there will be no Reaction node down connection out of a Reply, Crafting or Quest nodes, then the dialogue will end.