Conditional branch for multiple random number?

Hi all, I can’t seem to figure out how to solve this and my Googling skills aren’t bringing up the answer either.

I’m trying to implement a branching dialogue based on a random number check (a dice roll check basically). 15+ gets one answer, 10-14 another, and 9 or less another. I’ve tried to set the conditional branches separately, but if I do this 15+ carries onto 10-14 after (see screen shot). If I nestle 10-14’ after 15+ it doesn’t pick up 9 or less.

Any ideas or pointers would be very much appreciated!
Nest the branches (so that only one outcome occurs) in the correct order, e.g.
Use the Control Variables command to set a variable equal to a random number, e.g. 1~100. Then check the value of that variable using Conditional Branch commands. E.g.
Spoiler: click to see event example
◆Control Variables:#0001 Check = Random 1..100 ◆If:Check ≤ 50 ◆Text:None, None, Window, Bottom : :Rolled \v[1], range [1, 50], 50% chance! ◆ :Else ◆If:Check ≤ 70 ◆Text:None, None, Window, Bottom : :Rolled \v[1], range [51, 70], 20% chance! ◆ :Else ◆Text:None, None, Window, Bottom : :Rolled \v[1], range [71, 100], 30% chance! ◆ :End ◆ :End
This example just uses Show Text to show the results, but obviously you can replace that with Change Items or whatever you like~
Perfect, thank you! I completely missed changing the order like that would solve it!


Thank you so much again!
You're welcome! Happy RPG Making~ 👋
Just to toss out another option, in case you want to avoid nesting:

1704549982052.png


If you don't need to put any commands after the conditionals, you could actually replace the "Jump to Label" commands with "Exit Event Processing".
Just to toss out another option, in case you want to avoid nesting, or in case it helps your brain when you order things from greatest to least:

View attachment 290870

If you don't need to put any commands after the conditionals, you could actually replace the "Jump to Label" commands with "Exit Event Processing".
While it’s now working, I’m happy to have as many other examples if it helps get into my brain for next time something similar comes up! I actually tried doing this, but I had the same issue with the jumped to labels running onto each other, so I’m guessing from yours and caethyrill’s reply that must also have been due to the order I put them in?! I did also think that adding ‘Erase event’ after each one may work, but had run out of will to test it, not sure if that’s the same as ‘Exit Event Processing’ as I’ve never used or come across any examples using that yet?
The general use case is that labels are for when you want something else to happen after the jump, and "Exit Event Processing" is for if you want the event to just end after the branch with nothing else occurring.

The only way Arthran's example would result in repetition would be if the event were parallel process.
Here is another option for a script call if you don't mind it (only tested at mdn site):

Code:
let num = Math.randomInt(21);
let text = num >= 15 ? '15+'
    : num >= 10 && num < 15 ? '10-14'
    : '9-';
$gameMessage.add(text);
this.setWaitMode('message');

Edit: if you need to use variable 60, then change "num":

Code:
let v = $gameVariables._data;
v[60] = Math.randomInt(21);
let text = v[60] >= 15 ? '15+'
    : v[60] >= 10 && v[60] < 15 ? '10-14'
    : '9-';
$gameMessage.add(text);
this.setWaitMode('message');
@Trihan Perfect, thanks for clarifying!

@bass2yang I'll likely stick to what's working for now, but I'm saving this thread so will give your suggestion a try out at some point, so thank you.

And thank you again all for taking the time to answer and help out 🙂
I did also think that adding ‘Erase event’ after each one may work, but had run out of will to test it, not sure if that’s the same as ‘Exit Event Processing’
Erase event removes the event from the map until the next time the map is loaded.

It doesn't permanently remove the event (you'd use another event page for that), and it doesn't stop the rest of the event from running.

So those two commands are not similar.

Original thread: https://forums.rpgmakerweb.com/threads/conditional-branch-for-multiple-random-number.164533/