Need help for a "bar event"

Hello!


I've recently setup a bar event for my game ( i've found the way to do it around the net, maybe even here, can't remember)


I've attached an img with the screen of it ( the event have 10 choice, but i've cut the image, just to show the "core" of it).


The "annoying" thing, is that sometimes it is a little too much random, and it make the same order 3-4 times in a row...


Is there a way to avoid it?


Or maybe, a different way to do it?


Senza titolo-1.png
if nothing interferes, the number choosen should be as random as possible in a computer. It might have the order several times in a row, but that should not happen constantly - if it does, then either the variable is used in a different context (overwriting the real random number) or the logic has gone wrong somewhere.


I suggest you completely get rid of all else branches - as long as every conditional test is for equality (==) and all possible numbers are checked, there is no need for the else branches. And without else branches, the event is much easier to read and won't be indented either - and if the indention is wrong somewhere, that can cause mistakes in the random results.
Well, since it's random, sometimes it can happen, not always
If you want to completely remove the possibilty of duplicate orders, you could do something like this:


Control Variables: Set var#5 (or any other that is still unused) to the value of var#4


Label: Start


Control Variables: Set var#4 to a random number between 1 and 10


Conditional Branch: If var#5 == var#4 (that means you got the same random number as before):


   Go to label: Start


Branch End


Now continue with your conditional branches for var#4.


This way, you will keep assigning random numbers until you get one that is different from the one you had before.
If you want to completely remove the possibilty of duplicate orders, you could do something like this:


Control Variables: Set var#5 (or any other that is still unused) to the value of var#4


Label: Start


Control Variables: Set var#4 to a random number between 1 and 10


Conditional Branch: If var#5 == var#4 (that means you got the same random number as before):


   Go to label: Start


Branch End


Now continue with your conditional branches for var#4.


This way, you will keep assigning random numbers until you get one that is different from the one you had before.

I'll try that, thanks!

Original thread: https://forums.rpgmakerweb.com/threads/need-help-for-a-bar-event.68937/