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

I always told my DA fans how much I hate slot machines. They're fine in games as a risk-and-reward system. But when you're spending REAL MONEY in a Vegas casino to try and hit the jackpot (which very, very few people will), it can really hurt your budget. Gambling is a bad habit, and I don't like wasting my money on a slim chance. Go to Vegas for the experience, not the jackpot.
Took the kids to a corn maze. They gave us a map and had lights at certain points in the maze. Not overwhelming... or underwhelming... just... whelming.
Okay, vacuuming fruit flies out of the air is surprisingly effective.
Finally finished my menu redesign after like a month of coding! I hate designing menus... Good news though - I thought of a complete redesign for it now, so yay...
Still no scam calls all day... also I got a quick gig designing a mascot drawing for a small business, so I might actually make some green of my own after all. That would be a perfect job for me, since I love art and digital design.

Forum statistics

Threads
104,391
Messages
1,006,038
Members
135,920
Latest member
chelsandherself
Top