Critical hit depends on hit roll?

I am now using Yanfly ExtraParam, Hit Accuracy and Critical Control plugins.
I set my HIT roll formula to Math.randomInt(20)+1+user.ATK-target.DEF

But how to set the hit is always critical if Math.randomInt(20)+1 equal to 20 ?
var = math.randomint(x)
var == 20 ? setcritical
result = var+user.atk-target.def
return result

use a pivot variable.
Sorry, not fully understand the meaning of "setcritical"
Is it mean that set user.cri=100 ?

Also, I also want to set if the roll equal to 1, it represents always miss.
Is the simplest way is to set user attack=0 and target defense greather than 0 ? Like:
if math.randomint(x)+1 ==1 then user.atk=0 & target.def=100 ?
you do whatever you need to calculate that critical.
my point was, use an auxiliary variable, evaluate that variable, and then use it to construct a result.
If so, will the character have a chance to deal double critical?

e.g. A character base critical change is 5%.
If he rolls 20, his attack is guarantee critical, and more damage is applied.
But he still have a chance to get a extra 5% critical.

Is the logic works in this way?

Original thread: https://forums.rpgmakerweb.com/threads/critical-hit-depends-on-hit-roll.99674/