Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Question about Random variables

I would like some clarification on how to use this function. I'm not sure why it lets you set two numbers when you select Random, so could someone explain it to me?

If you need some guidelines on how to explain, I'm trying to make it so an enemy on the map sets a random variable and then there are conditional branches that determine which troop to fight based on which random variable is set.
 
The two numbers are the 'range' of the random result: If you need a dice result, make it 1~6 etc.
If I understood you, you've got it all wrong.
You can't randomly set variable 001 OR variable 002.
You CAN change many variables at the same time, by selecting 'Batch'.
If you set them to 'random', they'll all have a random number within the range. However, they'll all have the same number.
 
MCsephiroth13":35bpfudh said:
OOOhh! The range. I see. Then how exactly do I do what I'm trying to do? Do I fist do Control Variables set random 1-3 and then Conditional branch if variable 1=1, or if variable 1=2 etc?

That sounds about right. To give an example, let's say you wanted to roll a die and do something different based on what number comes up. First, you would set variable 1 to a random number from 1 to 6. Then, you would make a series of conditional branches to check the result, with each conditional branch giving different output based on the number it checks. (So, you check to see if the variable == 1, and give output. Then, you check to see if it == 2, and give output for that, and on down the line)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top