How to create button input events?

...or specifically, how do I get an event to wait for a button press input before moving on?

I am looking to create button input events during battle (e.g. input a string of direction buttons within a certain time limit) that have different outcomes depending on success and failure. I am doing this using common events with the "button ____ is pressed" conditional branch condition. However, this relies on you already having the required button held down as the relevant part of the event is run.

What I want it to do is to get to the relevant part AND WAIT for the button to be pressed, then evaluate whether it was the right button. I have tried doing this with parallel processes, labels and loops but it seems to get stuck in infinite loops no matter what I do.

I have made a simple, stripped down version of the common events to try and isolate the waiting for button press feature, shown in these screenshots. What I have tried to make here is an event (triggered by an enemy action) that plays a SE to indicate the start and end of the skill, then a 300 frame (5 second) time limit to press the down button. When pressed, this plays the chime SE.

Any help is greatly appreciated.
You are so close. Not sure about VX Ace, but in MV it works something like this:

1) Skill calls common event (you got that going already, nice)
1678581044750.png


2) Common event starts a timer and turns on a switch
1678580973660.png


3) Under Troops, add a condition for when switch is on and span is MOMENT to listen for button input. Span: Moment is important here. And yes you would have to add this condition to every troop.
1678580987897.png
Well, woops, you can't use timer in a battle b/c the default behavior is for the battle to end when the timer runs out. There is a plugin (for RPG Maker MV, not sure about VX Ace) to fix that behavior though.



If you don't want to use the timer + plugin, then you can to do it using loops:

1) Same as before -- Skill calls common event (you got that going already, nice)

2) Common Event sets the loop variable to 0 and turns on the switch

1678582517423.png


3) Your troop event looks something like this (60 loop runs * 5 frames wait = 300 frames, e.g. 5 seconds):
1678582572825.png
Double-post notice: @TESTOSTERONE
Don't worry Testosterone, I'll pay the fine for you.

Cheers dude, that worked perfectly! It would have taken me a looooooong time to think about putting it in the troop events.

Edit:

Okay, next question. How do I STOP the button giving an input and wait for the next button press. In other words, how do I make it accept only ONE input from the button rather than continually inputting from holding the button down?

In my event, I want to have to enter a combination of buttons, but it's failing because when it moves onto the next required input, the key from the first input is still being pressed.


Edit:

Never mind. I figured this out after a sleep, some coffee and a drive to work.
Thread closed

Original thread: https://forums.rpgmakerweb.com/threads/how-to-create-button-input-events.155727/