Gw Temp


Tutorial - 'THE Door/Chest Tutorial' by Ragnar

An item about RPGMaker 2000 posted on


The ultimate tutorial on getting to know everything about switches (Newbies Favorite)


Yes, I, Ragnar, am back, so take cover and induce vomiting if you start foaming at the mouth from the complexity of this tutorial.

This tutorial was adapted from some posts I made in RPG Maker 2000 Support. The person who encountered the problem will remain nameless unless it turns out they don't care whether they are mentioned or not. This is actually a widely encountered problem, so I decided to make it into a tutorial and add some things while I was at it.

First off, here's what knowledge you will be imbued with upon reading this tutorial.
1. How to make doors that can be opened AND closed, with a method that uses only one event, one page and NO switches. Sweetness!
2. How to make a treasure chest without switches (However, there's one catch... but it's a lot less than one switch each.)

*With both of these, you will need to set the respective event to Fixed Direction. This is extremely vital!

The Door Tutorial=================================================================

This is for making a door that can be opened and closed. This is obviously best for indoor areas, but it might have a few outdoor applications. The definition of "door" is used loosely. The same rules would probably apply for gates, sliding doors like in Sci-fi type games, walls that reveal secret passages, stone slabs or other structures which lower into the ground, or even organic structures which give way (the innards of a huge monster?) Also, the door can open in different ways, like by a switch or stepping on a floor tile to trigger an automatic sliding door. Opening the door manually is only a suggestion.

First of all, make a door event. Set it's properties as Same Level, and Fixed Direction. Only make one page. That's all you'll need. Next, make two forks. One is if the event is facing down, and one if the event is facing left. (This is assuming the door follows the RTP animation pattern, if not, set the direction to that of the first and last frame. In any case, the door must turn to show the opening animation, rather than swapping character sets or something.) Next, under the "Down" case, rotate the door to show the opening animation.
Also, put a Start Slip Through at some point. At the end is recommended, but it might look better at some other frame, since most people don't wait for a door to completely open before walking through it.In any case, do this at some point or you won't be able to walk through the doorway. For the "Left" case, run the animation in reverse, of course, and this time, place an End Slip through at the beginning, unless, almost like the opposite of when opening, you want characters to close the door behind them, like plenty of people naturally do as well. But it would only work this way if the door closing was automatic, or in a scene. For the automatic case, you'll need an 2 extra, Below Hero, Walk On events, and have the door close when either is stepped on, and even then it's probably iffy, so I wouldn't recommend it.
Also, I would recommend a Move All (Wait for events to move) command after the animation, because you might be able to set off the event over and over and cause mayhem and glitchy looking animation. But if you do this, you won't be able to walk through the door early. Another tactic is to wait until the first frame is done, and then return control to the player. The reason the door animation would get glitchy is because the animation might not immediately go to the next frame, and then the condition would still be valid. You would then be able to keep locked on that one frame if the button was pressed fast enough.
This method of using doors is only temporary, however. Like a Clear Timer event, it will only stay the same when you are on that map. Sometimes, you may want to use a switch so that the door will stay open or closed even if you leave, but the door should still open and close in the same way, just on separate pages, and the "Facing" cases can be gotten rid of. Even if you have a key for the door, you still don't necessarily need an "Unlocked' switch. If you keep the key in your inventory, you can simply have the door open automatically, given you have the key. Just don't have much of a message if any, since it would get tedious.
Lastly, you can reduce switches by using variables like in the next section.

The Treasure Chest Tutorial=========================================================

There is a way to not use switches for treasure chests. However, you will use variables in a 1/19 ratio. (One variable for every 19 switches. The key is... binary code. (Arrgh!) Don't freak out just yet, I'll make it as simple as possible.
When you open a chest, you will add a number to a variable. it will go 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144. You can add them manually, or multiply within RPG Maker itself to figure it out for you, but since the numbers are right here, why would you do that?
These numbers represent the values of the binary digits. For example, 101 is 5 and 11101 is 29. See how each is either one or zero? It's a binary number system, meaning there are only two cases, like a switch. See where I'm going with this?
Ok, so have the chest open as it normally would, add to the variable, get the treasure. Then when you leave the map, have a parallel process event which destroys itself with Clear Timer do this, since the Event references won't be on the map you teleport from. Have it move the value to a another, temporary variable (if the variable is 1, set variable 2 as 1 or whatever) mod the temporary variable by the next highest number in the series (if the number is currently 262144, there is no need to mod, likewise, if the number is 1, there is no need to divide, just mod) and divide by the actual number that you added before. This will return either a 1 or a 0. If it is 1, turn the treasure chest event to the direction that is "open". Don't bother showing the inbetween frames, since it won't be seen anyway. If it's 0, leave it alone. Do this for all of the chests, but set the temporary variable as the original again, since only dividing by 1 would ever return a 1, and that might even be what it is supposed to be.
The only problem with this is, you may see the chests move to their "open" position in the split second between the fade/etc. and the time when the player is allowed to move. There are two ways to hide this.
One is to simply place the exits at least a screen away from all of the treasure chests. The other is to use "Erase Screen" and "Show Screen" so that you can do things before the screen shows again. If you make an instant teleport with "Move Event" in the context menu on the map, you can steal the code easily from that. You'll want to copy the last "Show Screen" event to the end of the parallel process, however. Anyway, let the event run, and place a "Move All" right before the Show Screen command, so that the move commands run through before the screen is shown. That's it!
In case you're wondering, you can add one extra case by not only doing binary numbers in decimal form, but also checking if that number is positive or negative. *-1 makes it negative. Another *-1 if it is below 0 makes it positive, so that you can check the other numbers normally. But really, it's more trouble than it's worth, so that ends our tutorial.

Also, if you receive an item and know you won't lose it (usually a key item), you might as well check to see if you have the item. It will work as well as any other method.

I hope this tutorial helps some people, and if I find another impossible RPG Making conundrum, I will be sure to address it.

This has been a Ragnar presentation. All events and characters depicted within are purely coincidental, or something. :/