 Today I want to share with you another one that I am working on for one of my projects. A lot of people have been showing a lot of interest in the dialogue system tutorial, so I wanted to share what I've been working on, in case that it might be of use to you. As you can see here, I have an example of with the dialogue box, very similar to the one that I have before. I only changed the font and the color of the background, but I added a lot of features that I'm using for one of my projects. And if you can see here, it can ask you questions, so you can answer. So right now, what's your favorite color? Let's say, I don't know, red. And it says you pick the color red and it shows that in a different color. And then I show you want to color red. You can go back if you say no, it will go back to the previous step. If you say yes, it will continue. Here it's asking for my name, so let's say Emilia. And it will remember that. So your name is Emilia and you like the color red. And then I showcase here, like you can also add the names here and a portrait of the person speaking. And also you can change different backgrounds and everything like that. And when the conversation ends, it closes. So if you want to know how to use this in your projects, I will go through a very simple explanation of how we can achieve this. And I hope that it helps you in your project. So I'm starting here with an empty project. It could be also an existing project, but I'm going to use just a blank one. And the first thing you need to do is copy the folder add-ons from the GitHub repository. You can find a link in the description where to download it. And for that add-ons folder, you can paste it inside here and it will contain almost everything you need to get started. So I imported the folder here and you will see here it will have the dialog, which is a plugin with a few files. And it's not really organized right now. I'm working on it. I will keep updating it and you can keep downloading the new version from GitHub and updating the version that you have here in your project. After copying these add-on folders, and I think that we have to do to set it up, is to go to Project, Project Settings and Plugin. And here in Plugin, you will see that this shows up, which is the dialog system add-on, and you enable it. Once you enable it, we have to create a new script, which is called global. We're going to use this to store some variables, like the answers to the questions that we have. And inside this script, we need to remove everything and declare a dictionary, which is custom variables, and it's going to be empty. Now that we have this global file, which is where we're going to store the information from the conversations, we go back to Project, Project Settings, Auto Load, and here on the path folder, we select the global.gd, which is the file that we just created, and the name we're going to send it, so we add it, and here we name it global. Here we set it to lowercase, and we have to have here the singleton enabled. So that's all you need to do to set it up. Right now, let's create an empty scene. Let's save it. Let's say it's going to be main. And in this scene, you can add the node, which is included in the add-on-sfolder-dialogue-dialogue scene. You can drag and drop it to your project, and you will see that this will show up. So this is the node that handles all the conversation, and it will have a script here. In this script, you will see the plugin that I'm working on. You don't really have to understand this a lot, just a little bit to get by, but I will be modifying this and updating it with new functions. All you need to know is this part over here, which is the dialogue script, which contains all the instructions that you want the dialogue to show. In this case, we start the project showing a background. This is the placeholder that happens whenever you import it, but you can replace it later. Here you have the background. All this is an array, so each of these instructions are dictionaries inside an array. In this case, we have the background here, the text, which will show just text and nothing more, and then the question. Here in the question is where you ask and you show them two options. Do you want to pick one or the other? This dictionary has to have three keys. Question, which is what it's going to show up in the dialogue box. Then variable, which is how are we going to internally call that answer so if they answer one or the other, how are we going to know? In this case, it's the favorite color, so fab color, and options, which is an array with a lot of options. Those options will have the label key, which is going to be red, and the value, which is the color that you want to assign to that. Same with the blue. Whenever we pick something, we can assign to this variable, fab color, one of these options. Here on the next step, we see that we say you pick the color, and then we have a very long thing. This thing basically is taking the variable. Whenever you call a variable that you declare in this dialogue system, it will show you the label. So in this case, if you pick red, it will show you here, it will be red, and if you pick here blue, it will show blue. And this other part is just a standard BB code, which will get the fab color value, and it will set that word to that specific color. You can do this without having any variable, you can just write the content there, but in this case we want to make it dynamic, so if they pick blue, we can see the blue text. Now we get a confirmation question. In this case, instead of having a variable, since we don't want to set it to anything, there's a new key, in this case checkpoint, which will go a few steps back. In this case, since we are asking, are you sure about the color? And we know that the color is three steps behind. If they say yes, we continue, but if we say no, we go checkpoint minus three. So you can use this for a bit of dynamic content, like maybe they typed their name and they made a mistake, so you can ask, are you sure you want to be called like this? You can go back. Now another kind of this input could be just a dialog with text input. In this case, it's input, and now this will be on the dialog box, window title. It will be on the small window that happens in the middle of the screen. You can write your name, whenever they set that, it will be applied to the variable. The same way that we do here with the questions, we got the five color and we can access it. We can do the same in the future with this new variable that we create here in this step. So in the next line, we say, so your name is and the name of the variable that we choose to declare. In this case, if you say my name is Alex, it will be so your name is Alex, and you like the color and the same as we did before with the color. And now in the next one, we've been only using the text key when we were showing text, but you can also set the name key. And in this case, it will show up on the top right corner where it says name. And you can set it also with colors or with any other variables. It can be just plain text. And then we do the same with the dialog system. The final one is an action which is game end, which will close the game. If you don't have any action at the end, the node will destroy itself and you can continue with your game or do whatever you want. And since this is the placeholder code, what we can do is define this as a JSON file. So here on the scene that we had before, if you select the dialog node, you will see here external file. And if we press here and we select a JSON file that has the same structure with the same keys, I have one example here inside dialog. Example. This will let's try it out. So the dialog is being loaded from JSON. If we open that JSON file, you see here this dialog is being loaded. So if we update it, hello, and we go back to our project and you will see now that the hello is added at the end. You can have all your scene scripts here in a different file and you don't have to do them in external files if you don't want to. You can also set the variable. In this case, if you set the variable dialog script from another node, let's see, let's add a script here in the control node. This is our empty scene. And now here we delete everything except the ready. Now here, instead of adding it to the scene like this, we need to delete this node. And we're going to load it from here. So dialog is going to be load and we can drag and drop this scene. Now on dialog, we can do dialog script. And here we say text, because we want to show some text that says hello from the main script, which has to be a dictionary and we save it. Now we need to add child, this dialog. I almost forgot. I need to also instance here. So we create a new copy of it. So now we have the scene, the dialog scene. We instance it. We set the variable. And then we add it as a child to this control node. And instead of showing the text that we had before, it will show us this new one that we set from the script. Hello from the main script. And if I press next, it will delete and it will go back to your game or whatever. We can make this more complicated by adding name, YouTube, text, nice tutorial. You are now being demonetized. Very, very YouTube. That's something that YouTube could say. Okay, so now we try it out again. We see the first line and the second line, which is being called from someone called YouTube. So these are the basics of how you can use this system. I encourage you to read the code here. I'm going to go a little bit quick about everything, just in case you want to contribute something to it. I know the structure is not ideal, but I was trying to abstract this as much as possible to share it with everybody. I'm using this on a project which is very, very particular. So a lot of the things that I might have here might not be useful to your game. But as always, you know, it might help some other people, so I wanted to share it. Here as we can see, the dialog script is the variable that we cover. The export variable, which is the external file, is the one that happens when you click on that option. So you can open it. Text doing duration is the time that it will take the text to show up. In this case, it's one second. And input next is the key that you need to press to continue. You can set this to any of your actions. If you remember, actions are here in project settings, input map, and I'm using UI accept, but you can create a new one, I don't know, mouse click, space, or delete, or whatever key you want to use. So the function file will load the JSON files. And in this case, it's very simple. You are only loading the JSON, which is an array with some dictionaries inside, and you are converting it to go out. So in this case, if you load a file that is valid in the same kind of format, you will load this in as intended. The parse text script. Let me make this a little bit bigger. So parse text will go through all the dictionary that we created, which is everything is being stored here in custom variables. So whenever you answer something, you go to custom variables. So this will check on our global. That's why we needed to create that script. This will check all the different variables and replace the text with the text that we had stored here. Ready is the first thing that happens when they know this is ready. In this case, we check if there's an external file set to set the dialogue script. And if it's not, we just go with the one that is predefined. In this case, it's the example that I showed at the beginning of the video. Now I reset the name. So we don't show any name by default. And the rest is a bit more of the how when you're pressing a key. Here you have the input. Here show dialogue or high dialogue. The twin, which we covered in a previous episode. So you might know that one. It's just a continuation from that. Updating the name will also make sure about having some name variable or not. And if if the variable is name, I show the close up, which was that dwarf that you could see there. The spreads are made again by my brother. He made them for his YouTube channel. I'm using them as placeholders, but you can use whatever you want. Updating the text. This is from previous video as well. Dialogue is the same, but the handler has been a little bit modified. And here is the event handler, which is all the actions that you have and how you treat them. This case, we have the event for text and the name with the name, the questions. Here we have how all the questions works. What I did was it will read all the options that are inside of those and I will create different buttons, set those buttons with some signals and those signal will send us the final input. Here on the input we have for the dialogue action is the one that I coded game end and it will do anything. So here if you want to code your own action, you can say event action equals next. You can do whatever you like here. Here you can add any of your custom code. Whenever you have one of those lines action, whatever you create, in this case next, you will do everything like go to another scene. In this case I have also one for a scene. If you set scene and you set the name of a scene resource, it will change the current scene to that one. That's very useful for transitions if you want to go and split everything in small scenes. Background, it will change the image. If you don't set any image, it will be hidden. But as soon as you select one, it will be shown. Sound is for playing sound. This is not done. So I have a placeholder here and the default one will just show other event on the terminal. And that's for me to know that something should happen there. But that is the default. So the rest are just things for clearing up the signals and stuff like that. But there's not much more that you need in this version. Have a simple dialogue in your game. It started creating this out of necessity. And also I've been checking some of the other plugins that existed. One of my viewers recommended me to try his library. It's called Rakugo Framework. And I feel like this is very, very specific to making a visual novel. And it has a lot of similarities with Rempy. But I don't feel like this is something that you can easily add to your existing projects. Because it's very heavy. I'm opening this. This is loading right now. I'm doing nothing. And it takes very, very long time to load. It also changes here. It adds some menus. And I feel like it's very invasive. But if you're interested in making a visual novel, it can be something that you can check out. I will leave a link in the description as well. That's it for today. And I hope that you are able to use this in your projects. Remember that you can load the scene, set the text that you want and forget about it. You don't really have to do very crazy things with it. And I will keep uploading this on the GitHub page. And also if you have any questions, you can join to Discord and ask me anything you want. Thank you very much to all my Patreons. I'm really, really grateful to all of you. Hope to see you guys in the next one.