Get the remaining turns of a specific state in the damage formula

I want to create a skill that has a damage scales with the remaining turns of a specific state. For example, the more turns of sleep remaining an enemy has, the higher the damage it will receive from the skill "Dream Eater".

I know how to deal extra damage to an enemy with a specific state, it's like "(b.state?(6) ? 8 : 4) * a.mat / b.mdf". However, I can't seem to figure out how to get the remaining turns of a state in the damage formula.

Does anyone know if it is possible to do so in the damage formula? Or must I edit some script? And how?

Thank you.
can you please confirm which maker you're using?
Your profile says that you primarily use VXA, but you posted this in VX-forum.
and there are a lot of differences between those two makers.
can you please confirm which maker you're using?
Your profile says that you primarily use VXA, but you posted this in VX-forum.
and there are a lot of differences between those two makers.
Ah... Silly me. You are right. I post it on the wrong forum. Lucky that you are perceptive.😅
I've reported this post as wrong forum.

I've moved this to VXAce Support.

Original thread: https://forums.rpgmakerweb.com/threads/get-the-remaining-turns-of-a-specific-state-in-the-damage-formula.126167/