[YEP - Action Sequence] Use animation if effect lands

Hi all,

Is it possible (using Yanfly's Action Sequence plugins) to display an animation only if the attack effect lands?

Eg: An attack has 10% chance of poisoning, I want an animation to be displayed only when that happens.
I'm sure that someone may come up with a better solution, but here is mine. This performs the original animation (if you wrote that command ofc), but shows another if the Poison state lands after the hit.

<target action>
...
...
...
action effect
if target.isStateAffected(x)
animation y: target
wait for animation
end
...
</target action>
Thanks! Will try this when I get home.
It seems however, that the animation will display if the target Is poisoned, regardless of whether the status was inflicted by the attack.
Hmm, that is true. I'll look into it more deeply
You could create a variable (many of Yanfly's Tips & Tricks videos show you how if you don't know) before the Action Effect to check if the target is poisoned, and check after the Action Effect to see if they are poisoned, and only if they were not poisoned before and are poisoned now would you run the special animation. However, this would not cover the case where the battler was already Poisoned, and then the battler is Poisoned again, refreshing the state duration.

You could check the battler's state turns (I believe the syntax is either target.stateTurns[x] or maybe target._stateTurns[x] where x is the State ID of the Poison state) to get around this. If the battler is Poisoned after the Action Effect (but not before), OR if the battler is Poisoned after the Action Effect and has a higher number of State Turns than before, then you play the special animation. This wouldn't cover the case where multiple actors inflicted Poison in the same turn, but since inflicting it twice in the same turn wouldn't do anything anyway (as the number of State Turns hasn't changed), this should be OK.

If none of that is sufficient and you REALLY need to have a different animation, you would probably need a tiny plugin to set a flag inside the addState method which your Action Sequence could read. That's beyond the scope of this discussion and I'd recommend a separate thread in Plugin Requests for that. For now, I'm moving this thread to Plugin Support since it deals with usage of Yanfly's Action Sequences.

Original thread: https://forums.rpgmakerweb.com/threads/yep-action-sequence-use-animation-if-effect-lands.111826/