Looks like I am a little late...that's what I get for starting on something early in the morning and coming back to it again later without checking if it was resolved while I was away...
🙂
I didn't know about the Victor Engine plugin either and it will probably work well, but if you do have any issues, I successfully tested the two alternate options below in a new project.
1)
If you have Yanfly's HitAccuracy Plugin, you can use the following code in the Accuracy Formula Paremeter:
Code:
if (item.id == x) {(1 - $gameVariables.value(x) / 100) * skillHitRate * (userHitRate - targetEvadeRate);} else {skillHitRate * (userHitRate - targetEvadeRate);}
Where it says "item.id == x" the x will need to be changed to the id of whichever skill you are using for your game, and where it says "$gameVariables.value(x)" the x will need to be changed to the id of whichever game variable you are using for the skill. Right now, every time the variable is increased by 1 the accuracy will decrease by 1%, to a maximum of zero accuracy (impossible to hit) when the variable reaches 100. Increasing the 100 in the formula will make the accuracy decrease more slowly, while decreasing the 100 will make the accuracy decrease faster. You could also come up with any other formula you want to replace (1 - $gameVariables.value(x) / 100) as long as it comes out to a number between 0 and 1.
2)
If you do not have access to the Yanfly plugin or do not want to deal with the changes it makes to how accuracy works in your game, the following plugin will also achieve a similar result:
Spoiler: Plugin
Code:
//=============================================================================
// MTC_CustomAccuracyFunction.js
//=============================================================================
/*:
@plugindesc Allows accuracy of a skill to decrease with a game variable
@author Matrien Cadrack
@help
This plugin rewrites the accuracy function to make the accuracy of a specific
skill decrease as a specific game variable increases.
Users must designate the relevant skill and variable ids by manually entering
them at the proper points within the plugin code (help found within
code).
*/
Game_Action.prototype.itemHit = function(target) {
if (this.item() == $dataSkills[x]) {
// Replace "x" in line above <$dataSkills[x]> with desired skill id
if (this.isPhysical()) {
return this.item().successRate * 0.01 * this.subject().hit * (1 - ($gameVariables.value(x) / 100));
// Replace "x" in line above and two lines below <$gameVariables.value(x)> with desired game variable id. With the
// exisiting formula, every time the variable is increased by 1 the accuracy will decrease by 1%, to a maximum of
// zero accuracy (impossible to hit) when the variable reaches 100. Increasing the 100 in the formula
// <(1 - ($gameVariables.value(x) / 100))> will make the accuracy decrease more slowly, while decreasing the 100 will
// make the accuracy decrease faster.
} else {
return this.item().successRate * 0.01 * (1 - $gameVariables.value(x) / 100);
}
} else {
if (this.isPhysical()) {
return this.item().successRate * 0.01 * this.subject().hit;
} else {
return this.item().successRate * 0.01;
}
}
};
It works essentially the same as the option above, but fits within the standard accuracy functionality of RPG Maker. It does rewrite the accuracy function, which means it could potentially create problems if you happen to have any other plugins that use/modify this function.