Download

Evolving dialogues with NPC

Hello!

I have a companion in my game with whom I can interact and trigger dialogues. I want my actions and what I choose to tell him to have an influence on our future discussions. (He can like or dislike me, or go crazy…). I was wondering if there were some sort of “best practices” to do these kind of things.
I’m very new to Unreal and for now, the only way I see how to do this is to create boolean variables everywhere (that are checked true or false depending on my actions), and then the blueprint would check which boolean is true or false and I would type dialogues accordingly. But this seems overcomplicated. So… with an array maybe? What do you think?
(This question also works for having several paths in the game which I’m also considering doing (so, other rooms, other NPCs, objects according to your actions)

Isn’t there a free dialoque plug-in on the market, perhaps take a look there.

However, generally you probably want to start with a datatable to store all your content, and also along the way a savegame.

You would need a structure with the data you need, and a datatable based on that structure. For interactions I made a datatable for static text display with a few options (in case there are any) or straight up display of text, example:


Then for the display you could pull from the structure the content and display it inside a widget. This example here is usable for a few options only, otherwise you would use different code I guess.

Now when this is in place, we probably want another structure to keep track of the past conversation answers, and this structure would be stored in an array for that structure. So we would setup this ConversationStructure with things like, ID (integer), Input (integer). So basically two integer can keep track of discussions. the first to id a conversation, and secondly to either set a 0 (answer was no), 1 (answer was yes), or 2 (no answer).

For instance we pull from our datatable a conversation with an option, then depending on what the player responded add the conversation ID with the corresponding response integer value to the ConversationStructureArray. Similar if we display a conversation we would read from the array past answers, and depending on this would pull the right ID. And here it probably gets a bit tricky, and here we could use a couple of bools as well.

Hello! Thank you for your answer!

I couldn’t find any free dialogue plug-in unfortunately, but if you know of any, that would be great.

What’s more, I tried to get into behaviour trees with this tutorial: https://www.youtube.com/watch?v=xI7WHD5C-ps.
Do you use them with database for your project? Or do you use something else?
But I can’t make it work in my project. Somehting get lost along the way, but I don’t know what. I think this has to do with the fact that I use one widget for my responses and one widget of my NPC talk, and they are both in 3D.

Would you know of somewhere I could learn about behavior trees?

I’m lost haha.