How to make a petrify+stone states like in FF12?

Okay so I was working on my game and I was trying to make a bunch of status effects. I've done pretty much all of them, but I'm stuck on one in particular. A petrify and stone state. I imagine it working similar to the petrify and stone status effects from Final Fantasy XII, so if you're not similar with the status, here is a rundown.

When you get inflicted with petrify, a timer starts. Since MV isn't in real time like in FF12, we can just replace this with a turn counter. Petrify is harmless at first, but once the timer gets to zero, your character is inflicted with stone and is treated as dead. (cannot participate in battle) The only way to remove stone is to get a full heal at a save point/inn (for RPG Maker) or use a gold needle. Stoned characters cannot be restored with revival spells like raise and arise.

I already have the stone status figured out. I have a "death states" plugin which causes any state to become a death state. Then I just need to have the state be only be healed by a gold needle and I'm done. However the tricky part is the petrify state. I'm not sure how to do this but I think you can use lunatic commands or another plugin to turn one state once it ends into another state. Does anyone have a plugin for that? Thanks.

-KrimsonKatt
Assuming you're using Yanfly's Buffs and States Core plugin (since you mentioned lunatic commands), adding a state when a different state expires is a piece of cake.

On your countdown state, just add the following note tag:

Code:
<Custom Leave Effect>
    this.addState(x)
</Custom Leave Effect>
Change the x to the stateId (the id number on the left side of states tab) for your petrify state. When the state is removed due to running out of turns, it will add the petrify state instead.

Side note: I think 'this' should work, but if it doesn't, try 'user' or 'target' instead.

The custom leave effect is only triggered if the state runs out of turns. If it is removed, or cured, or the battle ends, it will do nothing, so it's perfect for this use.
Additionally, here is the link to Yanfly tips and tricks for Doom state. Basically just some extra stuff on top of what ramza posted. But a video is provided to explain how the state works, and you see it in action.
@ramza Thank you for the tips! It helps a lot!

@HumanNinjaToo I already have Yanfly's doom state in my game, but thanks for helping anyways!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-a-petrify-stone-states-like-in-ff12.120820/