Hey, Devs! I thought it’d be prudent to provide a tutorial on how to use the new Dialogue Editor plugin, found here: https://www.roblox.com/catalog/847896485/Roblox-Dialogue-Editor
Let’s start with first things first: what do the buttons do? Well, there are three buttons:
This is the main method of interaction within the plugin. When you click the button, it will attempt to load the selected RobloxDialogue object. If you’re not selecting one, it’ll try to find it recursively down the hierarchy of the object you selected. If it doesn’t find one, it’ll warn you appropriately.
This button creates a nearly-empty RobloxDialogue in the selected object. Keep in mind that a dialogue can be properly parented to three places (technically, they can be parented anywhere, but the default interface expects them in these types of locations):
- A part
- A model with a “Head” object
- Any model with a PrimaryPart
Once you create the dialogue, you will be prompted to begin editing it.
The Dialogue Editor plugin puts three objects in three locations:
- RobloxDialogueServerScript in ServerScriptService
- RobloxDialogueClientScript in StarterPlayer.StarterPlayerScripts
- RobloxDialogue in ReplicatedStorage
If somehow you accidentally delete, move, or edit these things, pressing this button will reinstall them all. This is also the easiest way to update these scripts. Let’s talk about what’s legally change-able in the hierarchy of the RobloxDialogue folder:
The following objects in this hierarchy can be changed, and ReinstallScripts will not edit or replace them unless they do not exist:
Thusly, any changes made to Remotes or Class (and its children) will be overwritten every time you press this or any other button on the plugin. Do not make changes to these!
The Editor Itself
Here’s what the editor looks like immediately after opening a brand new dialogue:
If you’re the explorer type, hovering over any of the UI elements on this screen will give you a helpful context hint, describing what you can do. Let’s first go through each of the buttons on the top left.
Adds a Prompt to the dialogue at the center. A Prompt is what the NPC says to the player. Prompts can have a special form called “InitialPrompt.” An InitialPrompt is one of the Prompts that can start a conversation (that is to say, this is the first thing that a NPC says to you at the beginning of the conversation). There can be multiple InitialPrompts, and we’ll talk about that later.
Similar to Add Prompt, this button adds a Response to the dialogue at the center. A Response is what the player says to the NPC. Responses have no special forms. We’ll talk about them more in detail later.
In case you get lost on the screen, you can re-center your camera on the first InitialPrompt. This would be a good time to mention that holding middle mouse button on the background and moving your mouse will cause the Camera to pan, allowing you to have a dialogue tree of virtually infinite size.
Dynamic Text Functions
Any dialogue text surrounded by the angle brackets (’<’ and ‘>’) will attempt to call a Dynamic Text Function. These functions are global to your entire place. If you click this button, you will be shown the table of Dynamic Text Functions. There is one by default for an example: PlayerName. If, for example, you set the InitialPrompt’s text to “Hello, !” then it would (in my case) be shown to me as “Hello, Davidii!” These functions are very useful.
This allows you to store arbitrary data at the conversation level. When I write a tutorial documenting custom interfaces, we’ll talk about it more. For now, know that, when using the default interface, a key of “Title” will set the title of a conversation, and a key of “PortraitImage” will set the portrait image in a conversation. Note that individual dialogue nodes also have their own data that will overwrite conversation-level data. This allows you to be as specific as you want to be without being burdensome.
Save & Exit
This is pretty self explanatory. It saves the changes you’ve made to the conversation and exits the editor.
Sets the distance at which this conversation will be automatically triggered for an approaching player. If zero, it won’t automatically trigger at all.
Sets the range at which this conversation can be had. If a player walks farther than this far away from the NPC, then the conversation will end.
Dialogue Nodes and You
This dialogue system has 2 (sort of 3) types of dialogue nodes:
They have some shared features. We’ll discuss them here:
Features all Nodes Share
Line: the Line is the text within the node. Basically, it’s either what the NPC says to you or what you say to the NPC. It can contain dynamic text, which is explained above in “Dynamic Text Functions.” Clicking in the large text area of the node will expand it and let you edit the Line of the node.
Condition: a Condition is an arbitrary Lua function that returns a boolean. It determines whether or not this node is available. For example:
The first response does not have a Condition, so it will always show up as an option when the NPC says “Hello, world!” at the beginning of a conversation. The second response, however, does have a Condition, so it will only show up if the Condition returns true. Conditions can also be applied to Prompts, but they act a little differently, so we’ll talk about that later. Clicking the question mark button on a node will allow you to create and edit a condition. If you want to remove it, you can hold left shift and click the ‘X’ button that appears above the question mark button.
Action: similar to the Condition, an Action is an arbitrary Lua function. However, its return type is irrelevant (as it isn’t used). This is merely a place for you to run code whenever the node is encountered. A Response will run its action when it is clicked by the player, and a Prompt will run its action when shown to the player. You can create and edit the Action by clicking the exclamation point button. If you want to get rid of it, then hold left shift and click the ‘X’ button that appears above it.
Data: the arbitrary data for nodes is more important when you make your own custom interface, so suffice it to say that this is just a container for data. I’ll talk about it more when I make a tutorial on making your own custom interface. If you want to edit it, just click the “Edit Data” button.
Delete Button: click this ‘X’ button in the top-right of the node in order to delete it. You’ll be prompted first, so don’t worry about doing this accidentally.
Add Connection Button: this '+" button allows you to drag and drop a connection onto another node. Prompts can link to Prompts and Responses, but Responses can only link to Prompts. In addition, if you hold left control before clicking and dragging on this button, releasing will, instead of adding a connection, will create a new, connected node at that location. This is handy shortcut for making quick back-and-forth conversations. This quick-create method will create Prompts from Responses and Responses from Prompts.
Break Parent Connections Button: This is only visible while holding left shift. This ‘X’ button on the far left edge of the node allows you to delete all connections between it and its parents.
Break Child Connections Button: This is only visible while holding left shift. This ‘X’ button that appears over the normal ‘+’ button of the Add Connection Button allows you to delete all connections between this node and its children.
To re-iterate, a Response is what the player says to the NPC. They’re the simplest kind of node, and their only unique property is Order. Order determines, well, the order in which they show up in your interface. It’s in ascending order, so the highest Order Response will show up last.
Prompts are where this dialogue system really shines. Prompts have a number of unique features, which we’ll talk about here:
Priority and Conditions: take a look at this example dialogue graph:
Here we have not one, not, two, not even three InitialPrompts, but four. How in the world does the system decide which one to use? Well, notice that each of them has a Priority, and all but one of them has a Condition. In order to decide which prompt to use, the system traverses them in descending order of their Priority and uses the first whose Condition returns true. In this way, you can have the NPC greet and respond to the player in different ways depending on conditions in game. In this graph, the NPC has a greeting for:
- Having never met you
- Having met you, but you not having accepted his quest
- You having accepted his quest, but not completing it
- You having completed the quest
The conditions of each of those four InitialPrompts lines up with these heuristics, allowing a conversation with this NPC to be a living, breathing, changing conversation that changes based on how the player acts. Also notice in this graph the clever reuse of old responses and prompts to save on time. Try following all of the possible conversation paths as an exercise.
InitialPrompt or Nah: Prompts have a special Star button that allows you to toggle their state as an InitialPrompt or not.
You can move the camera in any direction by holding down middle mouse button on the background and moving the mouse. I mentioned this before, but here it is again, in case you missed it.
You may have noticed that clicking the top bar of any node selects it. Holding left control allows you to select more than one (and reselecting a selected node while holding left control will deselect it from the group). In addition, you can left click and drag on the background to box select multiple nodes.
I’m really looking forward to seeing what you all can make with this system. Please share below, and also ask any questions you have that I haven’t answered in this tutorial and I can certainly edit the answers in.