Trying to Randomize Questions

I tried to create a quiz mini-game with multiple choice answers, but I'm having trouble randomizing the questions. Here's what I got:

If: #0004 = #0004
Control Variables:#0004 = Random 1...3
Common Event:Lars riddle 1
Exit Event Processing
Control Variables:#0004 = Random 1...3
Common Event:Lars riddle 2
Exit Event Processing
Control Variables:#0004 = Random 1...3
Common Event:Lars riddle 3
Exit Event Processing
End

I put Exit Event Processing after each question so it wouldn't go to the next question automatically, but I can only get it to display the first question. I can't make it display the other questions. I tried putting #0004 Random 1...3, thinking that meant one in three chance of popping up. If anyone can explain what I have to do to get the result I want, I would be very grateful. Thanks!
So first, please show a screenshot of the event instead of typing it out like this.

Judging by what you have written, you have no way to track the progress the player has made through the quiz.
So of course it restarts every time you activate the NPC (which I assume you are doing, but you don't show that information so it's left up to interpretation.)
Events just run top to bottom through the commands, unless you use a variable to track "player completed question 1", it will never know that the player has completed the question and so it will repeat, repeat, repeat, repeat, repeat, repeat....

I'm also not sure what you are doing with "if variable 4 === variable4"
Or anything else you are illustrating with what you have written.
So if my advice doesn't help you, you will need to post a screenshot.
Do not crop the screenshot either when you post it, please.
So first, please show a screenshot of the event instead of typing it out like this.

Judging by what you have written, you have no way to track the progress the player has made through the quiz.
So of course it restarts every time you activate the NPC (which I assume you are doing, but you don't show that information so it's left up to interpretation.)
Events just run top to bottom through the commands, unless you use a variable to track "player completed question 1", it will never know that the player has completed the question and so it will repeat, repeat, repeat, repeat, repeat, repeat....

I'm also not sure what you are doing with "if variable 4 === variable4"
Or anything else you are illustrating with what you have written.
So if my advice doesn't help you, you will need to post a screenshot.
Do not crop the screenshot either when you post it,

I'm actually trying to make it so the player has to answer one question correctly, and one of the three questions are picked randomly. I added a conditional branch because I thought that's what you had to do to control the variables, and I need to make create the variables in order to randomize the questions. Since I'm playing this on my Nintendo Switch, I couldn't take a screenshot, and my browser won't let me attach any photos, so I can't help you there. Sorry.
Since I'm playing this on my Nintendo Switch
This website is only for supporting the PC version.
However, it's not like we haven't in the past assisted with the Switch version since the basic functions are more or less the same.

However, in those cases,

I couldn't take a screenshot,
The others were able to provide a screenshot.

Maybe other people will feel like reading and playing 20 questions to get the full picture of what you are doing and what you are setting up incorrectly, but I certainly don't. I hope someone else is willing to help you. I cannot until you are able to post a screenshot.

Good luck.
Ooooh. Oopsie. So this forum is actually for the PC RPG Makers, not the console ones.
Since I'm playing this on my Nintendo Switch, I couldn't take a screenshot
Just for future reference, the Switch can take screenshots (or at least the Lite can. I assume the big brother would be somewhat similar). You'd just need to transfer them to a PC or smartphone. I do it on occasion.
I tried to create a quiz mini-game with multiple choice answers, but I'm having trouble randomizing the questions. Here's what I got:

If: #0004 = #0004
Control Variables:#0004 = Random 1...3
Common Event:Lars riddle 1
Exit Event Processing
Control Variables:#0004 = Random 1...3
Common Event:Lars riddle 2
Exit Event Processing
Control Variables:#0004 = Random 1...3
Common Event:Lars riddle 3
Exit Event Processing
End

I put Exit Event Processing after each question so it wouldn't go to the next question automatically, but I can only get it to display the first question. I can't make it display the other questions. I tried putting #0004 Random 1...3, thinking that meant one in three chance of popping up. If anyone can explain what I have to do to get the result I want, I would be very grateful. Thanks!

If I understand your problem correctly, you are going about it basically entirely wrong.


Start at a common event in your database. You first need to assign random numbers to your variable, then make conditional branches for every possible outcome. Like this:

Control variable = random number

Wait 5 frames

If variable X = 1, call dialog common event 1, end event processing

If variable X = 2, call dialog common event 2, end event processing

Etc etc

This should most likely fix the issue.
I'm typing because I'm on my phone. Tomorrow I can maybe add pictures.
To @ValentinaSama67 suggestion, I would add that you don’t need 3 separate common events for your system. You can write the code directly in one common event:

```
Variable 4 = random 1...3
- If variable 4 = 1
"write the code for question 1 here"
- End
- If variable 4 = 2
"write the code for question 2 here"
- End
And so on.
```
If I understand your problem correctly, you are going about it basically entirely wrong.


Start at a common event in your database. You first need to assign random numbers to your variable, then make conditional branches for every possible outcome. Like this:

Control variable = random number

Wait 5 frames

If variable X = 1, call dialog common event 1, end event processing

If variable X = 2, call dialog common event 2, end event processing

Etc etc

This should most likely fix the issue.
I'm typing because I'm on my phone. Tomorrow I can maybe add pictures.
Holy crap! That actually worked! Thank you so much! You've been very helpful!
To @ValentinaSama67 suggestion, I would add that you don’t need 3 separate common events for your system. You can write the code directly in one common event:

```
Variable 4 = random 1...3
- If variable 4 = 1
"write the code for question 1 here"
- End
- If variable 4 = 2
"write the code for question 2 here"
- End
And so on.
```

That really only works if it's a simple, one or two messages at most type of dialog! Since in their original post, the creator used common events for the dialog in every condition, I did the same.

Holy crap! That actually worked! Thank you so much! You've been very helpful!
Glad to have helped. 👋

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-randomize-questions.172470/