Update Quick Start

Kyle Austad 2024-11-19 12:32:27 -07:00
parent 8217fb33fc
commit 75c6a16cb2

@ -13,3 +13,44 @@ If you aren't using the demo *BP_ThirdPersonCharacter* and have your own player
![](https://git.crabinteractive.com/crabdev/SimpleDialogueWiki/raw/branch/main/Docs/1.png)
![](https://git.crabinteractive.com/crabdev/SimpleDialogueWiki/raw/branch/main/Docs/2.png)
Note: Any *DialogueColor* variable doesn't change the color of the dialogue text itself but rather the name of the speaker.
## Set up your dialogue
Next lets define your dialogue. Create a Data Table based on the *S_Dialogue* struct.
![](https://git.crabinteractive.com/crabdev/SimpleDialogueWiki/raw/branch/main/Docs/3.png)
Once you have your data table lets create a simple dialogue to show branches, and events. Add some rows to your data table. The row names can be named whatever you want to easily identify that line of dialogue. In this demo I have setup a simple opening line that then gives the player two choices which each lead to a different ending to the conversation so my row names look like this:
![](https://git.crabinteractive.com/crabdev/SimpleDialogueWiki/raw/branch/main/Docs/4.png)
Once your rows have names lets define the dialogue itself. For each row you want to define the text to display, and the dialogue slot. Dialogue slots are used to dynamically assign that line of dialogue to whatever character or actor you want that participates in that conversation or dialogue. Since this demo example will only be one character and the player we just need two slots. The dialogue slots can be any integer, just make sure all the lines you want that character to say have the same value. So for my 'opening' row I will fill out some text and leave the slot as 0.
![](https://git.crabinteractive.com/crabdev/SimpleDialogueWiki/raw/branch/main/Docs/5.png)
Next on the 'opening' row, lets define the choices. Under the choices section, enable the 'DisplayChoice?' boolean. This enables choices for that line of dialogue (obviously lol). Next lets add two elements to the *Choices* array under the boolean. Fill in the text field for what you want the text of the option to show and then under expand each element and assign the data table and row you want the choice to direct to when chosen. For this quick start I point the first option to the *choice1* row in the same data table and the second option to *choice2* in the same data table. It looks like this now.
![](https://git.crabinteractive.com/crabdev/SimpleDialogueWiki/raw/branch/main/Docs/6.png)
Now lets look at each choice row. If you want the player to say something assign the *choice1* and *choice2* rows a different dialogue slot from the first line. If you don't want the player to say anything and simply have the choice options to represent their speech you can assign the same dialogue slot to these rows. For this example I will have the player say something so I will assign the choice rows a DialogueSlot of 1, different from 0 from before. Fill in the DialogueText and the *NextDialogueIfNoChoice* variable on each row accordingly. I have *choice1* point to *ending1* and *choice2* point to *ending2*.
![](https://git.crabinteractive.com/crabdev/SimpleDialogueWiki/raw/branch/main/Docs/7.png)
Lastly, just define the text you want each ending to have and leave the *NextDialogueIfNoChoice* empty. If this field is empty the dialogue will end. For each ending I am also going to add an event from the included demo events called *BP_DLGE_ChangeCameraView*. This event simply moves the camera to a predifined position from the NPC character. To do this simply enable the *TriggerEvent?* boolean and add an element to the *EventIDs* array. Select the event actor from the dropdown so it looks like this:
![](https://git.crabinteractive.com/crabdev/SimpleDialogueWiki/raw/branch/main/Docs/8.png)
Now your dialogue is set up! Lets setup our character.
## Setting up NPC
In your level, drag out a *BP_DialogueCharacter* and place them where you want. This demo blueprint includes some pre configured logic for interaction as well as an implementation of starting dialogue. Triggering dialogue is meant to be modular so triggering is performed on the actor component but setting up the layout of which speaker is in which dialogue slot is done on this demo character so that you can define the dialogue layout per character or actor easier.
With your DialogueCharacter in the level, select it and look at the details panel. Under the *Dialogue Config* category is all the variables you need to define your character and their dialogue. Set the display name and color you want and point the *Dialogue to Start* variable to the data table we setup previously. The *Dialogue Slot* variable defines the dialogue slot in the assigned dialogue data table for this character. The *Players Dialogue Slot* variable does the same for the player. So remember, we setup the NPCs dialogue to be slot 0 and the player in slot 1. If you wanted the NPC to say the players dialogue we could flip these to be 1 and 0, respectively. This is the modular nature of the dialogue system and is very helpful in dialogue with multiple participants. I setup my character like this:
![](https://git.crabinteractive.com/crabdev/SimpleDialogueWiki/raw/branch/main/Docs/9.png)
Now jump into game and go interact with your character. The dialogue should work as you have it laid out.