Enemies wont have death animation if killed with scripts

<Custom Action End Effect>
if (user.mp==0) {
user.addState(1)
}
</Custom Action End Effect>
im using yanfy's buff stat core for this, when I kill an enemy normally (with attacks directed at their hp) they die normally but when I try and kill them like this, while they are dead and I cant target them anymore, they just stay there on battle wich is really annoying, any ideas on how to fix this?
Yes, don't skip all of the steps and directly apply KO 😛

A good example of this can be seen in Yanfly's Thornmail Tip & Trick. He shows how to damage a target, then check if it's dead and make it collapse.
Thank you, the answer was way simpler than I'd ever think

Original thread: https://forums.rpgmakerweb.com/threads/enemies-wont-have-death-animation-if-killed-with-scripts.150586/