Hi, I'm trying to make a piano puzzle that makes the user press a sequence on the keyboard, and it gives the user an item. I tried my best following other threads and videos but I have no idea what I'm doing.
Piano Puzzle Question
RPG Maker MZ SupportHi there! Welcome to the forums! Think you can show us some event pages you’ve worked on? It could also be helpful to share the threads and videos you’ve been referencing.
Welcome!
It doesn't help that your terminology, in this case, is vague.
When you say pressing a sequence on the keyboard, do you mean there's an image of the piano keyboard and they're clicking on keys? Or do you mean pressing letter keys on their computer keyboard?
As @Ms Littlefish said, please put all of the information that's in your head into this thread.
We also have no idea what you're doing unless you show us 😛
It doesn't help that your terminology, in this case, is vague.
When you say pressing a sequence on the keyboard, do you mean there's an image of the piano keyboard and they're clicking on keys? Or do you mean pressing letter keys on their computer keyboard?
As @Ms Littlefish said, please put all of the information that's in your head into this thread.
Yeah lol, my bad
So this is what I was working with. I got my code from this thread https://forums.rpgmakerweb.com/index.php?threads/sequential-puzzle-issues.38163/
and I also followed . My code closely followed the thread but I realized its a different Rpg Maker engine so I feel a little lost. Also sorry for the inconsistent code.
So this is what I was working with. I got my code from this thread https://forums.rpgmakerweb.com/index.php?threads/sequential-puzzle-issues.38163/
and I also followed . My code closely followed the thread but I realized its a different Rpg Maker engine so I feel a little lost. Also sorry for the inconsistent code.
Also yes, pressing a sequence on the computer keyboard
Okay...so what isn't working? What is it doing or not doing? What is the question?
Off the top of my head I see several potential errors, such as having an event with an Action Button trigger and no image, and an Erase Event command with other commands still following it.
Off the top of my head I see several potential errors, such as having an event with an Action Button trigger and no image, and an Erase Event command with other commands still following it.
So, when I followed the code exactly from the thread I sent, the code didn't seem to read that I was inputing the sequence from the keyboard. I also tried to do it as a parallel but it still didn't work. The only thing that works from the puzzle is when I press the keyboard, the note plays. Other than that, its doesn't run how I want it to be(which is press s e d f on the keyboard. If wrong then reset the puzzle if right, give item to player.
I was trying to do the array method but nothing worked. I think my main question is what is the best method/code to execute the puzzle?
I was trying to do the array method but nothing worked. I think my main question is what is the best method/code to execute the puzzle?
Well, you still don't show the entire page 2 of your event, so it's hard to completely troubleshoot.
But here are things that look wonky to me:
- Page 1 has an Erase Event, which means Page 2 shouldn't even get triggered, because you erased the event until you load back into the map. Why is that command there at all?
- Your common event has a conditional inside it. In the video you linked to, that was present because the common event was being called directly from a button via a plugin. But you aren't doing that, you're trying to look at the player's keyboard input - so if you're calling the common event manually, only when you intend to, why is the conditional there?
- Your event 8 page 2 is triggered by action button. That means any of the conditions inside are only going to happen if, for example, the player hits Enter while holding "E". From the design of the event, I presume you want that event to be a parallel process, continually running.
- That other thread is really not a useful reference for anything because it's a completely different programming language. Your script calls are incorrect -
- Then, the next thing in your scripts is also incorrect,
But here are things that look wonky to me:
- Page 1 has an Erase Event, which means Page 2 shouldn't even get triggered, because you erased the event until you load back into the map. Why is that command there at all?
- Your common event has a conditional inside it. In the video you linked to, that was present because the common event was being called directly from a button via a plugin. But you aren't doing that, you're trying to look at the player's keyboard input - so if you're calling the common event manually, only when you intend to, why is the conditional there?
- Your event 8 page 2 is triggered by action button. That means any of the conditions inside are only going to happen if, for example, the player hits Enter while holding "E". From the design of the event, I presume you want that event to be a parallel process, continually running.
- That other thread is really not a useful reference for anything because it's a completely different programming language. Your script calls are incorrect -
push(e) is going to try to push a variable named "e", but you don't have one. Are you intending to push the character "E", in quotations? You, again, don't actually show us what you're doing with this array so it's impossible for us to tell you.- Then, the next thing in your scripts is also incorrect,
@button_on = true doesn't mean anything. It's going to create a temporary variable called @button_on which will go away as soon as the script box ends. (actually, it won't even get that far because simply starting with @ and no commands before it will produce a syntax error)I see. I don't have my file on me right now but the rest of my code essentially looked like this but variable 1 = 17 and variable 2 = 18 and variable 3 = 19 but I now realized since its a different script it probably won't work.
I'm really new to RPG maker in general so I kind of tried my best to understand the code from the material I found. Would this code in theory work in RPG Maker MZ if I used the right script format?
I'm really new to RPG maker in general so I kind of tried my best to understand the code from the material I found. Would this code in theory work in RPG Maker MZ if I used the right script format?
In the nicest possible way, I think you have gotten yourself terribly mixed up by combining advanced tutorials from different systems and languages - you have overlapping gaps in your knowledge which results in your event not working, you don't know why, and there are fundamental errors in it.
I strongly suggest that you first do some tutorials on MZ's event system and the event commands. You should know how events that are Action Trigger, Autorun, and Parallel Process work. You should have a passing understanding of what the actual event command buttons do.
This system can be done with sheer eventing, you do not need any arrays or code. I don't see how your goal benefits from this array system.
I personally think the best thing for you would be to restart it, figure out the correct sequence of logic without following someone else's tutorial that's written around plugins you're not using, and then if you get stuck ask for help.
Then, in the event you do need to ask for more help, please post the entire thing, making sure all of it is legible and visible if there are portions that need scrolling.
It would require more effort to tear out the wrong bits of this and splice things back together than it should to just recreate it.
Edit: Minor correction - you will need one piece of code for checking button presses that aren't default RPG Maker keys.
I strongly suggest that you first do some tutorials on MZ's event system and the event commands. You should know how events that are Action Trigger, Autorun, and Parallel Process work. You should have a passing understanding of what the actual event command buttons do.
This system can be done with sheer eventing, you do not need any arrays or code. I don't see how your goal benefits from this array system.
I personally think the best thing for you would be to restart it, figure out the correct sequence of logic without following someone else's tutorial that's written around plugins you're not using, and then if you get stuck ask for help.
Then, in the event you do need to ask for more help, please post the entire thing, making sure all of it is legible and visible if there are portions that need scrolling.
It would require more effort to tear out the wrong bits of this and splice things back together than it should to just recreate it.
Edit: Minor correction - you will need one piece of code for checking button presses that aren't default RPG Maker keys.
I see. Thanks for the help anyways.
(Edit) Hey guys! I was able to get help from the RPG Maker discord server (https://discord.com/invite/vcd2SD29UH) and I'm posting the code if anyone wants to do a piano puzzle.
Make pianoPuzzle a common event
every time you press a key on the computer keyboard, it adds one to a counter and stores the key in an array. If the $gameVariables.value(16) makes the sequence you have, you win the game and sets a self switch and turns off the common event. To add the Input.isTriggered, you would have to code the keycode https://www.toptal.com/developers/keycode in rmmz_core on line 5683 under the Input.keyMapper like this
The discord channel help-mz would probably explain the process better than me, but I hope this helps anyone.
(Edit) Hey guys! I was able to get help from the RPG Maker discord server (https://discord.com/invite/vcd2SD29UH) and I'm posting the code if anyone wants to do a piano puzzle.
Make pianoPuzzle a common event
every time you press a key on the computer keyboard, it adds one to a counter and stores the key in an array. If the $gameVariables.value(16) makes the sequence you have, you win the game and sets a self switch and turns off the common event. To add the Input.isTriggered, you would have to code the keycode https://www.toptal.com/developers/keycode in rmmz_core on line 5683 under the Input.keyMapper like this
The discord channel help-mz would probably explain the process better than me, but I hope this helps anyone.
Original thread: https://forums.rpgmakerweb.com/threads/piano-puzzle-question.161477/