Trying to make the chance a state is inflicted tied to a variable in battle

I found this tutorial:

But it only works for straight up damage dealing.

What I need is for the chance of the spell working to be tied to a variable instead of the success rate in the spells page
You can use Yanfly's action sequences which allow for IF conditionals.
1) Set another variable (RandRoll) to random roll 0-100
2) Compare it to your success rate variable (SuccRate): If RandRoll < SuccRate
3) If true, play the action animation, effects etc
4) else nothing happens, all sprites return to normal position

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-make-the-chance-a-state-is-inflicted-tied-to-a-variable-in-battle.107470/