Free Web Hosting : Free Hosting : Credit Report : Low APR Credit Card  

Menu


Read up on the site's recent developments Rock on! Download the featured RM2K games as well as various other tidbits... Extremely cool sites... trust me, you'll love 'em... Meet the Arc Horizon crew Current RM2K project status RM2K Tutorials
Original shoujin art Mermaids, dragons, and werecats, oh my! Nurses with attitude! Artwork submitted by spiffy visitors like you! Don't forget to take the Gijinka Poll!
Chibot Ultra Battle As if you didn't already know... Pretty please? I'll be your best friend...
Drop us a line

When linking to our site, please use this graphic. It may be resized as needed.


This site made with notepad! Spiffy, huh?


Switch Tutorial

by Fale Kunai





Switches

Switches are an integral part of any good RM2K game. They're one of several conditions that can change the way an event operates. However, many of those that are new to RM2K fail to understand exactly how this powerful command is used. If you're one of those people, you're in the right place. -.^v

To put it simply, a switch is a marker, of sorts, that can cause a series of events to operate differently. Just turning a switch on or off won't accomplish anything. You must USE the switch somehow. A common and appropriate example would be making an NPC (non-player character. townspeople and such) say something different after you've spoken to them once. So we'll first walk through how to achieve this effect.

First, you'll need to create the event. Set the map to Event Editing mode (the ninth icon from the left on the toolbar). Next, double-click the square on the map where you want the event to be. Since we'll be making a townsperson, be sure you're placing the event on a walkable tile (such as the grass tile). A window should pop up that looks like this:

This is the Event Editor. The large white space on the right will contain your event code while all the controls are on the left. It may look a bit daunting, but we won't be using most of these controls in this tutorial. Anyway, the first step would be to select a graphic for the event so that the player can see it. Look at the Graphics section on the left side. There's a small window without an image in it (if it has something in it, don't worry about it--we'll change that). There's also a button labeled "Set" beside the window. Press it to open a window much like this one:

This is the image selection window. You can choose from any tile in your upper tileset layer or from any character set. For the purpose of this tutorial, pick a character sprite from the list and press "OK". Now that you'll be able to actually see the event, it's time to code it. In the large white space on the right, double-click the "<>" symbol (it denotes a space in the coding). You'll get yet another window like this one:

Oh, yes... quite a few options there, eh? Don't worry, it's all quite simple. The first step here would be to create the text that is displayed when you try to talk to the NPC. So click the "Message" button to open a small text window. Type in whatever you like and press "OK". On a quick side note, if you want a face picture displayed inside the message box, use the "Face Graphics" option before the "Message" option. If you wish to do it now, just double-click the message code you just put in the event window and use the "Face Graphics" option. When you're done, it'll appear one line above your text. You must always set the face graphics before you set the text if you want to display or change them. Anyway, now you have your text. Next, you'll want to turn on a switch that we'll use to make the event behave differently. So double-click the "<>" icon again and choose "Change Switch". You'll get this window:

By default, the first radio button is selected. That's the one you want. If you click on the "..." button beside the white text area (where the switch's name shows), you can select a different switch to operate and/or rename them. I suggest you rename this switch as I have in the picture above. Now in the small "Operation" section, be sure it's set to ON. By default switches are OFF. The toggle function shown there simply reverses the switch's current setting. So if it's already ON, it'll turn OFF and vice-versa. Anyway, just make sure it's set to turn the switch ON and press "OK". Now you've completed the first "page" of the event. Now we make a second page in the same event that has slightly altered contents. Near the top of the event editor, press the "New Page" button. A new tab will appear denoting the new event page you've just created. The event code window is now empty, but if you use the tabs to go back to the first page, the rest of the data is still there. But back to page two, in the event code window, create some text as you did before only this time make it something different. Now in the upper left-hand portion of the event editor, you'll see two fields labeled "Switch" in the Event Conditions section. For this tutorial, you'll only need to use the top one. Click the check box and use the "..." button to select the switch you created earlier. And that's it. What we've done is set it so that the events on the second page won't occur unless the switch you specified is ON. Now that you've made the event, let's test it out. Press "OK" to save and place the event on the map. Start a test play (if you need to, right-click a map tile and choose "Start Party Position" from the menu to make your character start near the NPC). Now when you walk up to the NPC and press Enter, it speaks.

And if you speak to it again...

...it says what you typed on the second page! Easy, yes? Now every time after that, the NPC will say the same thing because the switch is still on. If you wanted the NPC to alternate between the two messages each time you spoke to it, you'd just need to make one little change to the event code. On the second page, at the end of the event code, put a new command using the "Change Switch" option. Choose the same switch as before, only this time make it so it turns the switch OFF. Now when you speak to the NPC a third time, it reverts to the first message again.

See? It's not so hard. One very important thing to remember is that when an event has multiple pages, the event will always execute the last page of the event as long as the conditions are met. For example, let's say that page one and page seven are activated by two different switches. If both of those switches are ON then only page seven will be executed. Get it?

Now for a quick explanation of a more common use for switches. Let's say your character has just completed a quest and retrieved a valuable item for the king. If you want the king to say something different once the hero has completed the quest (and you will, I assure you...), then just make a second page in the event that is the king. Have it activate when a certain switch is ON. But what activates that switch? It's simple. When the hero gets the item he's been questing for, have an event turn that switch ON. Also, in the event you use to turn on that switch, make a new page and leave it blank. Then set that page to activate when the aforementioned switch is ON. This prevents the event from repeating as well as activating the new event page for the king. And to get a little more in-depth, you won't want the king to congratulate the hero with a million gold pieces over and over, will you? To prevent this, just make the king's post-quest event page turn on yet another switch that will activate a third page in his event. Then just put some stock message in the third page.

And finally, switches are used a LOT for treasure chests. It's very simple. Set the event graphic to a chest of some sort. On the first event page, have it play a sound (and possibly animate the chest), show a message stating what treasure you found, add the item to the player's inventory, then set a switch. Then set a second page to activate on that switch. Change the event's graphic for that page to an open treasure chest (if at all possible), and in the event code window, simply place a message that says something like, "This chest is empty."

Well, that about does it for the switch tutorial. By this point, you should be well on your way to easy switches. This handy command has an absolutely HUGE number of uses. If you're curious, I recommend you download the RM2K games made by others and have a look at the events therein. But don't just copy off of others--experiment and learn for yourself as well. If you have any questions or if there's something you need clarified, just email me at archorizon@hotmail.com.



This document may not be copied except for personal use. Do not direct link to this document.