The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Tutorials and Eventing => Topic started by: Doctor Professor Nikolai on July 02, 2008, 09:09:52 PM

Title: Request: Item at certain position
Post by: Doctor Professor Nikolai on July 02, 2008, 09:09:52 PM
Well, if you've played some game, in some game there are puzzles where you must push a rock, item, or items, to a certain spot or on a button of some sort. For example, in a room, there are three rocks, three buttons, and a door, you have to be on all three switches for the door to open, but you can't go to three places at once. So you have to push a rock onto a button, and when it's on it, the switch will stay down.

Tl;dr:
How can I make it so a movable rock has to be on a certain spot?
Title: Re: Request: Item at certain position
Post by: modern algebra on July 02, 2008, 09:15:46 PM
Just check the position of the event using variables. So, make three events (your rock events) and set aside six variables.

Call one variable Rock 1 X, another Rock 1 Y, etc... for all three rocks. Then in a parallel process event:

Set all variables to the coordinates of their respective names. You'll notice that if you go into Control Variable, one of the options is to set a variable to any character's Map X or Map Y - use those to get the coordinates of all your rocks, and then just check them against the positions of the switches.
Title: Re: Request: Item at certain position
Post by: Doctor Professor Nikolai on July 22, 2008, 09:50:56 PM
Not to be a necroposter, but I still don't quite understand. Could you set me up with a demo of some sort?
Title: Re: Request: Item at certain position
Post by: Zylos on July 23, 2008, 02:09:05 AM
Firstly, don't worry. It's not a necropost. Second, it's easy enough to do this kind of puzzle if you understand the basic variables of it.

Let's say that your switch is at coordinates 009, 003. Obviously, you want the switch to activate when your rock's coordinates match those of your switch. So, what you need to do is make two variables: Rock X, and Rock Y. Make a parallel process event that sets these two variables to your rock's Map X and Map Y accordingly. Then, in the same event (or a different one, if you prefer), make a conditional branch that checks if Rock X = 9 AND if Rock Y = 3. If so, then you can activate the switch's event and whatnot. There's a lot more you can add to it, but it might be better to just experiment for yourself.

I've attached a mini-demo below with some extras. It has no bugs as far as I can tell. Feel free to use it if you want, as long as you keep in mind that if you move the switches, you have to change the preset coordinates on them.