Waiting for animation before executing rest of code

So I made a catch/recruit plugin (like in pokemon). The only problem left is that the code doesn't wait for the animation to be completed. So if the catch succeeded, it instantly switches to the afterbattle scene which shows the catched actor.


Is there a way so that a method waits until the animation is finished?


Thx for help.
Woops, nevermind. I'll get back to you.
I tried with 


while(catchSuccess==true){
if($gameActors.actor(1)._animations.length == 0){
<add actor code>
break;
}
}


but the game freezes because of the while loop >.< Maybe I should try with labels but I never used them before 😮
Try aliasing BattleManager.checkBattleEnd and return false if Spriteset_Battle.prototype.isAnimationPlaying is true.


You can add your actor somewhere at/after BattleManager.processVictory
Try aliasing BattleManager.checkBattleEnd and return false if Spriteset_Battle.prototype.isAnimationPlaying is true.


You can add your actor somewhere at/after BattleManager.processVictory

Sounds good! I will try it, thx.
Try aliasing BattleManager.checkBattleEnd and return false if Spriteset_Battle.prototype.isAnimationPlaying is true.


You can add your actor somewhere at/after BattleManager.processVictory

Worked perfectly 🙂  even without the  Spriteset_Battle.prototype.isAnimationPlaying ... The trick was simply to add the actor after the battle end 😀 😀  


So thank you!

Original thread: https://forums.rpgmakerweb.com/threads/waiting-for-animation-before-executing-rest-of-code.61030/