Golden Week Tutorial: Timed Button Press

in Tutorials

Time for another Golden Week Tutorial! Remember this is the last day of Golden Week, and time is running out to get huge deals on all things RPG Maker, or perhaps win a copy of RPG Maker MV, but its also time for some event tutorials to teach you some new techniques!

Harold has decided that a good way to spend his Golden Week vacation is on a fishing trip! So he has headed up to a mountain fishing village and found some “dark water” that signifies the fishing spot.

Why do fish always congregate in easy to identify spots anyway?

Why do fish always congregate in easy to identify spots anyway?

So, we’re going to do fishing kind of like in Animal Crossing. You start fishing at the spot, you wait a random amount of time for an indication that the fish is on the hook (in Animal crossing it was visual, in our event it will be auditory), then you press the OK button really fast and you catch a fish. If you are too early or too late, you miss it.

Just as with the last time, its important to think: What information do we need to track?

So in this case what do we need to track… Hmmm… Huh… Well. Nothing. There is nothing to track but how many fish the player has and that is done by just giving him more fish as items.

That DOESN’T mean though that we will not need a variable or switch. Sometimes you’ll need a variable or switch inside an event just to keep track of something specific to it. In the case of this event, we will need a Count variable again! This is to randomize the delay between the start of the event and the noise, as well as to measure the amount of time the player has to press the button. A generic Count/RNG variable is always useful to keep around just for these reasons. Sometimes you’ll even need multiple generic ones. We can do this with just one though. And if it was the same project as we did our ordered switch tutorial on, we could reuse that one.

Pretty easy variable/switch list this time around.

Pretty easy variable/switch list this time around.

Now we need to work on the second part. In plain text, what should the event do.

  1. Wait a random amount of time between 1 and 6 seconds.
    1. Did the player press the OK button during this time? Give too early message, end event.
  2. Play the Splash Sound Effect.
  3. Wait 1/2 second.
    1. Did the player press OK during this time? Give the player a fish, end event
    2. Did the Player fail to press OK during this time? Give a fail message, end event

So first, we need to add a Wait 30 to the beginning of the event. Why? 30 frames is half a second. This gives the program time to differentiate between the press that started the event, and the beginning of player input for the wait period. If you don’t add this in, it will read the player still having the button pressed from hitting OK to start the event.

Now, you are thinking, well, I just need to Wait a random amount between 30-270 right? That will fill out the 1-6 seconds. So store a random number between 30-270 in the Count variable and then wait that amount.

There are two reasons this won’t work. 1. You can’t wait a Variable amount of time, and 2. You can’t then check if a button was pressed during that time. Instead, we’ll need to use a Loop. Loops are super useful in lots of situations, they basically just keep doing the same thing over and over until you tell the program to break the loop.

So, you had the beginning right, First, drop that random number between 30-270 in the Count variable. But then, we want to start a loop. So we want the loop to do these things. Wait 1 frame, check if the player hit the OK button, have it tell him too early and break out of the loop if he doesbreak, subtract one from the Count Variable, check if the Count Variable = 0, and if it does, break the loop, if it doesn’t, go back to Wait 1 Frame and repeat. This is a very simple Loop, and learning to understand it will build up your ability to do other similar puzzles. This is what it would look like.


So we Wait half a second, determine a random amount of time between half a second and 5 and a half seconds, Then start a loop that counts down that amount of time and breaks the loop if the count hits 0 or the character hits the button too soon.

Now we just need to create the loop inside the If: Count = 0 Conditional Branch. Its pretty much identical to the original loop, but instead we set our Count variable (which we can use again since its not being used anymore) to 30 for half a second, and play a sound before it. And this time, hitting the button during it is SUCCEEDING and not hitting it is failing. With being so close to the original loop, I’m not going to repeat the process of creating it, but it should look like the following, starting at the If: Count = 0:


So, did you follow along? Why not check out the demo HERE? Can you find a more efficient way to create this event? Or maybe you have questions of how it is made? Join the comments below!

7 comments… add one

Leave a Comment