MV Disable Skill Variance on Critical

Hi hello!

I was wondering if there is a way to tell RPG Maker MV to disable a skill's "Variance" on a crit? I'm totally fine with the swingy degree of min/max damage on a normal hit, but I would love for all crits to be something like "max damage * 1.5" without the variance of the skill being involved.

I'm using most of Yanfly's plugins for MV, and while they do offer a lot of customization of formulas and whatnot, none offer functionality to disable or ignore a skill's variance setting when a crit lands.

I've tried poking around the forums/reddit/Steam/etc but no one seems to have ever asked about this, or SEO is getting in the way of me coming up with the right combination of words to find anyone who has asked a similar question.

I'd imagine there's a way via JS to accomplish this, but thought I'd ask folks here first before I continue down this rabbit hole. Do any of you know a way in the damage formula to write an "if" statement that says "if this is a crit, disable variance and do [this new equation]" or does anyone know of a plugin that addresses this specific issue?

Thanks in advance for your time!
I'm using most of Yanfly's plugins for MV, and while they do offer a lot of customization of formulas and whatnot, none offer functionality to disable or ignore a skill's variance setting when a crit lands.
if youre using yanfly's damage core, it lets you do that. the damage steps plugin parameters outlines the entire damage calc process and lets you alter it through the editor. you would have to add a conditional towards the end to not apply variance if the current hit was determined to be critical
Assuming suitable timing, you can check target.result().critical. This assumes that target refers to the skill's target. (By default the critical flag is set immediately before the damage formula is evaluated.)

To affect all skills equally, @Robro33's suggestion seems most convenient. In my old copy of YEP_DamageCore it looks like variance is applied in Damage Step 90 (plugin parameter) by default:
JavaScript:
value = this.applyVariance(value, item.damage.variance);
You could change that to be conditional, e.g.
JavaScript:
if (!target.result().critical) value = this.applyVariance(value, item.damage.variance);
I.e. "if the result is not (!) a crit, then apply variance".

Alternatively, for a per-skill thing you could set the Variance to 0% and manually apply randomness in the damage formula when appropriate. E.g. for a skill with formula like this:
JavaScript:
a.mat * 2 - b.mdf
...you could instead do this:
JavaScript:
var r = a.mat * 2 - b.mdf; b.result().critical ? r : this.applyVariance(r, 20);
I.e. "if the result is a crit, return the base formula value; otherwise, apply 20% variance". The usual modifiers (crit multiplier, element rate, guard reduction, etc) will apply as usual.
if youre using yanfly's damage core, it lets you do that. the damage steps plugin parameters outlines the entire damage calc process and lets you alter it through the editor. you would have to add a conditional towards the end to not apply variance if the current hit was determined to be critical
I feel very silly for not thinking of utilizing damage steps! Haha, had my brain way too focused on the literal problem of turning on/off variance that I wasn't considering the wealth of options I have with Yanfly's plugins. I'll give this a shot and see if I can get the crit damage I crave 🙂

Assuming suitable timing, you can check target.result().critical. This assumes that target refers to the skill's target. (By default the critical flag is set immediately before the damage formula is evaluated.)

To affect all skills equally, @Robro33's suggestion seems most convenient. In my old copy of YEP_DamageCore it looks like variance is applied in Damage Step 90 (plugin parameter) by default:
JavaScript:
value = this.applyVariance(value, item.damage.variance);
You could change that to be conditional, e.g.
JavaScript:
if (!target.result().critical) value = this.applyVariance(value, item.damage.variance);
I.e. "if the result is not (!) a crit, then apply variance".

Alternatively, for a per-skill thing you could set the Variance to 0% and manually apply randomness in the damage formula when appropriate. E.g. for a skill with formula like this:
JavaScript:
a.mat * 2 - b.mdf
...you could instead do this:
JavaScript:
var r = a.mat * 2 - b.mdf; b.result().critical ? r : this.applyVariance(r, 20);
I.e. "if the result is a crit, return the base formula value; otherwise, apply 20% variance". The usual modifiers (crit multiplier, element rate, guard reduction, etc) will apply as usual.
Thank you so much for taking the time to call all of this out and suggest direct actions to take. This is really helpful.

I'm just now getting to sit back down and work on things again, so I'll see what progress I can make using your suggestions.

I appreciate both of you for helping me think a little bit deeper here 😀

Original thread: https://forums.rpgmakerweb.com/threads/disable-skill-variance-on-critical.180348/