NOTE: This article will use techniques originally found in the Using RegionID in Events tutorial. So if you haven’t read that one, go do so now.
This is another common RPG Maker puzzle. You have statues/pillars/crystals/boulders or something like that, and you have to push them onto specific spots on the map. Once all the pushed items (referred to as crystal for the rest of this article as that is what I’m going to use in my demo) are all in place, something happens.
There are two types of these puzzles.
- Where each crystal has a specific trigger location it goes with.
- Where there are crystals, and trigger locations, and it doesn’t matter which crystal is matched to which trigger location, as long as they are all on one.
The first one is a little simpler, so instead, I’m going to focus on the second one.
This puzzle will work like this: Once you get the four crystals on the four trigger locations, a treasure chest will appear in the center for you to open.
The first thing to do, is have the Crystals pushable. This is pretty easy. All you have to do is add a move route that moves away from player. You can use Action Button or Player Touch as the trigger. (As a note: remember to turn on Direction Fix in the event’s settings. Otherwise it could change color based on the direction you push it from!)
Just like it was with the player in our last tutorial, RegionIDs are the key to figuring out if the event is in the right place. The easiest way to tag all the trigger locations is to tag them with a RegionID. Like so:
Now, just like we did before, we can trigger something to happen when the Event is on a certain RegionID. Before, we were storing the Player’s X and Y and determining the RegionID from that. This time, instead, the event needs to store its own X and Y and then use GetLocation to determine the RegionID. You’ll want it to check it right after it moves. After the last tutorial, this should be pretty simple.
Now that we know what RegionID the Event is on after moving, we can check if it is on the proper RegionID, in this case 1.
Once we do this, we need to do 2 things:
- Record that one more Crystal is in the right spot
- Set the Crystal to no longer be moveable.
While you could set each Crystal to its own variable, it’s much easier to just have one variable. Every time we move one in position, we increase the variable by 1. Once it is 4, we reveal the prize. But we still need a way to stop the Crystal from moving anymore. For that, we can just use a Self-Switch to a Blank Page 2. The advantage of doing it this way is we could copy and paste this crystal as many times as we wanted, and we would not have to do any edits to it for it to work.
You’ll notice that as a final touch, I zeroed out the Event X,Y, and RegionID variables. I find this best to do with any variable that is used only within the event. It means every event will start with the variables at 0, which is a safer starting point in the case of using something other than setting variables.
Another extra touch I made was changing the second-page graphic to the Crystal Glowing. Just thought it looked nicer.
With that done, you can just copy paste this event 3 more times to make the 3 other crystals. Everything works, all we need is to make the treasure chest. You can use the quick event creation Treasure to make the base. Just put in the graphic you want and the prize you want to give out. In my case, I selected an absurd amount of gold.
After that, quickly go in and change the conditions on the first page so that the variable of crystals in place has to be 4 or more for it to appear.
And with that, everything is done!
There is still one more thing you might want to address. What if the player pushes a Crystal into an area where he can’t get it back? Do you have a solution? What would your solution be? Have any questions about the tutorial? Think you know a better way to do it? Join us in the comments section below.
Want a better look at this event? Download the Demo HERE! (With a bonus solution to Crystals being pushed into edges!)