Very strange issue with variables, began out of nowhere

It's been a while since my last thread, given that barely any issues had gotten in my way. I regret to inform you this time something did happen.

In my game, i have come up with the idea of multiple possible cutscenes depending on the player's choices. It had been working pretty well until now. I have one variable that changes between each specific cutscene. This is the one causing me trouble:
1731098337031.png

"Jess alts".

As you can see, once the cutscene is over, the variable changes to six. Now, because the variable is six, the new dialogue with the variable conditions to this specific variable set to six should play. I'm talking about this one:


1731098611507.png


But not only does this NOT show up once interacting with the npc, it plays out this one random dialogue that should only appear once the same variable is set to 2:

1731098845700.png


Once advancing through the story, THEN the intended dialogue with the variable 6, that is not supposed to show up anymore, decided to do so only then.

What in the tarnation? What?

I'm so utterly confused. I tried looking up what could possibly be messing up with the variables, inspecting the events carefully, but the earliest cutscene setting the variable to six should be working, but it simply doesn't.

Event though, some days ago, it was working perfectly fine, and i confidently remember not messing with any of the events. The time i didn't spend making the new cutscenes were spent making new maps, and it just doesn't make sense to me why this is happening.

I'm really hoping this is just a dumb little mistake i made. Any help would be immensely appreciated.
What are the pages after page 4? It runs the highest valid page, so you may have duplicated page 2 later on with another condition.

Also its possible you got something else adjusting that variable in say a parallel process that is running after the cutscene, which would reset it back to something else. May need to use the search function in the engine to find uses of that variable to check.
To add to that: The engine always reads only the page with the highest ID, that has their conditions met. So if there is a page with a higher ID than 4, with a condition that is met before that if page 4 is met (like a lower value of the same variable), then page 4 will never run.

When you think something is wrong with your variables and you get an unexpected result, you can simple add a text message, saying "\v[2]" to show the value of this variable. This will help a lot in finding where the mistake lies. Just don't forget to delete that message after.

When on the map, you can also press F9 to open a menu that shows all values of variables and switches in your game. (At least, in MV it is F9, I assume it is the same key in MZ.)
Something you might want to check is your plugins. Some plugins will use the game's variable database in their code. For example, you could have a lighting plugin that's reserved the same variable and is making changes to the lighting by increasing and decreasing that variable every X ticks.
It can't be the page priority, because page 2 and page 4 have similar conditions and page 4 has higher priority. So the only way for page 2 to be active is if the value of the variable is lower than 6 but higher ot equal than 2.

so basically you need to find out what changed the variables value.

Use the editor search function for all uses of that variable - if it is used somewhere else in an event that is a parallel process, then this can happen.

if that search does not find additional events using the variable, then the variable was changed by script commands, either in the event command "script" or in a plugin.

The plugin option is more likely as there are a lot of plugins that use variables to exchange data and commands with the engine.
And that is why you always have to configure all plugins completely on adding them:
if a plugin uses such a procedure, it has a property line for the ID of a variable (or more than one) assigned to a plugin function.
On adding such a plugin you need to point that toward an unused variable and then name that variable as a sign that it is in use and where/for what.
Actually Andar it can...if page 2 is duplicated on say page 5. That's why we suggested it. And why we want to see the pages after page 4.
OK, I assumed that each page is unique and that the OP identified the correct page that is active.
Actually Andar it can...if page 2 is duplicated on say page 5. That's why we suggested it. And why we want to see the pages after page 4.
If you want to see some of them, here you go:
1731142332339.png

1731142349996.png

1731142368607.png

1731142389392.png


I'm only not showing all of them because the following ones are only interacting with different variables or switches.

I spent now two hours testing around with the same variable, deleting some, changing others, experimenting. Some of the expected events are showing as planned, which is good, but there is something still changing the variable back to two and one. I have no idea what it is, i used the search tool as suggested, and it has been incredibly helpful, as much as it didn't really show me whatever is changing the variable back to those specific numbers.

Also, i do not use any parallel process. Just to make it clear.

I'm thinking of creating a new variable that does the exact same thing as the previous, seemingly defectible one, this time with the help of the search tool to replace everything. Maybe it won't solve the problem, but once i get home from work, i'll see this thread again in case someone responds. Thank you all for the help!
Just deleting and remaking the event/variable might solve the issue for now... But it doesn't undo the mistake made. You actually should know why it showed the wrong page, and how that happened. If you don't find this out now, you might walk into larger problems later.

This could simply be a typo somewhere, in which case remaking it would solve everything, but if there is something working in the background, this problem isn't actually solved, but just out of sight. When the problem returns further down the development process, you might find out you have to redo pretty much everything.

Did you try pressing F9 to see what value was actually stored in the variable? This is really the first step to finding the problem.

Remember that debugging is never fun and can sometimes be very frustrating. But it is part of the job and can't be skipped or ignored, or you will end up with a buggy game.
as much as it didn't really show me whatever is changing the variable back to those specific numbers.
and I told you when I described the search tool above that if that doesn't find anything, the next likely cause are plugins withz a wrong configuration.
So what plugins have you installed? Please show screenshots of your plugin manager so that we can see not only their names but also their order.
and I told you when I described the search tool above that if that doesn't find anything, the next likely cause are plugins withz a wrong configuration.
So what plugins have you installed? Please show screenshots of your plugin manager so that we can see not only their names but also their order.
Oh, i'm sorry i didn't tell you earlier, i'm not using any plugins either! Apologies.

Just deleting and remaking the event/variable might solve the issue for now... But it doesn't undo the mistake made. You actually should know why it showed the wrong page, and how that happened. If you don't find this out now, you might walk into larger problems later.

This could simply be a typo somewhere, in which case remaking it would solve everything, but if there is something working in the background, this problem isn't actually solved, but just out of sight. When the problem returns further down the development process, you might find out you have to redo pretty much everything.

Did you try pressing F9 to see what value was actually stored in the variable? This is really the first step to finding the problem.

Remember that debugging is never fun and can sometimes be very frustrating. But it is part of the job and can't be skipped or ignored, or you will end up with a buggy game.


And andresing what JohnDoe said, pressing F9 opens the database. I am unable to find the variables section, and looking up the information unluckily results in nothing. If the method of accessing the debug is different than of what i tried, could you elaborate further?

Edit: Forgot to include, but used the search tool again. The variable in question was not used many times, so it wasn't too hard to find each and every alteration it suffered. There wasn't anything changing the value back to two, so that still remains a mystery for now.

Edit 2: Turan just told me how to access the debug console. I'm working on it now to see when exactly does the variable changes back to two.
And andresing what JohnDoe said, pressing F9 opens the database.
You press it during a play test to access the debug console. There's no such thing as variables having a value while you're in the editor.
You press it during a play test to access the debug console. There's no such thing as variables having a value while you're in the editor.
Oh.

I didn't know. I apologize.

Thanks! I'll work into that right away.
Oh.

I didn't know. I apologize.

Thanks! I'll work into that right away.
Haha, yeah I meant during test play, while on the map
Haha, yeah I meant during test play, while on the map
Okay, i did a lot of testing now, and the solution of one problem led to another.

I found out that, what was messing with my variables was one single conditional branch (if a certain party member was in the party). Erased it, copied the possibilites to other pages with new variable values, tested. Everything was fine until another wall hit my face.

Now it's refusing to play a certain cutscene even if the intended variable value is set and the conditions are specifically met (i checked the debug menu, there was no mistaking it).

Here are the pages:
1731187276683.png

1731187450318.png



1731187308469.png


The only reason why i'm relying in conditional branches for the cutscenes to work again is because the conditions tab was just not working. The branches didn't work either, and now i'm stuck again. Perhaps later i'll try setting the variables from scratch and try to trust the conditions tab again. Or, remaking the events.
the conditions tab was just not working
how so? you used page conditions in your 13 page event. why wouldnt it work on the others?

of the ones you just shared, page one of the first event will never play. its conditions are identical to page 2 and has a lower priority
instead of showing the code, can you write the whole thing as a block chart?
dispose of the dialogue and focus on the flow itself... you *know* the dialogue only goes one way, so take it out.
that will help you see the whole thing from a vantage point (which is how you should do it from the beginning: write it first, then code it)
The only reason why i'm relying in conditional branches for the cutscenes to work again is because the conditions tab was just not working.
Except that simply doesn't work that way. If you have multiple event pages with no conditions, it doesn't matter whether the contents will ever be executed or not based on a Conditional Branch - the earlier pages will never happen. The engine only looks at the highest-numbered page that meets its conditions.

Events don't just refuse to play, something is wrong in your project. Either it's the wrong event type, a variable isn't set up how you think it is, a condition is wrong, something.
Wait a minute, if all the pages' triggers are identical, which don't you just use conditional branch and jump? It makes life easier.
Wait a minute, if all the pages' triggers are identical, which don't you just use conditional branch and jump? It makes life easier.
They're only identical now because the OP thought they could test that way.

The thread was originally written because they're setting a variable in one place and getting a different event page showing up - the first post has a series of pages with a variable's value as the condition.

The variable must be getting handled someplace else.

That will make the event malfunction regardless of whether you're using event pages or conditional branches.

Original thread: https://forums.rpgmakerweb.com/threads/very-strange-issue-with-variables-began-out-of-nowhere.173102/