RMMV skill success based on control variable

Is there a way to make a skill's chance of success dependant on a control variable? For example:
Control variable x=4 100%chance of success
Control variable x= 3 75% chance of success
Control variable x= 2 50% chance of success
Control variable x= 1 25% chance of success
Control variable x= 0 0% chance of success​

Original thread: https://forums.rpgmakerweb.com/threads/rmmv-skill-success-based-on-control-variable.91117/