Game Development Reference
In-Depth Information
Chapter 2
Switches and Variables
If you have any amount of programming experience, you're probably familiar with the use of switches and variables
(especially the latter) in coding programs.
Switches? Variables? Pizza?
Yes. Yes. With pepperoni, please. Seriously, though, let me explain. Switches and variables in RPG Maker VX Ace
(RMVXA) are similar to boxes in real life. They both hold information you would want to use later on. They are
ubiquitous in video games as well. Don't believe me? Here's a small list of things that, with the use of switches and
variables, you can influence in any video game:
The ability to keep track of the number of chests opened during the course of the game
(variables)
The ability to determine whether a boss has been defeated or not (switches)
Preventing the player from accessing a certain area without a key or some other device
(switches)
Changing a quest reward based on the method the player used to complete the quest. For
instance, you could give a 300 gold reward for killing a group of bandits, and give a reduced
reward if the player drives them off, sparing them, instead. (variables)
Counting the amount of enemies left on a certain screen (variables)
Counting the amount of steps your party has taken. (variables) This has several applications,
such as causing a nonstandard Game Over when the player exceeds a certain number of steps
or granting the player an achievement or skill. You could use a variable to increase or decrease
the power of a skill as well.
As you must have noticed, you cannot make a video game without switches and variables!
Switches and Variables Do the Same Thing, Then?
Mostly, but there are differences. For switches, think of a light switch that has an on and an off state. You can set
conditionals that only trigger when a certain switch is on or when said switch is off. Variables, on the other hand, can
hold a number—any number that you can think of. Want to have-327 contained within a variable you call Bob? Sure,
go right ahead! Basically, both switches and variables are used for storing relevant game information, but they are best
used in different types of situations.
 
Search WWH ::




Custom Search