Variables In Smile Game Builder – Part 3: Randomization
Random NumberEvery game must have an element of randomness to it, not only to add an element of surprise to the game, but also to increase its re-playability.
In Smile Game Builder, assigning a random number to a variable is as easy as setting its minimum and maximum values. So, setting the range between 5 and 100 will do just that and generate a random number between those values.
In fact, you can have negative values in Min., thereby greatly increasing the range and impacting randomness and any operators applied to it.
The maximum ranges are actually between -9,999,999 and 9,999,999, so this gives a pretty good range to work with.
Random Contents in ChestsAlthough there are many uses for random numbers, one notable use is randomizing contents in chests (referencing one of my Tips & Tricks video tutorials, #28, on chests).
You can either use a single sheet with corresponding Variable Box Check branches or multiple sheets with the Event Sheet Conditions set to its variable values. The former is more useful for smaller ranges and the latter is better for a much broader range (as I’ve done in Random Conversation below).
Another use could be for NPCs giving you random items, perhaps as rewards for completing quests. In fact, this same setup can be used as a template for any other event with randomized content.
Random ConversationIn most RPGs, people usually say the same things each time you speak to them. The only time conversations change is usually when certain conditions become true, such as during quest lines.
To add some realism to your game, add randomized conversation snippets. However, to increase the range you can set your "between" values on separate sheets.
Sheet 1 is the "randomizer", triggered once only, with the random number range set in the Advanced Variable Box.
On subsequent sheets, you’d add the conditional minimum and maximum variable ranges with the conversation snippet in its Event Details. The triggers for each of them is When Main Hero Talks; it’ll automatically select the appropriate sheet accordingly.
When you talk to the NPC, they’ll say something more random, based on the randomized number range from Sheet 1.
Random Events or Encounters
For additional dynamic contents, adding random events or encounters will provide an element of surprise, as I did in Tutorial #26.
Doors of Possibility
The random element in games opens the doors of possibility wide open.
"The doors to possibilities are limited only by your imagination and creative flair."
In addition to random treasure, conversation, and encounters, randomness can be used for so many different things; the possibilities are only limited by your imagination and creative flair.
Anything from reading a random passage in a book to displaying a random image to randomizing monster encounters via events can add that uniqueness and unexpectedness to your games. You can also combine random elements, such as using the Environmental Effects Conversation Choices from Tutorial #19 to randomize things that NPCs say about the weather.
I’ll follow this article up with a video tutorial some time later.