Poop

The Switch
"The Switch"


The Change Switch command, found on the first tab in the event commands, is essential to rpgmaking. What it does, you ask? The Change Switch command has two return values, meaning that RM2K will recognize two forms of the switch - ON or OFF.

Why would you need that? Here is an example of what a switch can do.

"Your hero, the local village boy who has set out on his quest to save the princess, must first talk to the king. After he talks to the king, the gaurds outside the town will let your hero pass. If you didn't talk to the king, your hero won't be able to pass."

Your king needs to tell the hero the message. Without the message, you can't get past the gaurds. Therefore, the king must turn a switch on which the gaurd events would recognize then let the hero pass.

The following would be your king event's action.

:THIS IS SAMPLE CODE: <>Mssg: "King: Thank you, hero! You now have access to the east! Here is my pass!" <>Mssg: "Recieved Pass!" <>Change Switch:[001:KingPass]-ON set

Alright, now that we've tackled the king, how would we make the gaurds recognize the switch? We know that you already have the gaurds saying that you can't pass yet. But with the KingsPass switch on, they should let you continue.

Now, on your gaurd event, create a new page. Don't know how? double click on your gaurd. In your event editor, you will see a tab at the top labeled "New Page". click on it and you'll notice that you can now toggle between your pages. Go to your new blank page. You'll notice on the left hand side, a section called Conditions. Check one of the "Switch" boxes. select your switch, [001:KingPass] from the list.

What did this just do? This new page will only execute if that condition is met, meaning that it will only execute if the KingPass switch is ON. Getting the hang of it?

Your new page should look like this:

:THIS IS SAMPLE CODE: Conditions - Switch [001:KingPass] <>Mssg:"Everything seems to be in order. You may pass" <>Teleport Map 02

:APPLYING KNOWLEDGE: Now your hero is ready to venture, eh? Maybe.. Try a few of these to see if you have the grip of it yet:
1 - See if you can make another gaurd react the same way (copying the event is cheating!). 2 - See if you can make the king reply differently after you recieved the pass 3 - See if you can make the gaurds require another item before you can pass, which you have to get from another NPC.

HELL FUSION