Tutorial: Pushing Blocks into Place

in Tutorials

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.

  1. Where each crystal has a specific trigger location it goes with.
  2. 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.

Not the most difficult of puzzles, but perfect for explaining the mechanics.

Not the most difficult of puzzles, but perfect for explaining the mechanics.

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!)

Move

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:

RegionID

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.
getlocation

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:

  1. Record that one more Crystal is in the right spot
  2. 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.

Done

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.

Page2

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.

Treasure

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!)

 

Comments on this entry are closed.

  • Seth.D

    My first reaction to the irretrievable crystal problem would be to solve it by marking those problem tiles with regions then making an event that would reset the room if it detected a crystal in one of those problem tiles. Probably not the most elegant solution, but it solves the problem!

    • Nick Palmer

      I did something similar to that in the demo. I just had it reset the specific crystal though.