[SOLVED] Make dialogue move to the next line when changing a global variable by 1?

In my game I have a quest system where the player will find a letter and it will give you a quest. I have set up a ‘pop-up’ journal window where a BF text box displays a dialogue tree. It has one branch with each line inside that branch being a different quest.
The events of the journal and quest ‘text’ are in an external event (called ‘UI’) so I can use it in multiple scenes. I’ve set up a global number variable (‘Quest_Log’) that when the player receives a new letter it increases by 1. All other events, including the letter pickup, are in the first level.
How would I then set it so every time the ‘Quest_Log’ global variable increases by 1 the dialogue moves onto the next line?
Sorry if that doesn’t make sense, it’s a little difficult to explain.

The events of my external event ‘UI’:


The events of my scene:

1 Like

Also, the events that I currently have don’t move the dialogue to the next line and I’d rather set it up so I don’t have to manually add the ‘global variable ‘‘quest_log’’ = 1’ then 2 then 3 etcetera

(In editor) create a variable called FakeQuestLog and set to 0

Event:

Condition:
Global variable FakeQuestLog < QuestLog

Actions:

Change global variable FakeQuestLog set to QuestLog
(Your dialog action)

Unfortunately that didn’t work

You are not adding 1 to Quest_Log anywhere in that picture?

I do in the scene events which is separate to this external event

The provided method of “fakeVariable < Variable” should work properly. (Unless you have both a scene and global variable named Quest_Log)

But about the dialog branch events, I don’t know nothing about how they work or what they are supposed to do, so I can’t help that much with those, but I can say that the problem is surely with the dialog branch events, because this global variable loop thing will work normally.

Thanks for assist anyway, hopefully someone else has some ideas :slight_smile:

I love the idea of your quest system.

Could you just add the Go to the next line of Dialogue right into the condition where you press Button Y of gamepad 1? Put it under the action Change the global variable QuestLog add 1. Then you can both change your variable and advance to the next line at once.

Thanks for the reply, unfortunately this didn’t work either :frowning: I’ll include some updated screenshots of my events:
The UI external event:


And my scene’s events:

Just bumping in case anyone else has any ideas on how to fix my issue :slight_smile:

I just did a quick mock up where each time the variable questLog increases by 1 the dialogue moves to the next line. It’s quite simple, so I’m probably misunderstanding what you’re trying to do. One drawback is having a lot of ‘go to the next dialogue line’ events. Someone better at expressions and/or maths might know of a better way of tackling that aspect - perhaps comparing one variable to another to move the dialogue along by one line… I don’t know.

Anyway, the ‘a key is pressed’ event could be any trigger you like, such as another variable changing or a collision happening or your player getting a letter. I don’t have time to set things like that up, but this simple example works. I hope it helps.

Edit: The dialogue will always show the first line when it launches, so the first sub-event isn’t needed. You could delete the questLog = 1 sub-event. So the first time the player is given a quest they will see line one when the dialogue launches with no questLog check necessary. The ‘questLog =’ sub-events take over from quest 2 onwards. In other words, the first sub-event doesn’t actually do anything. In this scenario, the questLog variable would need a start value of 1, not 0, as in the screenshot below.

Thanks for the reply, I’ll take a look on the weekend!

Thanks for all the help everyone! I managed to get it working by doing the following:

In the scene:

And in an external event that is loaded in every scene:

I think it was just a combination of me missing out basic things like ‘at the beginning of the scene’ and not understanding the logic.