If you will be using the no special name version of the dialogue system and have dialogue audio, you should set the "Default Dialogue Voice" in Project Settings > Plugins > KDialogueSystemSettings > Default Dialogue Voice. This will allow you to ignore the "DialogueContext" input when making DialogueInstructions if the dialogue speaker and target do not matter.
1. Start by right clicking in the content browser and create a new blueprint.
2. When selecting the parent class, open the "All Classes" dropdown at the bottom of the menu. Type in search for "dialogue tree" and select the DialogueTree class. Name your new Blueprint.
3. Open your new DialogueTree Blueprint.
4. If you require multiple speakers, such as for overlapping dialogue or if dialogue audio needs to have 3D positioning, add an audio component for each unique speaker. If no audio components are added, a default one will be created at runtime and used in the DialogueTree for all dialogue audio playback.
5. Under "Class Defaults", you can modify the "enterBlendTime", "enterBlendFunc", and "enterBlendExponent" values to set how the camera will move to the starting position for the KCameraDirector you'll link to this DialogueTree later. Otherwise, entering this tree will transition the camera with a hard cut.
6. To create the flow of the DialogueTree, you'll be using a mix of several functions.
ExitDialogue() - This function should be used at any point in the tree where you want the dialogue to end.
Path() - This function creates a DialoguePath that allows you to sequence any number of DialogueInstructions within a single node for linear progression.
Branch() - This function creates a DialogueBranch that allows you to present a choice that produces different outputs based on the input.
Step() - This function creates a DialogueStep that allows you to progress through a single DialogueInstruction.
Subtree() - This function allows you to nest any DialogueTree within the current tree and traverse it before returning to the parent tree.
7. To make the entry point for the DialogueTree, find the "Functions" section on the left-side of the Blueprint editor window. Beside it is an "Override" dropdown menu. Open this dropdown and select the Root() function. This will add a Root() node to the Blueprint event graph.
8. Drag off the execution pin on the Root() node and call the Step() function (or whatever function you want to start with). If how you enter the DialogueTree differs depending on any conditions, you can evaluate those conditions in the execution order first from the Root() node.
9. For the Step() function, you'll need to create some additional Unreal Engine assets in order to fill out all the input parameters. Start with the string table. Unreal Engine uses string table assets to store key-value pairs. Make a string table and fill out some key-value pairs. The keys will be used in DialogueInstructions to get a value text to be displayed. The reason string tables are being used is because they support localization with Unreal Engine's localization tools.
10. If you will be playing dialogue audio, you need to make a DialogueWave asset. DialogueWaves support localization as well as contextual sound wave choice based on speaker and target. The dialogue system does not currently support contexts for different speakers/targets, so make a DialogueVoice asset to always be used as the "Speaker" and set the "Default Dialogue Voice" to this DialogueVoice asset in the dialogue system settings.
12. Next, you'll need to create an DialogueInstruction struct to use as the input parameter for the dark blue "instruction" pin. The easiest way to do this is by dragging off the "Dialogue Instruction" input pin and typing "make." This should provide the option to "Make Dialogue Instruction." A dark blue node should appear connected to the input pin. This node has many parameters on it (some may be hidden in a dropdown arrow).
NOTE: Different types of dialogue tree nodes will use different dialogue instruction structs.
13. Fill out the DialogueInstruction node.
Dialogue Key = The key that matches the key for the string table you're about to assign. To assign what string table to use, click the flag next to the input box and select your string table.
Dialogue Wave = The DialogueWave asset you made for this dialogue audio.
Dialogue Context = You can leave this empty since the dialogue system will automatically get the "Default Dialogue Voice". The dialogue system does not currently support contexts for different speakers/targets.
Speaker = An audio component reference from your DialogueTree that you want to play the dialogue audio (not needed if you aren't playing dialogue audio). This will use a default audio component positioned at the DialogueTree actor's world position if no input is provided.
Camera = The key that matches a key-value pair camera on the DialogueTree's linked KCameraDirector.
Level Sequence = The key that matches a key-value pair level seqeunce on the DialogueTree's linked KCameraDirector.
Skippable = This bool indicates that a dialogue instruction can skip to the next DialogueInstruction if input is received.
Response = This enum indicates what the dialogue tree node should do when it reaches the end of an instruction. NOTE: Auto only works if there is dialogue audio or a level sequence that can start and finish. Otherwise it will function as if response was set to Input.
Auto = Automatically continue. Behaves as Input if no dialogue audio or level sequence plays.
Input = Wait for input.
Timed = Wait a set amount of time before auto progressing.
Trigger Time = How long to wait before auto continuing if the "response" property is set to Timed.
Audio Start Delay = Delay the start of the dialogue audio by this amount in seconds.
Audio Finish Delay = How long to wait after audio finishes playing if the "response" property is set to auto before automatically progressing.
14. Lastly, you will set up an event that gets called with the DialogueStep object created by the Step() function finishes. Drag off the red "On Finish" event input pin. Create a custom event and name it whatever you want. It should be automatically connected to the "On Finish."
15. From the execution pin on your custom event, you can continue your DialogueTree flow logic. Path(), Branch(), Step(), and Subtree() might give different output parameters in the custom event signature so you can use them. If you want to finish the dialogue, add the ExitDialogue() function.
16. At this point, you have the most basic DialogueTree and creating more complex trees follows the same repeated procedure (minus needing to create a new string table or sound data table).
1. Dialogue should often exist in a sublevel that can be dynamically loaded based on game state and progress. This sublevel includes everything need for the dialogue to take place (DialogueTree, KCameraDirector, characters, and props).
2. Place your DialogueTree in the sublevel.
3. Add a KCameraDirector to the sublevel.
4. On your instantiated DialogueTree, in the details panel, assign the KCameraDirector you placed in the sublevel to the "Camera Director" variable.
4. Place your characters and props in the sublevel.
The KCameraDirector allows you to setup the visuals shown at each step of DialogueTree progression. The "Camera" and "Level Sequence" parameters from DialogueInstructions are used to search the "Cameras" and "Level Sequences" dictionaries for a match on the KCameraDirector. Within your sublevel, you need to add inactive cameras and assign them to the "Cameras" dictionary or create level sequences and assign them to the "Level Sequences" dictionary. NOTE: The "Camera" parameter in an DialogueInstruction supersedes the "Level Sequence" parameter.
To enter dialogue, call EnterDialogue() from the DialogueManagerSubsystem. You just need a reference to the DialogueTree you want to use.
To receive and display text from the dialogue system, there are 4 bindable events on the DialogueManagerSubsystem.
OnDialogueNext - This event is broadcast when the active DialogueTree enters a Path(), Branch() or Step(). It passes an FText that is meant to be the main dialogue text to display.
OnDialogueChoices - This event is broadcast when the active DialogueTree enters a Branch(). It passes an array of FTexts where each element is meant to be the text to display for the dialogue choice. An empty FText indicates that the conditions to have the dialogue choice were not meant and the option should be hidden.
OnDialogueEnter - This event is broadcast when the DialogueManagerSubsystem successfully activates a DialogueTree in the EnterDialogue() function.
OnDialogueExit - This event is broadcast when the DialogueManagerSubsystem exits a dialogue either by calling ExitDialogue() on the subsystem or when the DialogueTree self exits.
This highly depends on how your game progression and level loading is set up per project. If you are using the KGameFramework, you may load dialogue sublevels using the Quest System . The simplest way to load a dialogue sublevel if it's not dependent on game progression is with a collision trigger.