Make a state with chance to proc each turn?

I was wondering if it was possible (through scripts or functions or whatnot) to have a state that has a % chance to apply something each turn?

I wanted to make a death state that has a % chance each turn to kill you, for x turns.

So far I haven't been able to come up with something for it or find a script that makes this possible, so I instead currently have a skill that just rolls a random number and if it's higher, will kill the user.
This exists already.

Umm.. I forget who made it.. but it's "Infectious States" or something like that. You could set up a state that as a percentage chance each turn to proc and spread other states to the actor, allies, or foes.

For example: You could set up a state called Flu Bug. Once an Actor has that state, at the end of each turn, there is a 15% chance to infect an ally.

You could do similar with your idea. Create a state "Doomsday" that does nothing by itself, but at the end of each turn has a 25% chance of KO'ing the one who has that state.

You could also couple this Plugin with a "Progressive States" plug in, and set it up to where each turn that passes, the chance of Proc'ing increases/decreases. 🙂

Wish I could be more helpful, but I am super tired. Hope this helps!
-MIA
This is the plugin you need: http://yanfly.moe/2015/12/25/yep-50-buffs-states-core/
Let's create your state then. A state which has a chance (for example, 10%) to kill the affected unit per turn for 5 turns. You can set its turn in the database like usual. And to roll a random number at the end of affected unit's turn, put the note tag below into state note box:

Code:
<Custom Turn End Effect>
if (Math.random() < 0.1){ //0.1 means 10%
target.startAnimation(x); //In case you want to play an animation when this unit is killed, change X to your animation ID, or else just delete this whole line
target.setHp(0);}
</Custom Turn End Effect>
Thanks a lot for the help! Works perfectly and was exactly what I needed.

Original thread: https://forums.rpgmakerweb.com/threads/make-a-state-with-chance-to-proc-each-turn.87691/