Script Request - Conditional States

Good morning / Afternoon / evening , everyone.

I am in need of your assistance once again.

How difficult it would be to create a script in which you can create states that only activate if a battler is under certain conditions,

For example: When a battler is given a state, but this state's effect ONLY activates once he/she is low on HP.

Any help would be appreciated.
tsukihime has several scripts that might help in this
tsukihime has several scripts that might help in this
I think I found the script called conditional states which lets you do this... but it requires you to write the forumla and I'm having trouble setting it up.

How do I make it so that the state only activates it's effect when a character is low on HP?

I wrote it like this but I don't think this is correct...


<conditional state>
if a.hp? (<20%)
13
else
nil
end
</conditional state>
I don't think this is correct
I don't think so either.
I would say the ?() is for the state option as it is calling the State? method and returning a true or false.
You want to check against hp at a specific point, so maybe
Code:
 <conditional state>
        if a.hp < (a.mhp * 0.20)
            13
        else
            nil
        end
    </conditional state>

Original thread: https://forums.rpgmakerweb.com/threads/script-request-conditional-states.133228/