Doomed State

Hello I wanted to know if anyone knows how to make a State that cause death over a specified amount of turns to the actor affect with this state, Like a time bomb or something like that used in battle. I've tried using Gilgamar's Plugin State Common Events, but didnt know how to get it to work the way I wanted to. At turn end all the actors die instead of only the affect actor. please help x.x
Yanfly's buffs and states core can do it, and Yanfly even has a video with the code you'll need made already!
Yanfly's buffs and states core can do it, and Yanfly even has a video with the code you'll need made already!



Thanks for the help case solved!!! (^.^)-b and for anyone else who may have this same problem


<Custom Leave Effect>
// Get the death state for the user.
var deathState = user.deathStateId();
// Check if the user is not immune to death nor resistant to it.
if (user.stateRate(deathState) > 0.01 && !user.isStateResist(deathState)) {
// Play animation on the user.
user.startAnimation(65);
// Set the user's HP to 0.
user.setHp(0);
// Check if the user is dead.
if (user.isDead()) {
// Make the user collapse.
user.performCollapse();
}
}
</Custom Leave Effect>


There's the code

Original thread: https://forums.rpgmakerweb.com/threads/doomed-state.71391/