Gw Temp


Tutorial - 'Light Switch System' by ATARI

An item about RPGMaker 2000 posted on


Creating A Light Switch System that allows you to turn off and on lights, as well as guards!


Hi folks! It’s ATARI again! This time I’m going to talk about how to create a light switch system in your RPG!

Things that you will need to know to use this tutorial:
1. Switches
2. Pictures
3. Fork Conditions
4. Variables

So what exactly do I mean when I say a “Light Switch” system? Well, it’s pretty simple really. The easiest example to give is to think of the game “Thief.” In “Thief,” you go up to candles, and snuff them out, and similar to torches. Then sometimes, a guard might find it, and re-light it. This tutorial will explain how to turn off lights, and then to have patrolling guards come and turn them back on.

Part I: Turning Off Lights

First things are first. Create a new map. Make the map the smallest size possible, and cover the entire map in grass tile. Make a new autostart even on this map. First, have it change the tint of the map. Set everything down to 50. Make the change time 0.1 seconds, and uncheck the wait box. Next, put in a new switch called “Lights Off.” Make it turn on a new page in the autostart event. In there, have it set to push key, and do nothing. Now if you were to place your hero’s starting position on this map and to play, it should be decently dark.

Next, put in a character set, or something off the tileset that you used that resembles a lamp. Make sure that it only covers one tile. It doesn’t have to be fancy. Remember that we are only going for a working system right now. Next, create a new picture. Have its dimensions be the same as the lamps. Make the picture look like the illumination from some light. If you search through google or various rm2k resources sites, you should be able to find a character set like that.

Next, go back to your map, and find the tile x and y coordinate that goes along with it. If you don’t know where to look for EASY INSTA-X-AND-Y-FIND, look at the picture below.

Now, go back to your autostart event. In between their switch event and the screen tint event, add a new change variable event. In here, make a new variable called “LampX” and set it’s value to the number that represents the x coordinate of the lamp’s position. Then below that, create another variable event and call it “LampY” and set its value to that of the lamp’s y coordinate. Below that then, create a new switch called "LampOn.” Hit the, apply button, and then the OK button.

Now create a new event. Have this event be a parallel process. Create a new fork condition in here that says, “IF switch ‘LampOn’ is on, then,” have it display the new picture that you have just created by using the appropriate x and y variables in the right spots where they belong. Do not have it scroll with map, and have its color attributes be about 110 for everything. In the else case, have it erase the picture. In the end case of the fork condition, have it wait for 0.1 seconds.

Now, make a new push key event in front of the lamp. In here, have it turn on the switch ‘LightOn.’ Then put in a wait 0.1 seconds event. (That is right. Make it turn on.) Next create a new page to event. Have its starting condition switch be “LightOn.” In here, make it turn off the switch “LightOn,” and then be followed by an exact copy of the wait event as used before.

Now you can turn the light on and off.

Part II: Light AI

The next part, is to create a system so that a patrolling guard can see that the light is off, and when he does, he goes to the light, and turn it back on. He will ignore it if the light is off. First, look at the picture below to look at an example of the system.

So the first thing you need to do is create a viable path for the guard to walk so that he goes by the light and can see whether or not the light is on or off. Once you have a short path mapped out in your mind, place a guard right where you would want the path to start. Make the guard event face the way that his path goes. Make sure that his position is “over hero.” This is so that if your character moves in the way, the path won’t be messed up. In actual gameplay, this sets up for a stealth system, so this would be one of the ways you could utilize this system into a game.

Now, make the guard’s path, by selecting his movement type, and choose to create your own path. Make a path that corresponds to that path that you choose for your guard to walk.

The next thing that you need to do is to create a new battle animation. In here, create a new battle animation that creates an exclamation point above the guard’s head. This part isn’t necessary to the system, but makes it work better. What it is used for when you finish creating the animation, is for when the guard notices that the light is off, and can express surprise. A good example of how to utilize this system, is to play any of the Metal Gear Solid games. It is most noticeable on the PS1 Metal Gear Solid.

Now the next part is different, depending if your path is vertical, or if it’s horizontal, but it’s basically the same. If it’s vertical, go up a tile above where the event is that turns off/on the lamp. Write down it’s x and y coordinate, and do the same for one tile below. For a horizontal path, go one to the left, write down the x and y, and do the same for one tile to the right.

Create a new parallel process event. In here, put in a new change variable event. Make a new variable called “GuardX,” and have its value set to the X coordinate of the guard. (This must be chosen through and option in the variable event, not from a number of where the guard starts.) Hit the okay button, and then do a similar variable event, except with “GuardY” and have it be set to the guard’s y coordinate.

Below that, create a fork condition that says, “IF variable ‘GuardX’ is equal to ‘x’, then.” Replace the ‘x’ with the left, or up tile’s x coordinate. Below that, (not in the else case or end case) create a new fork condition that says, “IF variable ‘GuardY’ is equal to ‘y’ then,” replace the ‘y’ with the left/up tile’s y coordinate. Make another fork condition that asks “IF switch ‘lighton’ is off, then” Below that, display the battle animation on the guard that shows surprise, and then have it wait 1.0 seconds, and then turn on the switch “LightOn.” In the else case, make a new fork condition that says, “IF variable ‘GuardX’ is equal to ‘2x’, then” replacing ‘2x’ with the down / right x’s coordinate. Below do the same with “GuardY” and the down / right’s y coordinate. Below that have the fork condition that asks about the switch. After that, have it do the same thing that it did before. In the else case, have nothing happen. In the end case of the event, have it wait for 0.1 seconds.

So that is all that there is to creating a “Light Switch” System for your RPG! One great way of using this, is to use this along with a visibility meter system (hint hint) and other stealth systems! You can expand on this as well.

“Even The Greatest Gamers Were n00bs.”