How do I make a key-locked Door?
Elementary my dear Watson! its just a simple matter of learning how to link text boxes and use tags.
So. we have locked door that blocks your way into... lets say... the restroom!
In order to open this door, you must find an item, the "RestRoom" key.
First things first, you are going to need two tags. Load your RPG in CUSTOM.EXE and go into Edit Tag Names.
Name a tag "Have Restroom Key" and name another "Restroom is Open"
Now lets create the key item. Go into Edit Items, and make a new item. You cant fit the name "Restroom key" into the 8-characters allowed, so you will have to name it creatively (you can draw a key icon in the font editor). Set the item's own item tag to "have restroom key"
Now let's make some text boxes. go into Edit Text Boxes, and add a new text box that says: "The door is locked! You need the restroom key!". Make a box that says "CLICK! the door is open" and make a box that says "Here ya go mister. This is the key to the restroom out back."
Edit the conditionals for the text box labeled "The door is locked! You need the restroom key!". Change the first conditional to:
If tag # = ON (have restroom key) jump to text box # instead
where # is the number of the text box that says: "CLICK! the door is open".
Edit the conditionals for the text box labeled "CLICK! the door is open". Change the tag-setting conditional (the second conditional) to:
If tag 1 = OFF (always) Tag # = ON (restroom is open)
Edit the conditionals for the text box labeled "Here ya go mister. This is the key to the restroom out back.". Change the add/remove item conditional (the sixth one) to:
Always do the following add one Restroom key
Okay. now it is NPC time. Draw a set of walkabout pictures that looks like a door. Draw another set that looks like a gas-station attendant.
On your Gas-Station-Parking-Lot map, create an NPC that used the Door picture. Set it to appear only when the "Restroom is Open" tag is OFF. make it display the text box that says: "The door is locked! You need the restroom key!"
On your Inside-the-Gas-Station map create an NPC that uses the Gas Station Attendant picture. Make him show the text box "Here ya go mister. This is the key to the restroom out back."
Play your game and try it out!
If you go to the door and use it, it will tell you you need the key. Talking to the attendant will add the key to your inventory. as long as the key is in your inventory, the "have restroom key" tag will be turned ON. this means that when you use the door again, it will display the "opened" text box instead of the "locked" text box. When the "Opened" text box is displayed, it will turn on the "restroom is open" tag. Remember how the Door NPC can only exist when that tag is OFF? pif! it disapears, and lets you into the restroom. Hooray!
Now you can adapt this example to any kind of door you want.
Here are some things to try:
- Make it so the gas station attendant only gives you a key if you dont already have one.
- Put the key in a shop, as if the attendant demands money for the key rather than just giving it to you
- Make a "Gas Station Attendant" enemy that you have to fight to earn the key
- If you give up displaying the "Locked" and "Opened" text boxes, an use the tag-checking in the door-linker, you can do a locked door with only one tag instead of two. Can you figure out how?