How can i alter the successrate of a skill in the damage formula?

Currently working on a damage formula:

x = (Math.randomInt(20) + 1); if (x >= 20) { ((Math.randomInt(8) + 1) * 2) +((a.level / 5) + 2) +((a.atk - 10) /2);} else if (x + ((a.atk - 10) / 2) + ((a.level / 5) + 2) <= b.def) { 0 ; } else { (Math.randomInt(8) + 1) + ((a.atk - 10) / 2) + ((a.level / 5) + 2); }

Got critting coverd though im still trying to figure out how i can make it appear onscreen like this(not realy important and can live without but still).
Normal hit dont but that leaves...

(x + ((a.atk - 10) / 2) + ((a.level / 5) + 2) <= b.def) { 0 ; } refers to a attack missing but currently it deals damage. True its 0, but 0 damage is as far i know a hit.
The damage formula only gets eval'd AFTER a confirmed hit.
Changes to hit or success can't be placed inside the damage formula as a result.
You'll need a plugin to change that sequence.
'General Discussion' is for looking at some of the broader issues of game making. "How do I...?" questions belong in the Support forum for the engine you are using.

I agree with Andar that you'll need a plugin so...

Moved to: JS Plugin Requests

Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-alter-the-successrate-of-a-skill-in-the-damage-formula.83416/