Parry followed by a counter attack

Hello, i've seen this question asked a lot on other threads, but i can't really find a solution that fits me, what i'd like to do is have a simple parrying system, so that when the enemy attacks, at a certain point during the animation (example if the enemy swings a sword around, it would be in the frame where the sword hits the player) a reconizable sound would play, that would hint the player to parry (this can easily be done in the animation tab) the player hits a button like z, and the game cheks if the timing was correct, if it was, the enemy attack animation is interrupted (no timed hits bar like undertale) (example if the animatin was supposed to continue, like the enemy putting the sword back in its sheath, it would interrupt at the point where the parry happened) and the player would immediately perform a counter with a specified animation from the database, (else nothing would happen and they would just take damage) after all this turns can happen normally again, this would be the base of it, in the future, it could also work that if the enemy does multiple hits, you would need to parry all of them until the last to perform a counter attack
I originally tough it could be done with eventing, without needing a plugin, but i can't figure out a way to check if the button was pressed during the specific time, i'm also using yanfly's battle engine core with action sequences, along with mog's battlehud if that can help thank you for reading :LZSsmile:
Start the swing motion in the action sequence, then put SRD Sequence Input plugin check at the moment you want and then if the player presses the button you have a conditional sequence where you change the enemy motion and make the attack with the player. That should work as far as I understand.

EDIT: Or if you're doing the swing with an animation, you can cancel that animation
Start the swing motion in the action sequence, then put SRD Sequence Input plugin check at the moment you want and then if the player presses the button you have a conditional sequence where you change the enemy motion and make the attack with the player. That should work as far as I understand.

EDIT: Or if you're doing the swing with an animation, you can cancel that animation
Thanks! i also watched the video and i'm thankful it shows exactly what i need to do, i think everything can work tough i forgot to mention one thing, i'm doing front battles, so i've been trying to adapt the command to my system:

<target action>

start sequence input: ok, 2

end sequence input



common event: 4 (i play my animations trough common events, the common event is just a show battle animation, i do this so that it ignores the "scope" of the animation and plays it wherever i want on the screen regardless, it shouldn't affect the sequence tough)

wait: 20

se: Bell3, 90, 100, 0 (the sound to play to know when to parry)

perform action



if $gameVariables.value(2) < 25

wait for animation

action effect: target

death break

else

common event: 5 (plays the counter animation)

perform action

wait for animation

action effect: user

death break

wait: 8

</target action>

I've been trying to do the parry by waiting 25 frames and pressing but i've done this a fair bit of times to say i think something isn't working, could you help me out with the note tag? thank you knidly
Start the swing motion in the action sequence, then put SRD Sequence Input plugin check at the moment you want and then if the player presses the button you have a conditional sequence where you change the enemy motion and make the attack with the player. That should work as far as I understand.

EDIT: Or if you're doing the swing with an animation, you can cancel that animation
Also, i might be mistaken but it seems this works in relation to fps? again i might be wrong, but that would mean if someone is at 60 and i programmed it working on 120 it would break for them and have a different timing
Yeah, I don't know about that possible FPS problem that MV has(?) Ask someone who has made these time inputs, like @SGHarlekin
The game doesn't process at 120fps. It processes at 60. At least if you installed the proper fix plugin. I think @TheAM-Dol still has it in his signature. If you don't the game would run at double speed on anyones machine playing on a 120hz+ monitor.
the internal logic is capped at 60. When the game reports more than 60 that's just because it drew an existing frame twice. Visually the data is the same. It's just unnecessary extra overhead in the processing.

Fix is still in my sig. Thanks for spreadin the word fam.
The game doesn't process at 120fps. It processes at 60. At least if you installed the proper fix plugin. I think @TheAM-Dol still has it in his signature. If you don't the game would run at double speed on anyones machine playing on a 120hz+ monitor.
Thanks, do you happen to know how i can structure the note tag?

<target action>

start sequence input: ok, 2

common event: 17

wait: 20

se: Bell3, 90, 100, 0

end sequence input

if $gameVariables.value(2) > 0

common event: 18

wait: 90

perform action

action effect: user

else

wait: 100

perform action

action effect: target

end

</target action>

for now this is the only thing that works for me, but it has a number of issues (the common events just call for animations to ignore the scope of the skill) what happens with this is the enemy attacks and if the button is pressed after around 1 second the counter happens, the issue is, i can't get it working with any other number nor by changing it to < (< 25 was the original note tag by srd but that just makes the counter happen automatically for some reason) so i can't really decide when the button has to be pressed,
The second issue is that you can just spam the button
Well yeah, if you're using common events to play animations for no reason, I'd expect that to happen. There are commands you can use to play any animation on any enemy, player, screen location. There's no reason to "Ignore the skill's scope" or whatever you're tryna do there.

Calling common events withing an action sequence in MV is a fickle thing. Many times, depending on what event commands you use in it, the common event will play at the very end, no matter where you called it. Most other times the sequence will just straight up pause until whatever is happening inside the common event is done. So, use the available commands to play animations, not this jank workaround that doesn't need to be there.

1773062058481.png

You also have a 90 frames wait here, so when the input was hit successfully, not only does it play this common event and probably wait until the animation is done, but it'll also wait an additional 90 frames.

I suggest you actually read the provided instructions on the yanfly page. Look for "Target typing".

You can use target typing for almost anything.
animation x: user would play an animation on the user of the currently running skill
animation x: target would play it on the target/targets of said skill
animation x: Opponent x would play it on any opponent you specify alive or dead.

And so on and so forth.
Well yeah, if you're using common events to play animations for no reason, I'd expect that to happen. There are commands you can use to play any animation on any enemy, player, screen location. There's no reason to "Ignore the skill's scope" or whatever you're tryna do there.

Calling common events withing an action sequence in MV is a fickle thing. Many times, depending on what event commands you use in it, the common event will play at the very end, no matter where you called it. Most other times the sequence will just straight up pause until whatever is happening inside the common event is done. So, use the available commands to play animations, not this jank workaround that doesn't need to be there.

View attachment 362323
You also have a 90 frames wait here, so when the input was hit successfully, not only does it play this common event and probably wait until the animation is done, but it'll also wait an additional 90 frames.

I suggest you actually read the provided instructions on the yanfly page. Look for "Target typing".

You can use target typing for almost anything.
animation x: user would play an animation on the user of the currently running skill
animation x: target would play it on the target/targets of said skill
animation x: Opponent x would play it on any opponent you specify alive or dead.

And so on and so forth.
Hello again, thanks, i've fixed the common events tough it's been a few days and i still can't figure out how to prevent input spamming, i believe the code only cheks if the input was pressed in the correct time window, regardless if it was spammed, would you happen to know of a fix?
You start the sequence input a couple frames early and set your conditional to not say >0 but instead >10 or something, that way when input is registered within those early frames, the input will fail. (If you got a visual indicator for the player to know when to press, don't forget to delay that visual indication the same amount of frames. You only start the input early, you don't tell the player you did. If you give it at the same time, the player will press too early and wonder why.)


Code:
start sequence input
wait: 10
visual indicator animation
wait: 30
end sequence input
if variable x > 10
do stuff
You start the sequence input a couple frames early and set your conditional to not say >0 but instead >10 or something, that way when input is registered within those early frames, the input will fail. (If you got a visual indicator for the player to know when to press, don't forget to delay that visual indication the same amount of frames. You only start the input early, you don't tell the player you did. If you give it at the same time, the player will press too early and wonder why.)


Code:
start sequence input
wait: 10
visual indicator animation
wait: 30
end sequence input
if variable x > 10
do stuff
Works perfectly, thank you :LZSsmile:
to make the time window smaller or bigger i just change the >10 value right? (and then every other timing along with it)
On a basic level, yes. I don't know your sequences.

Original thread: https://forums.rpgmakerweb.com/threads/parry-followed-by-a-counter-attack.182763/