Force stop an animation in battle

Hi everybody,
Is there a way to stop animations on a specific time during battle?
Let me try to explain it a little bit further.

I've created a skill that has 3 different results using SRD Timed Attack: Mash and SRD Timed Attack Action Sequences with Yanfly action sequences. But I have an animation that starts playing when the skill is selected.

The problem is when a mash timed attack reaches zero, it stops the counter, so the animation continues playing even after the next turn starts. I just want a simple solution to stop (disable or hide) all battle animations on call.


What I'm looking for would be something like this:

<target action>
animation x
timed attack

if perfect
results

else if normal
results

else
stop animation
results
break action
end
</target action>

Can anyone help me?

Thanks a lot!
I'd say time your animation correctly so it stops with the timer. You split your animation into "During timer" and "after success".
So in case of failure, the animation just stops when the timer ends. In case of success, you would start displaying the rest of the animation where you split it up. That make sense?
Thanks for the reply! It would, but unfortunately that's not how it works :/
There's only one varuable in SumRndDde's timed attack, $gameTemp.tas_power and it only computes after the "mashing".

So even though the timer stops short when you don't mash the button, the other options (the ones I've called "perfect" and "normal" in the example) occurs after the timer.

Your example would only lead to the rest of the animation being played after the timer
So even though the timer stops short when you don't mash the button
I'm not sure whether you misunderstood, or if we're misunderstanding you.

Make a part of the animation that will end where the timer would stop short if the button isn't mashed.

Check then if the timer is still going, and if yes play the rest of the animation.

If there aren't instructions for how to do that in the plugin, let us know and someone can take a poke for you.
I'm not sure whether you misunderstood, or if we're misunderstanding you.

Make a part of the animation that will end where the timer would stop short if the button isn't mashed.

Check then if the timer is still going, and if yes play the rest of the animation.

If there aren't instructions for how to do that in the plugin, let us know and someone can take a poke for you.
Thank you!
I did understand you in the first place 🙂

$gameTemp.tas_power computes the final "power" you get when mashing.
So I can only control what happens after the "mashing" part, not during.

When you mash the button, the timer keeps on going until the end, but when you don't, it stops after a while.

The problem wouldn't be to make an animation that stops when the button isn't mashed, but to play the second part when the button is being mashed.

The check to see if the timer is still going is the problem.
I'm just starting on JS so it could be a newbie thing.

Edit 1: To be honest, if there was a script call to stop all battle animations whenever I needed, would be perfect.
Edit 1: To be honest, if there was a script call to stop all battle animations whenever I needed, would be perfect.
I haven't seen any in the AS packs, nor the olivia/irina packs. I had a similar issue back in the day, though I'm using srd timed input to avoid the riggid nature of the other timed attack plugins he made.

I assume the plugin only sets the variable to the gauge value at the end of the timer, so checking it's value during would indeed be pointless. Aside from maybe checking the plugin if it was possible to just not cut the timer short in case of no mashing is being done, I'm not sure what else you could do.

If you can avoid the timer stopping before the actual time however, the animation can be a fixed length, which would solve your problem.
Well, I Googled "RPG Maker MV script stop animation" and found this thread with code you can try:
(On a side note, button mashing isn't a very popular mechanic as far as I'm aware, so there is a point that can be made to just use something less obnoxious if it's too much of a headache to set up the way you want it)
I haven't seen any in the AS packs, nor the olivia/irina packs. I had a similar issue back in the day, though I'm using srd timed input to avoid the riggid nature of the other timed attack plugins he made.

I assume the plugin only sets the variable to the gauge value at the end of the timer, so checking it's value during would indeed be pointless. Aside from maybe checking the plugin if it was possible to just not cut the timer short in case of no mashing is being done, I'm not sure what else you could do.

If you can avoid the timer stopping before the actual time however, the animation can be a fixed length, which would solve your problem.
I see where you come from, I'm also using srd timed input to develop all my skills and so far it's going great. The first time I tried creating one skill with Timed Attack Mash, I've hitted a wall.
If I don't find a way to actualy hide all animations, disabling the "timer cutting short with no mashing" would indeed work, thanks for the advice.

Well, I Googled "RPG Maker MV script stop animation" and found this thread with code you can try:
Thanks for the help, I've actualy checked that link before, tried to use it and only got an error.
Sorry if it's a dumb question, but I didn't really understood the script, specially why it asks for specific battlers if I only want to hide an animation.

But maybe what I'm not managing to do is to get the correct battle reference.
(On a side note, button mashing isn't a very popular mechanic as far as I'm aware, so there is a point that can be made to just use something less obnoxious if it's too much of a headache to set up the way you want it)

Point taken 😛
Thanks for the help, I've actualy checked that link before, tried to use it and only got an error.
It's always a good idea when you start a help request to cite the things you've already tried 😉

Otherwise, you're going to ask "Is there a way to do this?" We say "Yes, here," and you go "No, I tried that."

But in that case, you should provide screenshots of the error trace (press F8, Console tab) as well as how you integrated the code into your game, so you can get help with that.

Sorry if it's a dumb question, but I didn't really understood the script, specially why it asks for specific battlers if I only want to hide an animation.
Animations are played on battlers.

But maybe what I'm not managing to do is to get the correct battle reference.
In Action Sequences, you're given user and target. Typically the animation is played on the target of the skill, but you might be doing something else with your action sequence commands.
It's always a good idea when you start a help request to cite the things you've already tried 😉

Otherwise, you're going to ask "Is there a way to do this?" We say "Yes, here," and you go "No, I tried that."
Noted 😉
Animations are played on battlers.


In Action Sequences, you're given user and target. Typically the animation is played on the target of the skill, but you might be doing something else with your action sequence commands.
thanks a lot for the clarifications!

I'm doing the regular way, the animation is played on the user. the actual code for the "no mashing part" is:
else
common event: 9
se: buzzer1
se: noway, 200, 100, 0
custom motion Error: user, no weapon
wait: 30
break action
end

But in that case, you should provide screenshots of the error trace (press F8, Console tab) as well as how you integrated the code into your game, so you can get help with that.

Probably the wrong way. I've tried calling a common event with the script on it.

In the script, on the part it says "var battler =" should i just put the filename of the sv_actor or does it need anything else?
No, a battler is a Game_Battler object or inherited type thereof - it is not a filename to...a sprite? I'm not sure what you were trying there, your project doesn't have any individual files with information about actors or enemies.

But that's okay.

Take caethyril's code and turn it into a function, thusly:
Code:
function StopAnimation(battler)
{
    // find sprite and set all their animations to 0 duration
    var ss = SceneManager._scene._spriteset[(battler.isActor() ? '_actor' : '_enemy') + 'Sprites'];
    var ix = 0;
    for (let n = ss.length; n--;)
        if (ss[n]._battler === battler) { ix = n; break; }
    var sa = ss[ix] ? ss[ix]._animationSprites : [];
    for (let n = sa.length; n--;)
        sa[n]._duration = 0;
}

Paste that into a text editor, save it as a *.js file, include it as a plugin.

Then in your action sequence where you want it to cut off, you can do:
Code:
Eval: StopAnimation(target)
That was perfect! You're a life saver, thanks a lot. *.*

No, a battler is a Game_Battler object or inherited type thereof - it is not a filename to...a sprite? I'm not sure what you were trying there, your project doesn't have any individual files with information about actors or enemies.

But that's okay.
I wa trying to follow the part that caethyril said "You'd have to figure out how to get the battler reference, since that depends on your setup." Guess I still have a lot to learn.
And that's cool. Like I said in a previous post, Action Sequences provide you with "user" and "target".

Original thread: https://forums.rpgmakerweb.com/threads/force-stop-an-animation-in-battle.154653/