MZ Hold a button to escape from battle.

Looking for a plugin that would let the player escape from battle by holding a button.
When the button is held the actors on the battle screen will use the escape motion poses. The Monsters in the troop would attack you and cast spells on you while you try to escape assuming you're using the ATB system.
I was able to abort battle by holding a button doing this
1692209038181.png


with this plugin

You will need to add the rest (set battler animations, etc). If you want the player to only be able to trigger this sequence during certain parts of the battle (e.g. enemy turn) you need to specify that in a conditional statement.
You might want to add to the event @AquaEcho posted an Else branch to the first conditional that sets buttonPresses back to 0 also.

Otherwise, you could hold the button for a second, stop, do it again and escape.

The other tricks with this method off the top of my head are:
- Depending on how the button presses interact, it wouldn't prevent a player from taking a turn with an actor
- Getting all of the actors to go to a specific motion might require adding some condition to refreshMotion() or something
I was able to abort battle by holding a button doing this
View attachment 273546

with this plugin

You will need to add the rest (set battler animations, etc). If you want the player to only be able to trigger this sequence during certain parts of the battle (e.g. enemy turn) you need to specify that in a conditional statement.
You might want to add to the event @AquaEcho posted an Else branch to the first conditional that sets buttonPresses back to 0 also.

Otherwise, you could hold the button for a second, stop, do it again and escape.

The other tricks with this method off the top of my head are:
- Depending on how the button presses interact, it wouldn't prevent a player from taking a turn with an actor
- Getting all of the actors to go to a specific motion might require adding some condition to refreshMotion() or something

While this method works it is very janky and I can't seem to get it to play nice with VisuStellaMZ's Battle Core Motion command due the command being ran several times a second instead of once while the button is held. Also when a ATB bar is filled for a actor that has escaped the engine or VisuStellaMZ would move the actor back into the original position witch is back on screen.

​

While this method works it is very janky and I can't seem to get it to play nice with VisuStellaMZ's Battle Core Motion command due the command being ran several times a second instead of once while the button is held. Also when a ATB bar is filled for a actor that has escaped the engine or VisuStellaMZ would move the actor back into the original position witch is back on screen.

​

The command has to check many times a second to ascertain that a button is being pressed. How do you propose the engine know whether a button is still being held otherwise if it is not checking? You could put a wait 3 frames or so at the end that will make it so it checks less often, but will still be sensitive enough not to miss button presses. Then just reduce the 120 to 40.
The command has to check many times a second to ascertain that a button is being pressed. How do you propose the engine check whether a button is still being held otherwise? You could put a wait 3 frames or so at the end that will make it so it checks less often, but will still be sensitive enough not to miss button presses. The just reduce then 120 to 40.
The way that the engine is checking if the button is being held is fine. I'm talking about the way how the engine handles the escaping from battle. EDIT: Maybe having it use the party escape command.

I probably should have clarified that also I need the engine to Also take in the party's agility stats in account in order to make it take longer or shorter if its high or low (witch could possibly mean have it make attempts to escape hidden somehow.)

make sure that the attempt escapes are not stopping the enemy and party member's from charging.
And also checking if the battle is escapable or not.

I hope I clarified that better.
make sure that the attempt escapes are not stopping the enemy and party member's from charging.
This is a separate process from the rest of the battle. It shouldn't be stopping the rest of the battle from proceeding.

And also checking if the battle is escapable or not.
If the battle is not escapable then turn off the switch that enables the common event.
I probably should have clarified that also I need the engine to Also take in the party's agility stats in account in order to make it take longer or shorter if its high or low (witch could possibly mean have it make attempts to escape hidden somehow.)
Then you need to change the buttonPresses from 120 to a variable whose result is derived from a formula.

Original thread: https://forums.rpgmakerweb.com/threads/hold-a-button-to-escape-from-battle.160345/