State Fails, Add Another?

There's probably not way to do this without a script, but I thought I'd ask.

Does anyone know if there's a way to apply a State after another State fails? So, say I have a skill that applies Charm, but only at a 65% chance. Then, if Charm fails, it applies Slow at a 100% chance. If Charm is applied, Slow is not.

Is that possible using the damage formulas? Or should I inquire over at the Script request board?

Thanks!
You can enter this into the damage formula (BEFORE your damage calculation) but it will completely bypass luck effects (which are ridiculously small anyway) AND state rates. It will respect state resistance (trait) and order of state restrictions. (Replace charmStateId and slowStateId with the correct numbers.)

Code:
(Math.random() < 0.65) ? b.addState(charmStateId) : b.addState(slowStateId);

Note also that putting an addState command into your damage formula means that if the state can be removed by damage, it may be removed by the damage done by the skill (the same chance as the "remove by damage" chance in the state).

If you need to avoid this last behavior, you'll need to look for a plugin.
This is great! Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/state-fails-add-another.91082/