Minecraft Data Packs / Adventure

ML NPC Dialogue System (Minecraft 1.20.1)

  • check_circle Advancements
  • check_circle Functions
  • check_circle Predicates
  • 8,138 views, 12 today
  • 876 downloads, 2 today
  • 38
  • 32
  • 33
michaelslife's Avatar michaelslife
Level 39 : Artisan Theorist
23
NPC Dialogue System for Minecraft 1.20+

This data pack gives you the ability to add dialogue to almost any entity in Minecraft. You can easily set an NPC's lines, and even add choices for a line to guide the player through a conversation. You can also choose between displaying dialogue lines in a speech bubble next to the NPC, or within the chat window.

Here are the steps to install the data pack and the required resource pack (contained in the zip file download):
Step 1: Unzip the MLDialogue.zip file in your downloads folder.
Step 2: Place the ml_dialogue folder into your Minecraft world's datapacks folder.
Step 3: Place the resources.zip file into the main directory of your Minecraft world.
Step 4: Open your Minecraft world and place the Dialogue System item that you receive in a safe 1x1 location.

Note: The resource pack is only needed while editing dialogue. When you are done with setting up your dialogue, you can remove the resource pack from your world.




Basic Overview Video:




Basic Tutorial:


Note: If you use the Dialogue Editor item when not looking at an entity, it will bring up the Dialogue System Settings menu for more options.

Step 1: Use the Dialogue Editor item on an entity of your choice to add dialogue to it.
Step 2: Open the chat window and click [​Edit Lines].
Step 3: Click [​Add Line], then close the chat window and Right Click (use button). Then enter the text for the line. The text input box accepts different formats, so here are some examples of the types of text you can enter:
  • Example 1: Basic text with no formatting
  • Example 2: {"text":"A JSON object with a text value and color","color":"red"}
  • Example 3: [{"text":"Multiple JSON objects "},{"text":"in an array format"}]
  • Example 4: tellraw @a {"text":"A tellraw statement with any of the above formats"}
For an easy way to format your text input, visit https://minecraft.tools/en/tellraw.php, design your text, copy the generated command, then paste it into the Dialogue System text input when prompted.

Step 4
: Once you've entered your text for the line, press Done and open the chat window again to continue editing.
Step 5: You can either continue to add lines, or click [​EDIT] on a line to edit an existing line. You can also click the arrow buttons to move a line up or down within the list (lines at the top of the list are displayed first in the conversation). If you have more than 5 lines, you can click the Page arrows to navigate to a different page of lines.
Step 6: If you need a line that will display after all other lines are completed, click the [​Main Menu] button, then click on [​Add Final Line] to set the final line text.
Step 7: With your hand empty, right-click your NPC to start the dialogue. You can restart the dialogue for the NPC by using the Dialogue Editor item on it and clicking [​Restart Dialogue].

Here are the properties of a line:
Player Response: This is the response text that is displayed (with the player's name) after the line is displayed.
Line Command: This is a command that is ran when the line is displayed. You can search the web to find command examples to use if you are unfamiliar with Minecraft commands. Commands are entered in the same format that you would enter them into a command block.
Choices: If you click on [​Set Choices], you are brought to the choice editor menu where you can add choices for a line that the player can click on in order to advance the dialogue.

Here are the properties of a choice:
NPC Response: This is the response text that is displayed from the NPC after the choice is selected.
Choice Command: This is a command that is ran when the choice is selected.
Line Jump: A line jump is a way to control the flow of dialogue when a player selects a certain choice. For example, if the choice needs to repeat the same set of choices after it's selected, you can set a jump to the same line. Or if only certain choices use the next line, you can make the other choices skip that line and go to the one after it.



Important:
The data pack sets the gamerules sendCommandFeedback and commandBlockOutput to false for smoother menu and dialogue functionality.
When an NPC has dialogue data, it is surrounded with an interaction entity, disabling the default behavior of some entities such as trading with villagers. If you need to you can disable the dialogue but keep its data on the NPC by using the Dialogue Editor item on the NPC, then going to the NPC Properties menu and toggling the Dialogue Status option.
If the command suggestions bother you while inputting text during editing, you can go to Options...Chat Settings...Command Suggestions and set it to Off.



Advanced Options:
  • To edit which types of entities can have dialogue applied to them, navigate to the data pack folder ml_dialogue/data/ml_dialogue/tags/entity_types and edit the file npc.json.
  • Type this command in the chat to relocate the 1x1 block that the Dialogue System is using: /function ml_dialogue:relocate_system
  • After setting up the system, if a player needs to become a dialogue editor, have the player type this command in the chat: /function ml_dialogue:editor
  • Adding the tag ml_ignore to an NPC will cause it to ignore any player that's trying to interact with it.
  • To change the current line index that an NPC is on, you can run this command on a target entity: execute as @e[​name="Adam",type=minecraft:villager] on passengers if entity @s[​tag=ml_dialogue_data] run data modify entity @s data.current set value 4
  • Where the number 4 in the example above is a line index number.
  • If you need to place dialogue on an armor stand, use the Dialogue Editor item while not looking at any entity, and click the Armor Stand Editor button in the chat window.
  • If you need to uninstall the data pack, type this command in the chat, but be warned, it will remove all dialogue data from all NPCs: /function ml_dialogue:uninstall



Legal Info:

Use/Alter any way you like. Just don't re-upload to any site. No Credit Attribution required.
CompatibilityMinecraft 1.20
Tags

Create an account or sign in to comment.

1
03/18/2024 2:31 pmhistory
Level 1 : New Miner
McSpudy
McSpudy's Avatar
I tried this command "/function ml_dialogue:editor" and it didn't work. btw I'm on 1.20.4 . If I can get this to work I will use this on all my future servers.
1
03/19/2024 8:23 am
Level 39 : Artisan Theorist
michaelslife
michaelslife's Avatar
This datapack is not updated for 1.20.4. There is a new one in the works but it will not be released until after Minecraft 1.20.5 is released.
1
03/11/2024 12:09 pm
Level 13 : Journeyman Toast
ItsMeNeon
ItsMeNeon's Avatar
how do u end a conversation
1
03/11/2024 3:05 pm
Level 39 : Artisan Theorist
michaelslife
michaelslife's Avatar
You just have to walk away from the NPC
1
02/29/2024 4:13 pm
Level 1 : New Explorer
Eternity138
Eternity138's Avatar
Is there a way where I can get dialogue to repeat?
1
02/29/2024 4:49 pmhistory
Level 39 : Artisan Theorist
michaelslife
michaelslife's Avatar
Unfortunately with this current system it's complicated to make it repeat.
If you know how to target your NPC, you can run this command on him to set his dialogue back to the start:


execute as @e[​type=minecraft:villager,tag=target_npc] on passengers if entity @s[​tag=ml_dialogue_data] run data modify entity @s data.current set value 0

Change the type and tag to your target NPC entity type and tag.
1
01/14/2024 7:52 am
Level 1 : New Miner
jkrez
jkrez's Avatar
I would like to know if it is possible to postpone the launch of replicas until some point? And is it possible to use the command block from outside to set a new line to a certain NPC?
1
01/17/2024 7:04 am
Level 39 : Artisan Theorist
michaelslife
michaelslife's Avatar
I'm not sure what you mean by "postpone the launch of replicas". And as for adding a line from a command, it's not possible since it would require more steps than just running a command.
2
01/02/2024 6:38 am
Level 1 : New Miner
SearchinStuff
SearchinStuff's Avatar
hey what is the command or how to get an npc wand?
1
01/02/2024 8:15 amhistory
Level 39 : Artisan Theorist
michaelslife
michaelslife's Avatar
Try using this command in your chat:

/function ml_dialogue:editor
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome