# Dialogue System

**URL:** <https://forums.unrealengine.com/t/dialogue-system/44974>\
**Category:** Game Development\
**Tags:** unreal-engine\
**Created:** [October 17, 2015, 10:16pm UTC](https://forums.unrealengine.com/t/dialogue-system/44974 "2015-10-17T22:16:37Z")\
**Posts on this page:** 20\
**Page:** 13

<div class="post-metadata">

**Author:** ![artemavrin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@artemavrin](https://forums.unrealengine.com/u/artemavrin)\
**Post date:** [April 12, 2016, 8:11pm UTC](https://forums.unrealengine.com/t/dialogue-system/44974/247 "2016-04-12T20:11:52Z")

</div>

> [@serioussam909;511206](#):
>
> Yeah, that would be great. Add some simple patrolling behaviour to one of your bots that changes to dialogue once you get close to him and press “talk”.

I’ve got it)

1. Create one more behavior tree variable in your bot character and set your basic AI behavior tree:

![01.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/9/e/59e5a0416ce1aa57eee94f9ddefd61a6aa5d31c3.png) ![02.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/2/5/d25ac2fad232726fccec18516cc98503f62a9a33.png)

1. In DialogueController (AIController) create branch:

 ![03.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/e/0/7e0c1656728da9d0b1ae9b850e1e1d339dd50346.png)

1. We should set game mode and cursor visibility, because CloseDialogue task doesn’t run (patrol behavior runs before it)

 ![04.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/8/a/98a2239062526207d5df258f252e9d1b2bf740c9.png)

And that’s all we need. You can redownload sample project, I just updated it:)

---

<div class="post-metadata">

**Author:** ![serioussam909](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@serioussam909](https://forums.unrealengine.com/u/serioussam909)\
**Post date:** [April 12, 2016, 8:27pm UTC](https://forums.unrealengine.com/t/dialogue-system/44974/248 "2016-04-12T20:27:15Z")

</div>

Thanks, I’ll check it out - btw - your attachments are broken.

---

<div class="post-metadata">

**Author:** ![artemavrin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@artemavrin](https://forums.unrealengine.com/u/artemavrin)\
**Post date:** [April 12, 2016, 8:33pm UTC](https://forums.unrealengine.com/t/dialogue-system/44974/249 "2016-04-12T20:33:58Z")

</div>

> [@pkunkasfkuck;511529](#):
>
> 1. Could this be put in a new example project? I still feel this could be easier to implement on a conversation as a public parameter for each dialogue. Or a checkbox on the Dialogue Widget. I followed the tutorial from the youtube video, and this did not work for me when pressing the spacebar.
> 2. Having the NPC and Player Character use the same phrase text box is not intuitive. If I want the PlayerCharacter and the NPC to have separate dialogue boxes, then this gets confusing. I have tried switching the PhraseSlot to the QuestionsSlot, but then I just get a “Text Box” message in the QuestionSlot. Which means it’s difficult to distinguish, unless I start saying the characters name in each text message. Perhaps this is just not working. If you could implement in an example project that would be helpful also.
> 3. Yes, please check out this video from IMO one of these best dialogue driven games [https://www.youtube.com/watch?v=fZ1xL1LgH-U](https://www.youtube.com/watch?v=fZ1xL1LgH-U) Everytime you run into Deionarra, the music changes to her theme. Same could be done for a number of characters.

1. Behavior Tree doesn’s have any information about key pressing, and UserWidget has. So I just can pass this information from widget to behavior tree throw the event listener. It’s not so hard, just follow the tutorial carefully, you might miss something.
2. To separate phrases just create another text widget and give them different name. By default phrase slot name is PhraseSlot. In behavior tree and widget they should be the same.

 ![pic.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/e/e/eea17f40b3280e526d1576a857375b53607707b1.png)

---

<div class="post-metadata">

**Author:** ![serioussam909](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@serioussam909](https://forums.unrealengine.com/u/serioussam909)\
**Post date:** [April 12, 2016, 11:32pm UTC](https://forums.unrealengine.com/t/dialogue-system/44974/250 "2016-04-12T23:32:47Z")

</div>

Hmm, I see that you’re using a BT services to populate most blackboard values in each tick. (not a very good solution for complex ai behaviours)  
You however don’t update the waypoint value and that’s why it resets each time I talk to the bot. After the dialogue ends the bot turns around and goes to a different waypoint - that should not happen unless it’s explicitly triggered by the dialogue.

My approach is to update blackboard from player controller when necessary. And it doesn’t work with the dialogue system, because switching BTs always resets blackboards.

I’m now going to experiment whether having 2 controllers (one for dialogues, other for the rest) per character is a good idea.

---

<div class="post-metadata">

**Author:** ![artemavrin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@artemavrin](https://forums.unrealengine.com/u/artemavrin)\
**Post date:** [April 13, 2016, 3:34am UTC](https://forums.unrealengine.com/t/dialogue-system/44974/251 "2016-04-13T03:34:15Z")

</div>

I update isTalking and CanTalk every tick because I shold now is bot talking or not at this moment)  
Can you explain why you can’t use one blackboard data for AI and dialogues? With one blackboard it works perfect.

---

<div class="post-metadata">

**Author:** ![serioussam909](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@serioussam909](https://forums.unrealengine.com/u/serioussam909)\
**Post date:** [April 13, 2016, 7:40am UTC](https://forums.unrealengine.com/t/dialogue-system/44974/252 "2016-04-13T07:40:02Z")

</div>

Because I’d have to use the same blackboard for every single BT that I have. If I have 10 dialogues, but the same Blackboard data - it could get very messy.

Also I tried the two controller solution (with dialogue bt running all the time in the background) and now the editor crashes on  
Plugins\DialogueSystem\Source\DialogueSystem\Private\BTTask\_ShowPhrases.cpp L106 - with “array out of bounds” exception when it reaches the same “show phrases” node again.

---

<div class="post-metadata">

**Author:** ![artemavrin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@artemavrin](https://forums.unrealengine.com/u/artemavrin)\
**Post date:** [April 13, 2016, 8:59am UTC](https://forums.unrealengine.com/t/dialogue-system/44974/253 "2016-04-13T08:59:21Z")

</div>

> [@serioussam909;511781](#):
>
> Because I’d have to use the same blackboard for every single BT that I have. If I have 10 dialogues, but the same Blackboard data - it could get very messy.

Can you try in sample project in dialogue blackboard set patrol blackboard as parent? Will the bot return to the first waypoint after dialogue? I don’t have access to my computer now and can’t try by myself.

---

<div class="post-metadata">

**Author:** ![unit23](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/unit23/32/1223962_2.png) [@unit23](https://forums.unrealengine.com/u/unit23)\
**Post date:** [April 13, 2016, 9:03am UTC](https://forums.unrealengine.com/t/dialogue-system/44974/254 "2016-04-13T09:03:04Z")

</div>

Is this working with 4.11?

Nevermind i just read the other page, awesome, will give this a try. Thanks!

---

<div class="post-metadata">

**Author:** ![artemavrin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@artemavrin](https://forums.unrealengine.com/u/artemavrin)\
**Post date:** [April 13, 2016, 9:08am UTC](https://forums.unrealengine.com/t/dialogue-system/44974/255 "2016-04-13T09:08:11Z")

</div>

> [@unit23;511841](#):
>
> Is this working with 4.11?
> 
> Nevermind i just read the other page, awesome, will give this a try. Thanks!

yes, 1.5.2 for 4.11:)

---

<div class="post-metadata">

**Author:** ![serioussam909](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@serioussam909](https://forums.unrealengine.com/u/serioussam909)\
**Post date:** [April 13, 2016, 9:41am UTC](https://forums.unrealengine.com/t/dialogue-system/44974/256 "2016-04-13T09:41:50Z")

</div>

> [@](#):
>
> Can you try in sample project in dialogue blackboard set patrol blackboard as parent?

Parent/child blackboards are still treated as different blackboards unfortunately.

---

<div class="post-metadata">

**Author:** ![artemavrin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@artemavrin](https://forums.unrealengine.com/u/artemavrin)\
**Post date:** [April 13, 2016, 7:26pm UTC](https://forums.unrealengine.com/t/dialogue-system/44974/257 "2016-04-13T19:26:34Z")

</div>

> [@serioussam909;511864](#):
>
> Parent/child blackboards are still treated as different blackboards unfortunately.

Found solution, I hope:) Yes, we need 2 controllers. 1st - basic ai, and 2nd - dialogue controller. (they are running at the same time)

1. In Dialogue bot create variable, type - dialogue controller **class**. Set it.

![01.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/c/c/7ccc909660586c6bff2ffb551b35d65d05a490fa.png)

1. In Dialogue bot on begin play spawn controller of that class. Owner - dialogue bot.

 ![02.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/a/c/cace0723fa5b272c8a01d12a60882e2dce5d3dd8.png)

1. Now we should change controlled pawn node to owner node, because dialogue controller doesn’t have controlled pawn, just owner (it’s more than enough)

 ![03.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/9/6/596c9f0430d2cb3b05ed89b03023111df83ef60b.png)

You can check sample project. I hope it helps:)

---

<div class="post-metadata">

**Author:** ![serioussam909](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@serioussam909](https://forums.unrealengine.com/u/serioussam909)\
**Post date:** [April 13, 2016, 8:10pm UTC](https://forums.unrealengine.com/t/dialogue-system/44974/258 "2016-04-13T20:10:51Z")

</div>

Thanks, but I’ve implemented something like that already.

And you really should fix the crash on L106 in Plugins\DialogueSystem\Source\DialogueSystem\Private\BTTask\_ShowPhrases.cpp  
I inserted this after L105 and that prevents those crashes.

```auto

if (ShowingNumPhrase > PhrasesCount) {
	ShowingNumPhrase = PhrasesCount;
}

```

But maybe there’s a better way.  
Have you thought about putting your code on github btw?

---

<div class="post-metadata">

**Author:** ![artemavrin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@artemavrin](https://forums.unrealengine.com/u/artemavrin)\
**Post date:** [April 13, 2016, 8:34pm UTC](https://forums.unrealengine.com/t/dialogue-system/44974/259 "2016-04-13T20:34:23Z")

</div>

if ShowingNumPhrase \> PhrasesCount already something wrong. As you can see in node startup ShowingNumPhrase = 0. I really don’t know, how do you get this situation)) It’s not normal behavior!  
I’ll think about github)

---

<div class="post-metadata">

**Author:** ![serioussam909](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@serioussam909](https://forums.unrealengine.com/u/serioussam909)\
**Post date:** [April 13, 2016, 9:22pm UTC](https://forums.unrealengine.com/t/dialogue-system/44974/260 "2016-04-13T21:22:40Z")

</div>

Are you talking about the constructor on L24?  
Don’t think that it fires more than once if the bt keeps running in the background all the time.

Anyway - your code should not crash without warning for users that only use blueprint. And in that place that I showed you - you never do bounds checking before accessing the phrases array.

---

<div class="post-metadata">

**Author:** ![artemavrin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@artemavrin](https://forums.unrealengine.com/u/artemavrin)\
**Post date:** [April 14, 2016, 2:10am UTC](https://forums.unrealengine.com/t/dialogue-system/44974/261 "2016-04-14T02:10:02Z")

</div>

> [@serioussam909;512291](#):
>
> Are you talking about the constructor on L24?  
> Don’t think that it fires more than once if the bt keeps running in the background all the time.
> 
> Anyway - your code should not crash without warning for users that only use blueprint. And in that place that I showed you - you never do bounds checking before accessing the phrases array.

thank you!) I appreciate your help!

---

<div class="post-metadata">

**Author:** ![thejohncrafter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@thejohncrafter](https://forums.unrealengine.com/u/thejohncrafter)\
**Post date:** [April 15, 2016, 7:43pm UTC](https://forums.unrealengine.com/t/dialogue-system/44974/262 "2016-04-15T19:43:00Z")

</div>

Fixing Decorators

Hello !

Could you please create a Github repo for this plugin ?  
Because I found a problem in this system, and I fixed it, but I modified too much code to just post the fix here.  
This is about Decorators : Questions did not check them, and were shown even if they “did not agree”.  
And I think the plugin would be even better if everyone could contribute to it 😃

Thank you for this plugin !

---

<div class="post-metadata">

**Author:** ![artemavrin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@artemavrin](https://forums.unrealengine.com/u/artemavrin)\
**Post date:** [April 15, 2016, 10:44pm UTC](https://forums.unrealengine.com/t/dialogue-system/44974/263 "2016-04-15T22:44:28Z")

</div>

Added typewriter effect 🙂 I’m working on skipping now

![textEffect.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/9/3/5931d968c514704bae09eaf35a3d2f9c424365dd.png) ![typewriter.gif](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/8/0862d6350e66e238898bb821ffa689b3900c3f5e.gif)

---

<div class="post-metadata">

**Author:** ![Savagee25](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Savagee25](https://forums.unrealengine.com/u/Savagee25)\
**Post date:** [April 15, 2016, 11:43pm UTC](https://forums.unrealengine.com/t/dialogue-system/44974/264 "2016-04-15T23:43:57Z")

</div>

🆒… yeah

---

<div class="post-metadata">

**Author:** ![artemavrin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@artemavrin](https://forums.unrealengine.com/u/artemavrin)\
**Post date:** [April 16, 2016, 12:17am UTC](https://forums.unrealengine.com/t/dialogue-system/44974/265 "2016-04-16T00:17:22Z")

</div>

Created GitHub repository [GitHub - artemavrin/UE4-DialogueSystem: Dialogue System source code](https://github.com/artemavrin/UE4-DialogueSystem)

---

<div class="post-metadata">

**Author:** ![thejohncrafter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@thejohncrafter](https://forums.unrealengine.com/u/thejohncrafter)\
**Post date:** [April 16, 2016, 10:43am UTC](https://forums.unrealengine.com/t/dialogue-system/44974/266 "2016-04-16T10:43:46Z")

</div>

Thank you, I will create a fork !

[Previous page](https://forums.unrealengine.com/t/dialogue-system/44974.md?page=12)

[Next page](https://forums.unrealengine.com/t/dialogue-system/44974.md?page=14)
