So, you’re making your amazing game in RPG Maker and you decide it would be a cool idea to make the player input a password to open a door, or a box, or to make something cool happen. But you’ve searched through all the available functions in the engine and none of them seem to be designed for that. So what now? Fear not. As we have been learning throughout this tutorial series, there is a very cool workaround for that, and I’m going to teach you how to do it.

Disclaimer: I am using the MV version of RPG Maker, so although the logic is very similar in all versions, I’m not sure if this tutorial will work the same way for VX, VX Ace or XP. This tutorial is probably more useful to devs that are already familiar with how RPG Maker works, but if you still consider yourself a beginner regarding this engine, I’ll try to be as clear as I can so you don’t feel lost.

This is my test project, and what we are going to try to do here is to type a password on the computer and, if the password is correct, the door will be unlocked. Let’s begin!

1 The first thing you have to do is to go to Database → Actors and create a blank character, a character with no name or sprites, and that’s not going to appear in the gameplay. It’s going to make sense, later on, I promise.

2 Switch to the Event mode on your RPG Maker (if you haven’t already) and create a new event called “Password Input”. Start by setting it up like this:

3 The first command we are going to use is the Name Input Processing command, on the third page of the Event Commands window.

Once you select it, go under Actor and select that blank actor you created. Under Max characters, select the max number of characters your password must have. For example, if your password is “9734”, the max number of characters will be 4; if your password is “castle”, the max number of characters will be 6, and so forth. Then, press “OK” to close the window.

4 The next step is to go to the same Event Commands page of the previous command and select the Script command. Inside the text box, you need to type this script (the areas you need to modify are in bold):

if ($gameActors.actor(actor number).name() == "your password")
{
   $gameSwitches.setValue(switch number, true);
}

Actor number: If you’ve paid attention before, you saw that every character we create has a number in front of their names. In the case of our blank character, there’s only the number, and that’s the number we have to put there. My blank character’s number is “0002”, so the number I’ll be putting there is “2”.

Your password: Type here the password you want the player to use, text or numbers (although if you want to use just numbers, the Input Number command is a better and easier option). The password I’m choosing for my project is “Murray”.

Switch number: Just like the actors, switches have numbers attached to them. We need to create a switch to check if the door is locked or unlocked, and that’s what we will be doing in the next step. In my project, I don’t have any switches yet; the switch I’ll create here will be the first one (0001), so I’ll put the number “1” there.

This script is going to turn on a switch if the password is correct. The same switch that is going to unlock the door. My script is looking like this:

Now press “OK” to close it.

5 The next command will be the Conditional Branch command. Select it in the Event Commands window. Then select the Switch option and create a switch called “doorUnlocked”. On the bottom of the window, check the “Create Else Branch” box. It should be looking like this:

6 Now, we need to add some text to inform the player whether they succeeded or not. Inside the conditional branch, above the else statement, create a Show Text command. Inside the box, type “I hear the door unlocking” and click “OK”.

Right below this command, create a Control Self Switch command and press “OK” right away. You probably don’t need to make any changes to it.

Now create another Show Text command under the else statement, and type “Nothing happened” in the text box.

Then, right below it, you will want to add the Change Name command. Under Actor select our blank character and then under Name don’t type anything at all; leave it empty and click “OK”.

This command will erase the player’s previous attempt, in case they input the wrong password. If you don’t add this command, the previous attempt will continue on the screen, and the player won’t be able to try again.

The first page of your Password Input event should be looking like this:

7 Since we don’t want this event to repeat after the player used the right password, let’s click on New Event Page, so now the Password Input event has a second page, and we should set it up like this (don’t forget to check the Self Switch box and select the same self switch you chose in the previous page):

On this new page, we create another Show Text command and type “There’s nothing to do here anymore” in it and click “OK”. Now, we can press “Apply” and close the event window.

And don’t forget to place this event on the spot of the map that the character is going to interact with to type the password. In my case, the event is placed upon the computer sprite, since I want the player to type the password after interacting with the computer.

8 But since we’re doing all of this to open a door… we need a door event! Choose a spot on your map where you want the door to be located and click on it with the right mouse button. Select Quick Event Creation → Door, choose a sprite for your door and choose where you want to take the player once they go through it (since we only have one map here, the door will lead to another spot on the same map). When you click “OK”, a complete door event is going to be created for you.

9 However, the door needs to be locked if the player has not used the password yet. Open the door event, click on Copy Event Page and then click on Paste Event Page. You now have two pages in this event that look exactly the same. What you want to do on the first page is to select all the commands in it and delete them. Then create a Show Text command saying “The door is locked.”

Now go to the second page, and the only thing you need to do there is to check the Switch box and select the “doorUnlocked” switch.

Your door event pages should be looking like this:

10 Now let’s test it and see the final result:

And just like that, we’re done! I hope I could help you in any way, and if you have any questions, come talk to me on Twitter, I’d love to help you out! See you later!

Did you enjoy this article? Then consider buying me a coffee! Your support will help me cover site expenses and pay writers to create new blog content.

Categories: RPG Maker

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

By continuing to browse this Website, you consent to the use of cookies. More information

This Website uses:

By continuing to browse this Website without changing the cookies settings of your browser or by clicking "Accept" below, you consent to the use of cookies.

Close