Skip to content

Dialogs

Markus Bordihn edited this page Mar 7, 2024 · 3 revisions

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.