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.
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.
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.
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.
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.
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.
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.
if (ShowingNumPhrase > PhrasesCount) {
ShowingNumPhrase = PhrasesCount;
}
But maybe there’s a better way.
Have you thought about putting your code on github btw?
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)
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.
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