how to wait for anmination in Yanfly Buff&States custom script

I'm trying to make an effect similar to the phoenix ring:
http://yanfly.moe/2016/01/06/tips-tricks-phoenix-ring/
<Custom Apply Effect>
if (target.isActor()) {
var ring = $dataArmors[1541];
if (target.hasArmor(ring)) {
target.discardEquip(ring);
target.startAnimation(42);
var hp = Math.floor(target.mhp * 0.25);
target.gainHp(hp);
target.startDamagePopup();
}
}
</Custom Apply Effect>




However, I really want to wait for some frames after the animation starts to play before the damagepopup step.


I have not found any script to do this. Is anyone familiar with the structure? Is this possible just with a few lines of js scripts in the tag? Thanks.
I only know the script BattleManager.actionWaitForAnimation(); can pause the rest of the script until the animation ends. Applying to your script:

Code:
<Custom Apply Effect>
if (target.isActor()) {
  var ring = $dataArmors[1541];
  if (target.hasArmor(ring)) {
    target.discardEquip(ring);
    target.startAnimation(42);
    [FONT='courier new']BattleManager.actionWaitForAnimation();[/FONT]
    var hp = Math.floor(target.mhp * 0.25);
    target.gainHp(hp);
    target.startDamagePopup();
  }
}
</Custom Apply Effect>

Original thread: https://forums.rpgmakerweb.com/threads/how-to-wait-for-anmination-in-yanfly-buff-states-custom-script.67287/