Gw Temp
Menu
Tutorial - 'Switches and Variables' by SirUltimos
An item about RPGMaker 2000 posted on
Blurb
SirUltimos comes with a nice newbie-friendly tutorial that demonstrates the basics of using switches and variables.
Body
Switches and Variables by SirUltimos
Ahh, the age old question of RM2K/RM2K3, 'How do you use a switch?'. Well, if you want to learn, you've certainly come to the right place. Sit down, and by the time this is over you will have (hopefully) learned how to use switches, and their elusive cousin, the variable!
Please note that this tutorial is intended for the beginner RPGMaker user, and that the material covered in this tutorial should already be known by veteran users.
Imagaine a switch in the RM2K(3) terms as the same thing as a light switch. The RM switch functions the same way as the light switch, which is, it can be either on or off. With a lightswitch, when the switch is on it turns on a light, but in RPGMaker, a switch turned on can produce a wide variety of effects!
To manipulate a switch, the first thing you need to do is, in the event editor, select 'Change Switch' ('Switch Operations' in 2K3). It is located 6 buttons from the top on the first page of event commands. Once this is selected, you will see a radio box selected at 'Single Switch'. Leave it there for the duration of this lesson. If you look to the right a bit you will see a '...' and if you click this you get a list of all switches. What this window is good for is selecting a switch number and naming it so that it's easier to manage later on. It is also what you use to select which switch you will change. At the bottom of our switch window is a series of three radio buttons and beside them there are the words "Turn On", "Turn Off", "On/Off Toggle".
The first one will turn a switch on (the same switch you selected above), the second will turn the switch off, and the third will turn the switch to the opposite of what it is currently set at (Turns off if it is on, turns on if it is off.) Now you know how to turn a switch on or off, but that doesn't do much good if you don't know what to do your switch, does it? What good is a light switch if there is no bulb?
If you have the maker open, create a new event of a person and make it so that when you talk to this person it manipulates a switch. Switches start in the off position by default, so select a switch, any switch, and turn it on. Be sure to name it so you remember which one you chose.
To learn how to use the switch that you just manipulated, let's create a new event. Make this event another person, and make this person say something with the 'Show Message' command. Now, using the buttons at the top of the event editor, create a new page. On this new page, look to the left side and you will see a list of checkboxes. Check the first one that has the word 'switch' beside it and then using the '...' button select the same switch you turned on before. What this does is make it so that the commands on this page will only activate if the switch is on, otherwise it will activate the commands on page 1. Try experimenting with more switches until you get the hang of it, turning them both on and off. Soon you will find that switches are one of the easiest things about RPGMaker!
Now that you know how to use switches, you can make a game! However, to make a better game, you need to use little things called variables. If you're familiar with a programming language, you shouldn't even need to read this section.
Think of variables like a switch,but instead of just the on and off position, it can have thousands of positions from below -5000 to over +5000!. Variables are very powerful tools indeed.
To begin with, create another person event with the command 'Change Variable' ('Variable Operations' in 2K3). In the window that comes up you will notice the same radio buttons as with switches. Once again, hit the '...' button to bring up a new window, but this time, instead of a list of switches, you will have a list of variables. Select a variable and name it. Below you will see a list of operations. The operations are the same as in math, add, subtarct, divide, multiply, you're familiar with all of these. For this example, though, we will choose 'Set'. Below this, choose 'Number' and set it to 5.
Now once again, create a person event and make it two pages. This time, on the second page, instead of choosing the 'Switch' checkbox, choose the 'Variable' checkbox. choose the variable that you manipulated, and then on the drop down list choose 'equal to' and in the box beside this set it to 5. What this does is that it will activate the commands on the second page only if the variable you chose is set to 5. The other options on the drop-down list are pretty self-explanatory. 'Greater than', for example, would only activate the commands if the variable was greater than 5 (the number you set in the box next to it)
Try other ways of manipulating variables, such as multiplication and division. Try using both switches and variables together, so that a switch has to be on and a variable has to be set to a certain number! Experiment with different ways of manipulating variables and different options on the drop down menu and soon you will understand the basics of variables. Eventually you'll be using switches and variables like a pro!
Well, that brings us to the end of this tutorial and I hope that you have found value in this tutorial. Hopefully you have learned somehting and if you have questions, comments, concerns, or anything else, please do not hesitate to email me at sirultimos@gmail.com
Good night Seattle, I love you!
!!!BONUS!!!
Since you took the time to read through this whole tutorial and have hopefully learned something from it, I present you with a small bonus tutorial on how to make a pushable rock! Once again, this is meant for the beginners of the RPGMaker community.
First we need an event. Place this event wherever you want on your map, but be sure to set the graphic to a rock (or whatever other object you want your player to be able to push). Make the start condition 'Push Key'.
The first thing you should do is make the event play a sound, preferably one that sounds like a rock moving (for obvious reasons)
The second (and last) command you need to input will be to make this event move away from hero. What this does is make it so that when the player activates the event the rock will move in the opposite direction of the player, and also making it appear as if the hero had just pushed the rock!
Here's the event code:
<>Play Sound: Your Sound Here
<>Move Event: This Event, Move Away from Hero
Enjoy your fully working pushable rock!