Dialogs - MarkusBordihn/BOs-Easy-NPC GitHub Wiki

Dialogs ๐Ÿ—ฃ๏ธ

Step into the world of dialog systems, where creating engaging conversations for NPCs is easy. Learn about different dialog types designed for complex interactions and various scenarios.

Dialog Placeholders ๐Ÿงฉ

Let's start with placeholders available for all dialog types. These placeholders let you create personalized and dynamic text in your dialogs.

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

For example, you can write Hello @initiator, my name is @npc! ๐ŸŒŸ

Dialog Text Formatting ๐Ÿ“

You can use various formatting options to make your dialog text stand out. Here are the available placeholders for text formatting:

Dialog Text Formatting

Color Codes Table

Use these placeholders to add color to your dialog text. You only need the closing tag if you want to change the color back to the default.

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

Use these placeholders to add different styles to your 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

You can also use these short codes for quick formatting.

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 displays simple text with a maximum of 255 characters.

Basic Dialog Setup screen

Basic Dialog

Yes/No Dialog ๐Ÿค”

The Yes/No dialog provides short text (up to 255 characters) and includes two buttons for actions based on the player's response.

Yes/No Dialog Setup screen

Yes/No Dialog

Yes/No Dialog Button Actions ๐Ÿš€

In the action screen, you can define what happens when each button is clicked.

Yes Button Actions โœ…

For the Yes button, you can give the player some stone and open the yes_answer dialog using the command /give @initiator stone.

Yes Dialog Button Setup

Yes Dialog Button Actions

No Button Actions โŒ

For the No button, you can give the player dirt and open the no_answer dialog using the command /give @initiator dirt.

No Dialog Button Setup

No Dialog Button Actions

Example Preset ๐ŸŽฎ

A preset for the Yes/No dialog example is available. You can 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 more complex conversations with multiple entries and actions for each one. If you modify a basic or Yes/No dialog, it will automatically become an advanced dialog.

Advanced Dialog Setup screen

Advanced Dialog

Dialog Editor ๐ŸŽ™๏ธ

The dialog editor helps you create and modify dialog entries.

Advanced Dialog Editor

Options include:

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

Note: Only one dialog entry can be set as the default dialog.

Dialog Text ๐Ÿ“

The dialog text supports up to 6 text variations, which are chosen randomly to make the conversation more dynamic.

Advanced Dialog Text

Button Editor ๐Ÿ› ๏ธ

The button editor lets you create and modify dialog buttons.

Advanced Dialog Button Editor

You can define the button text and what actions should happen when the button is clicked.

Advanced Dialog Button Editor Setup

You can trigger several actions in a specific order.

Advanced Dialog Button Editor Open Dialog

For example, with the Open Named Dialog action, you can specify which dialog should open when the button is clicked. Here, you could open the question_on_correct dialog for the right answer.

Advanced Dialog Button Editor Command

With the Command action, you could summon a firework_rocket to celebrate the correct answer.

Close Dialog ๐Ÿšช

If no actions are defined for a button, the dialog will close when the button is clicked.

Advanced Dialog Close Button

You can also close the dialog using the Close Dialog action.

Advanced Dialog Close Dialog Action

Example Preset ๐ŸŽ“

A preset is available for a quiz dialog example. You can spawn a Humanoid NPC and import the preset easy_npc:professor_quiz.

Advanced Dialog Preset

Default Dialog ๐Ÿ 

A default dialog is selected automatically if there is an entry with the label default, start, or main. If none of these labels exist, the first dialog entry will be selected. To keep it simple, itโ€™s best to use one of these labels for the default dialog.

You can also use the "Default" button in the dialog editor to mark an entry as the default dialog.

advanced_dialog_editor_make_default.png

Alternatively, you can use the following command to set the default dialog:

/easy_npc dialog set default <NPC-UUID> <Dialog Label>

Dialog Commands ๐ŸŽฌ

The dialog system includes several commands to manage and interact with dialogs.

Open Dialog Command ๐Ÿšช

You can open a dialog for the player using this command:

/easy_npc dialog open <NPC-UUID> <Player>

To open a specific dialog entry, use this command:

/easy_npc dialog open <NPC-UUID> <Player> <DialogLabel>

This command can also

be triggered by a command block, function, or other mods for scripted dialogs.

Translations ๐ŸŒ

The dialog system supports translations for dialog texts, making it easy to internationalize your content. For more details on setting up translations, please refer to the Translations page.

โš ๏ธ **GitHub.com Fallback** โš ๏ธ