Dialogs - MarkusBordihn/BOs-Easy-NPC GitHub Wiki

Dialogs 🗣️

Dive into the world of dialog systems, where creating engaging conversations for NPCs becomes a breeze. Explore various dialog types tailored for complex dialogues and diverse use cases.

Dialog Placeholders 🧩

Let's kick things off with placeholders available for all dialog types. The dialog text supports additional placeholders, allowing for personalized and dynamic text.

Placeholder Description
@npc Name of the NPC
@initiator Name of the initiator of the dialog

This opens the door to text like Hello @initiator, my name is @npc! 🌟

Dialog Text Formatting 📝

The dialog text supports a variety of formatting options to enhance the conversation. The following formatting placeholders are available.

Dialog Text Formatting

Color Codes Table

The following color code placeholders could be used to add color to the dialog text. The the closing tag is only required when the color should be changed back to the default color.

Placeholder Formatting Code Color Name Example
<black> §0 Black <black>Text</black>
<dark_blue> §1 Dark Blue <dark_blue>Text</dark_blue>
<dark_green> §2 Dark Green <dark_green>Text</dark_green>
<dark_aqua> §3 Dark Aqua <dark_aqua>Text</dark_aqua>
<dark_red> §4 Dark Red <dark_red>Text</dark_red>
<dark_purple> §5 Dark Purple <dark_purple>Text</dark_purple>
<gold> §6 Gold <gold>Text</gold>
<gray> §7 Gray <gray>Text</gray>
<dark_gray> §8 Dark Gray <dark_gray>Text</dark_gray>
<blue> §9 Blue <blue>Text</blue>
<green> §a Green <green>Text</green>
<aqua> §b Aqua <aqua>Text</aqua>
<red> §c Red <red>Text</red>
<light_purple> §d Light Purple <light_purple>Text</light_purple>
<yellow> §e Yellow <yellow>Text</yellow>
<white> §f White <white>Text</white>

Formatting Codes Table

The following formatting code placeholders could be used to add formatting to the dialog text.

Placeholder Formatting Code Example
<obfuscated> §k <obfuscated>Text</obfuscated>
<bold> §l <bold>Text</bold>
<strikethrough> §m <strikethrough>Text</strikethrough>
<underline> §n <underline>Text</underline>
<italic> §o <italic>Text</italic>
<reset> §r <reset>Text</reset>

Short Codes Table

The following short code placeholders could be used to add formatting to the dialog text.

Short Code Equivalent Formatting Code Example
<b> <bold> <b>Text</b>
<i> <obfuscated> <i>Text</i>
<u> <underline> <u>Text</u>
<s> <strikethrough> <s>Text</s>

Basic Dialog 📜

The basic dialog presents a simple text with a maximum of 255 characters.

Basic Dialog Setup screen

Basic Dialog

Yes/No Dialog 🤔

The yes/no dialog offers a concise text with a maximum of 255 characters. It includes two buttons for additional actions based on the answer.

Yes/No Dialog Setup screen

Yes/No Dialog

Yes/No Dialog Button Actions 🚀

In the action screen, define actions for each dialog button.

Yes Button Actions ✅

For the yes button, grant the player some stone and open the yes_answer dialog using the command /give @initiator stone.

Yes Dialog Button Actions

No Button Actions ❌

For the no button, offer the player dirt and open the no_answer dialog using the command /give @initiator dirt.

No Dialog Button Actions

Example Preset 🎮

A preset is available for the above yes/no dialog example. Spawn a Humanoid (slim) NPC and import the preset easy_npc:give_dirt_or_stone_to_player.

Yes/No Dialog Preset

Advanced Dialog 🌐

The advanced dialog allows for intricate conversations with multiple entries and actions for each entry. While it's the most complex dialog type, modifying a simple or yes/no dialog will automatically convert it to an advanced dialog.

Advanced Dialog Setup screen

Advanced Dialog

Dialog Editor 🎙️

The dialog editor empowers you to create and modify dialog entries.

Advanced Dialog Editor

Options in the dialog editor include:

  • The name of the dialog entry
  • The label/id of the dialog, used when opening the dialog via a button action.
  • The dialog text
  • The dialog buttons

Dialog Text 📝

The dialog text supports up to 6 text variations, randomly selected for dynamic and engaging conversations.

Advanced Dialog Text

Button Editor 🛠️

The button editor allows creation and modification of dialog buttons.

Advanced Dialog Button Editor

With the Open Dialog field, define which dialog should open when the button is clicked. In this case, open the question_on_correct dialog for the correct answer.

Within the Actions, summon a firework_rocket to celebrate the correct answer.

Close Dialog 🚪

If a button has no Open Dialog and no Actions defined, the dialog will close when the button is clicked.

Advanced Dialog Close Button

Example Preset 🎓

A preset is available for the above quiz dialog example. Spawn a Humanoid NPC and import the preset easy_npc:professor_quiz.

Advanced Dialog Preset

Default Dialog 🏠

A default dialog is automatically selected if there is an entry with the label default, start, or main. If none of these labels are present, the first dialog entry is automatically selected. For simplicity, it's recommended to use one of the specified labels for the default dialog.

Dialog Commands 🎬

The dialog system includes a variety of commands to manage and interact with dialogs.

Open Dialog Command 🚪

Open a dialog for the player using the command /easy_npc dialog open <NPC-UUID> <Player> or /easy_npc dialog open <NPC-UUID> <Player> <DialogLabel>. The dialog label is optional and will open the default dialog if not specified.

This command could be also triggered by a command block or a function, to allow scripted dialogs.

⚠️ **GitHub.com Fallback** ⚠️