RPG Palace
( Register )
Navigation
Home Creations RMVX RMXP RM2k/RM2k3 Music

Affiliates
Latest News
RMXP Outdoor Tileset!
10/21/2007
Finally, the next installment of Inquisitor's epic RPG Maker XP tileset series is out! This gargantuan tileset is sure to get mouths watering. Download it exclusively from RPG Palace!

RPG Palace:

 

An introduction to switches

Switches are a vital tool in creating RPGs. Recently the forum has been inundated with questions about treasure chests and repeating events - the solution to these is always the same: SWITCHES!

So, what is a switch? In programming you'd call a switch a boolean variable. That's a variable that can either be true or false, 1 or 0, and for RPG Maker, ON or OFF. We can set a switch to be on or off in the game via events which can then be used to trigger other events. This is the tool to allow players to progress.

A few examples of what can be done with switches:

  1. Completing quests - Go back to quest giver to receive a reward. We don't want to continually be rewarded every time we talk to this NPC, so turn on a switch to prevent the reward being given twice.
  2. Cutscenes - After the player has finished a segment of the game, we can reward him/her with a story segment. Flip a switch to start some automated events, flip another when it's done to stop to sequence.
  3. World Events - In Final Fantasy VII NPCs had something new to say once the meteor was called. You can do this with switches.

These are very quick and basic examples of what can be done with switches. Switches are absolutely instrumental to game creation. If you don't understand them, you will struggle to create your game. Fortunately they're very easy to use! In this tutorial we'll be creating the most common and basic use of switches: Treasure Chests!

Situation 1: Self Switches

First step is to create a new event with a graphic from Chest01. The trigger should be Action Key, so the hero must press enter to open it. The chest will contain a potion, which we will add to the player's inventory and inform the player what they've collected.

So far, so good, right? This is the stage most people get to. If you play test your game now, you'll see that the event repeats. We now have to add a switch so that once the chest has been opened, it becomes an empty chest. We'll use a Self Switch here. Self Switches are local variables: they're only stored for the event they're activated in. Unlike regular switches they cannot be accessed by other events. The advantage of self switches is they're quick and easy. So, add a self switch at the end of this event.

Your event will now have this at the very end.

We've got switch A active now. Next we'll need a new page which is triggered by the condition that Switch A is active. So, click the new event page button, tick the Self Switch box and choose switch A. Change the event graphic to an open chest. All we'll need to do is add a message on screen to tell the player the box is empty.

And that'll do it! You've got a working chest!

Situation 2: Switches

You might be able to think of a game where an NPC asks you to take an item from his/her treasure chest. Once you've opened the chest, we can make the NPC say something new.

At the moment we've not given him something new to say, so he will repeat this message every time you talk to him. We'll change the conversation once you've opened the chest.

With self switches we cannot affect the surrounding events. We have to use the global version, simply called switches. Firstly, let's edit the chest to use global variables instead of local variables. Delete the self switch command from Page 1. In it's place, create a new switch called Chest 01.

Now we'll change the conditions for page 2.

It's practically the same affair as the self switch except we can now check whether the switch is on or off from a separate event.

The NPC is practically the same as the chest but we don't need to activate the switch, do any of the animations or play any sound effects. We simply need two pages, one when the switch is off, one when it's on.

What you've just accomplished is the basis for creating quests!

 

Community MMORPG

Hot Picks
Mode07
XP Indoor Tileset
XP Outdoor Tileset
XP World Tileset


2004 - Copyright RPG Palace - Webdesign Made By: NunoLac from NL Design