I’m trying to understand how to create a dialogue tree, with GDevelop interaction, where a branch is determined, but will not begin until the player interacts with the NPC. It’s easy to understand an uninterrupted stream of conversation, but I’m describing the end of one discussion, where the result in that discussion will affect the discussion that will take place with once I meet another NPC.
For example, there’s a discussion with NPC A that’s been completed. That discussion would cause a future discussion that’s had with NPC B. However, the player could meet NPC C first and talk with them, Then, they may (or may not) talk with B. If they do talk with B I want that discussion to be vary, based on my earlier discussion with A. Does Yarn cover for this scenario through its own commands, or is there something I have to account for in GDevelop when I begin to interact with NPC B in the future?
I’ve honestly not tried creating this scenario, but trying to understand where the control rests in general in this situation… Yarn or GDevelop? When I meet B in the future, would I just tell Yarn to load the next dialogue and its logic would determine which version to present?
There is more than one way to do this:
You can use Yarn conditions like “Branch title has been visited” to check i a player has already seen certain dialogue. You can use this check to launch different dialogue. e.g. if the player has not visited the branch, then you can launch “Hello” dialogue, but if they have visited the branch you can launch “We already spoke!” dialogue. I haven’t really experimented with this and I don’t know how you would save these things into a save file. Other people may know.
You can track dialogue state using a regular variable in GDevelop. That is what I do.
I have a structure variable with all my game’s NPC names in. Each NPC has a child variable that tracks what dialogue state they have. So if the variable for Bob is 0, then the player will see a welcome dialogue when they talk to him, but if the variable is 1 they will see something else. After the player speaks to an NPC, the variable changes so that the player doesn’t see the same dialogue again.
Let’s say that you speak to NPC 1. He says “Nice to meet you”. His variable changes from 0 to 1. When you speak to NPC 1 again, he will say “We spoke before.”. And when you speak to NPC 2, he will say “I see you already spoke to my friend, NPC 1”. You can do all that with a simple variable check condition that you then use to launch specific dialogue. And the number could mean anything you like. Maybe 4 means you were rude to the NPC last time so you can launch the “Hey, I don’t like you!” dialogue next time.
Although I haven’t done a save system yet, I understand that saving a structure variable with all this information is an easy thing to do, so when you load the game the NPCs will still ‘know’ if you already spoke to them.