Control Variable to Specific Random Numbers

mylafter

I’m a creep... I’m a weirdo...
Veteran
Joined
Dec 30, 2012
Messages
195
Reaction score
174
First Language
English
Primarily Uses
N/A
Randomizing a variables' value can only be set from, for example '1-9'.
Is there a way to control a variable to equal to a random specific set of values like; '1, 2, 5, or 7'
 

A-Moonless-Night

WINTER IS COMING
Veteran
Joined
Mar 17, 2012
Messages
675
Reaction score
437
First Language
English
Primarily Uses
RMVXA
You can do $game_variables[X] = [1, 2, 5, 7].sample, where X is the ID of the variable. Alternatively, in the 'Control Variables' section, set it to script and use [1, 2, 5, 7].sample
 

mylafter

I’m a creep... I’m a weirdo...
Veteran
Joined
Dec 30, 2012
Messages
195
Reaction score
174
First Language
English
Primarily Uses
N/A
You can do $game_variables[X] = [1, 2, 5, 7].sample, where X is the ID of the variable. Alternatively, in the 'Control Variables' section, set it to script and use [1, 2, 5, 7].sample
Thank you! The second option is definitely more convenient to use.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Welp, ended up at the hospital with the oldest so mebbe might make the game jam's deadline. Maybe not. Regardless, really digging MZ.
I had lots of fun! Kids loved me, and some took pictures. Unfortunately, the videos didn't send... but you'll see Chica in action when I do a trailer for Fandom Scouts!
Dama wrote on akoniti's profile.
Hi
Thanks for your review.
I was checking the trailer for details and as the woman shut the door at the exact moment the song I was hearing said "you slim the door" and I couldn't resist to add it there. :D And I used this idea one more time on another scene.
Just doing some tileset tinkering again...

Forum statistics

Threads
104,690
Messages
1,008,150
Members
136,184
Latest member
Nitrostat
Top