Some Input/Button Questions

Sorry if the title isn't super helpful, there are a couple of questions I have, but they're in the same vein, so I'm using the same post. I'm trying to event an ABS, but at the moment, I'm stuck on the input handling. I've seen a few other people make these systems with events by checking if the player is pressing Space, otherwise, take damage. However, I noticed a huge flaw with that. You can just hold space for the entire battle and not get hit. That's not quite what I have in mind for an engaging and challenging battle system, LOL. I've considered using Input.trigger?, but that would make it much too hard now, because you have to be touching the enemy and pressing the button in the exact same frame, which is too precise for most players. So what I'd like to do is make a bigger window of time for the input to register. What I mean by this is, press the button, and if you're within say 90 frames of the button being pressed and you're touching the enemy, attack them. After that, you have to re-press the action button for the attack to register, so that we can eliminate the problem of the player holding Space for the entire battle and winning.

Sorry for the wall of text, I was trying to make sure I really explained what I wanted.
you can do this by basically splitting the action from the trigger - but that is tricky because of timing problems and a few other things.

basically you need two different things:
one parallel that checks which button is pressed and when. and then sets switches based on those button presses. basically if the attack button is pressed, a switch is turned on and a variable times a number of frames until the attack switch is turned off and so on.
you'll need several switches and timer variables to get everything right

and then the enemies are activated on touch but check the switches for the current timing before deciding on the results.

you might also want to look for a keyboard script so that you can assign other keys to the different functions you need.
This seems reminiscent of the issue I ran into eventing my stamina/dashing system for my ABS. When stamina runs out dashing is disabled, and when there's enough to dash again, it's re-enabled.

Lots of little things came up that I ended up addressing, but one of the things was that if the player is consistently holding the dash button, they'd end up in a cycle of rapidly flipping between dash-walk-dash-walk-dash-walk, and effectively achieve a sort of jittery, medium half-speed as the stamina drains-regens-drains-regens-drains-regens. This was because they'd automatically start dashing again the moment it became possible again, every time it became re-enabled as long as they were still holding the button down.

So I made a condition that they must not be pressing the shift key in order for dashing to be enabled again - so they must lift their finger and press again - to prevent the almost cheaty, and choppy-looking "jogging"-like state.

I'm not sure how much of this can be precisely translated to your specific situation, but in case it helps to provide a starting-point, here's my stamina event page:

Spoiler
This system works like a charm, by the way 🙂

picture1.png

picture2.png

I think it's basically a version of what Andar described; just instead of using a switch and timer, I'm using a button-input check and a variable-comparison check.

Original thread: https://forums.rpgmakerweb.com/threads/some-input-button-questions.146212/