Luck-based activities, I assume? I've never had to use randomness so far...
What practical use are random variables?
Game Mechanics DesignUnder the hood, it's used for a lot of stuff. For example dodge chance, crit chance, damage variance, item drops, random encounters, etc. Really, anything that has some type of potential variance is needing to generate random numbers under the hood. You can't make a game without using randomness.
But if you're talking about *you* specifically using event commands to generate a random number in a variable, there are some practical uses. The most obvious thing that springs to mind would be if you're making some type of loot bag type of item or something. You'd use a random variable to determine what loot pops out, and possibly another to determine the quantity.
There also could be skills/states that might need to use random numbers. For example, say I want to make some type of binding spell that has some percentage chance of the enemy breaking out each turn. I'd need to generate random numbers for that.
Another possibility is if you're implementing on-screen enemies, instead of random encounters. You might wanna use random variables to make them spawn in random locations, and in varying quantities, to keep the map from being the exact same every time the player enters.
You might also implement mini-games, like a dice rolling game or a card game, or a slot machine, or something at some point. You'll need random numbers for all of that.
These are all just examples that I pulled off the top of my head. There are certainly many more possibilities.
But if you're talking about *you* specifically using event commands to generate a random number in a variable, there are some practical uses. The most obvious thing that springs to mind would be if you're making some type of loot bag type of item or something. You'd use a random variable to determine what loot pops out, and possibly another to determine the quantity.
There also could be skills/states that might need to use random numbers. For example, say I want to make some type of binding spell that has some percentage chance of the enemy breaking out each turn. I'd need to generate random numbers for that.
Another possibility is if you're implementing on-screen enemies, instead of random encounters. You might wanna use random variables to make them spawn in random locations, and in varying quantities, to keep the map from being the exact same every time the player enters.
You might also implement mini-games, like a dice rolling game or a card game, or a slot machine, or something at some point. You'll need random numbers for all of that.
These are all just examples that I pulled off the top of my head. There are certainly many more possibilities.
An NPC says "A", then next time, they say "C", then "A", then "B", in pure randomness.
If you want to make your own random encounter system because you don't like the way the default one works (if you say 30 steps, you could get an encounter 2 steps after the last, or 60 steps after the last, with the default system).
Random loot, as mentioned above. Also random reward for completing a quest. Or a random task as a quest (does the old lady baking a pie need apples, flour or butter?)
If you want an NPC to move semi-randomly - for example, you want them to generally move up, but they could also take a step to the right or the left every so often while they're doing it.
A random effect from drinking an unknown liquid.
A portal that takes you to random destinations.
Heaps of uses.
Random loot, as mentioned above. Also random reward for completing a quest. Or a random task as a quest (does the old lady baking a pie need apples, flour or butter?)
If you want an NPC to move semi-randomly - for example, you want them to generally move up, but they could also take a step to the right or the left every so often while they're doing it.
A random effect from drinking an unknown liquid.
A portal that takes you to random destinations.
Heaps of uses.
I assume that's what type: random, under autonomous movement, uses... and while that makes sense, I'm not sure about characters that say things randomly, as then players might miss some text, or need to interact multiple times if they want to get it and didn't yet...
A lot of things in the engine itself use randomness. Many of them are around battle logic.
You probably wouldn't use random text for your main quest. It's more for NPCs when it really doesn't matter whether the player sees the text or not.
I use random variables for so many things, because I like having things go a little differently on a new playthrough. For my game RTP, I use them to determine spawn location, which playable characters appear and where they appear, which final boss spawns and where it spawns, whether or not certain effects trigger in battle, weather and time of day at the start of the game. For my new game, I'll also use them to determine which skill branches get unlocked at the start of the game for each of the characters, how certain story events will play out (you get different scenarios, depending on the random variable), to simulate semi-random movement on NPC's, have elements in mini-games behave differently each time, semi-randomised skill selection for enemy follow-up attacks, to create small variance in outcomes... there are so many things you can use random variables for, I don't see why you wouldn't use them.
my main use is gambling and gathering/random loot bags.
gambling has used RNG variables a couple different ways. theres the basic if RNG > X.
and a much bigger lottery 1 with 10 variables (5 for your lotto ticket and 5 for the lotto number)
gathering/loot bags is just series of "if RNG > 70 = 30% chance reward, else if RNG > 50 = 20% chance reward, ect..."
also played around using it with skills. ie, skill targets enemy but RNG chance to apply state to user as well.
gambling has used RNG variables a couple different ways. theres the basic if RNG > X.
and a much bigger lottery 1 with 10 variables (5 for your lotto ticket and 5 for the lotto number)
gathering/loot bags is just series of "if RNG > 70 = 30% chance reward, else if RNG > 50 = 20% chance reward, ect..."
also played around using it with skills. ie, skill targets enemy but RNG chance to apply state to user as well.
Im using an ABS system and i built up a bullet hell style boss battle which i premade 4-5 patterns then i just roll random and let it pick which attack pattern is next depending on the roll.
I recently got the idea of "item drops" mostly for consumables, like enemies dropping money or hearths in the handheld zelda games which i roll a random variable for a 25% chance of it popping, so far so good.
RNG rolls can be used for a lot if you're creative enough i guess 😅
I recently got the idea of "item drops" mostly for consumables, like enemies dropping money or hearths in the handheld zelda games which i roll a random variable for a 25% chance of it popping, so far so good.
RNG rolls can be used for a lot if you're creative enough i guess 😅
In the game I'm currently working on, I use it for a few in-battle skills. There's one, for example, that generates a random amount of gold whenever it's used. Another that inflicts a random status and so on. It's also good for managing rare event spawns.
I use random variables to control my own damage variation at different parts of the equation.
storywise, i use a random variable to choose amongst many options for an event that's going to happen, and a counting variable to track activations in a given "day" to get several possible interactions up to x, then a message that says there's no more of that today. (specifically, your character can take confessions in his church as an added 'thing', but stops at 7 per "day", or inn stay/specific reset calls)
e.g.: event asks if you want to do something. yes: var x = random #.
other event in room: page var x >= #: auto run this page, var x = 0.
storywise, i use a random variable to choose amongst many options for an event that's going to happen, and a counting variable to track activations in a given "day" to get several possible interactions up to x, then a message that says there's no more of that today. (specifically, your character can take confessions in his church as an added 'thing', but stops at 7 per "day", or inn stay/specific reset calls)
e.g.: event asks if you want to do something. yes: var x = random #.
other event in room: page var x >= #: auto run this page, var x = 0.
Just recently, I used a random variable in a fishing minigame. I wanted to randomize the time between the player casting the fishing rod and the bobber disappearing (which would then start a quick time event). If the interval was always the same, I think it would have been too easy/boring.
(And I used another random variable to select which fish the player catches upon success, and another one to decide whether or not a fish even spawns in a certain spot.)
(And I used another random variable to select which fish the player catches upon success, and another one to decide whether or not a fish even spawns in a certain spot.)
I use RNG to make equips with randomized perks via yanfly's upgrade slots and attatched augments, diablo style.
also for weather effects at the start of each day.
and for rare mob spawns in a laberynth.
and for randomized effects on elite mobs.
that's it.
also for weather effects at the start of each day.
and for rare mob spawns in a laberynth.
and for randomized effects on elite mobs.
that's it.
Power to the randomness!
My game is pretty much based on random variables.
Personally:
1. Random number added to a stat for "unlocking chests". This can sway what loot you get sometimes.
2. Random number added to a stat for "smashing chests". This can sway what loot you get sometimes.
3. Part of an "Inn" system in which the game rolls a dice and then determines what "Scene" you might get for your party members based upon things they've done, levels they are, previous conversations (the other half uses a lot of Conditionals).
Beyond that, there's a lot of uses for it if you use your imagination.
Though, honestly, I tend to use Variables far more than Switches just because I can do a LOT more with a variable than a switch. You could even use a Variable to determine the "path" a player can take through a maze on every subsequent visit to it... Or, you could use it to randomly determine WHERE the chests are in a dungeon... Or your "On Screen Encounters". Or you could use it to create a dungeon room by room just by changing where the doors teleport you to by rolling a random number on a Variable.
Not sure, but I think you can also use the variables to roll random numbers for healing or damage as well.
1. Random number added to a stat for "unlocking chests". This can sway what loot you get sometimes.
2. Random number added to a stat for "smashing chests". This can sway what loot you get sometimes.
3. Part of an "Inn" system in which the game rolls a dice and then determines what "Scene" you might get for your party members based upon things they've done, levels they are, previous conversations (the other half uses a lot of Conditionals).
Beyond that, there's a lot of uses for it if you use your imagination.
Though, honestly, I tend to use Variables far more than Switches just because I can do a LOT more with a variable than a switch. You could even use a Variable to determine the "path" a player can take through a maze on every subsequent visit to it... Or, you could use it to randomly determine WHERE the chests are in a dungeon... Or your "On Screen Encounters". Or you could use it to create a dungeon room by room just by changing where the doors teleport you to by rolling a random number on a Variable.
Not sure, but I think you can also use the variables to roll random numbers for healing or damage as well.
@Tai_MT just reminded me of another way i used random variable before.
RNG dungeon, roll a few different variables before transfer.
Var A determines which map gets loaded. (fadeout > transfer to map)
Var B determines entrance/exit/chest locations (autorun, teleport player > fade in > erase)
Var C determines enemies, traps and obstacles.
takes awhile to setup but can turn 20maps into a 100+ floor dungeon easily.
RNG dungeon, roll a few different variables before transfer.
Var A determines which map gets loaded. (fadeout > transfer to map)
Var B determines entrance/exit/chest locations (autorun, teleport player > fade in > erase)
Var C determines enemies, traps and obstacles.
takes awhile to setup but can turn 20maps into a 100+ floor dungeon easily.
Original thread: https://forums.rpgmakerweb.com/threads/what-practical-use-are-random-variables.142867/