I want to set agility affect critical chance and dodge chance

Ahhh i am so dumb, i have tried many ways but all have failed!
I don't know how to do this, so I want to ask how to:

1, set Crit.Chance+ = (a.agility - b.agility)*0.1

2, set Dodge.Chance+ =(a.agility - b.agility)*0.05

help!
You'll need a plugin that changes how the crit/evasion chances are calculated. This might work:
Spoiler: Click to view code
JavaScript:
/*:
 * @plugindesc Changes action crit/eva formulae.
 * @author Caethyril
 * @help Free to use and modify.
 */

(function(alias) {
  Game_Action.prototype.itemCri = function(target) {
    return alias.apply(this, arguments) + (this.subject().agi - target.agi) * 0.1;
  };
})(Game_Action.prototype.itemCri);

(function(alias) {
  Game_Action.prototype.itemEva = function(target) {
    return alias.apply(this, arguments) + (this.subject().agi - target.agi) * 0.05;
  };
})(Game_Action.prototype.itemEva);
To use it:
  1. Copy the code into a text editor (e.g. Notepad);
  2. Save as a .js file (Save As > File Type: All Files, Filename: whatever.js);
  3. Import into your project as a plugin, via Tools > Plugin Manager;
  4. Save your project to apply plugin changes;
  5. Test! 👋
thank you! It works!
After some test, i can see my formula is super imba, but i can change it from here!

Spoiler: balanced formula code
(function(alias) {
Game_Action.prototype.itemCri = function(target) {
return alias.apply(this, arguments) + (this.subject().agi - target.agi) * 0.001;
};
})(Game_Action.prototype.itemCri);

(function(alias) {
Game_Action.prototype.itemEva = function(target) {
return alias.apply(this, arguments) - (this.subject().agi - target.agi) * 0.0005;
};
})(Game_Action.prototype.itemEva);

I have changed the parameter for balancing purpose
and i have changed the "+"/"-" for the dodge chance, because i had mistaken that as "HitChance" in my requirement post.

cheers!!
You're welcome! If you wanted to change the hit formula instead of the eva formula, replace itemEva with itemHit. (Or make a third block for that one if you want to change both.)

Happy RPG Making~ 😂
You're welcome! If you wanted to change the hit formula instead of the eva formula, replace itemEva with itemHit. (Or make a third block for that one if you want to change both.)

Happy RPG Making~ 😂
Hello, Caethyril. Can you improve your great formula? I have some problems with this. -> If AGI of my main char < AGI of Target char, then healing potion don't work correctly (its missing sometimes, i mean)!!! Thanks!

upd. I think I have solved this problem))

(function(alias) {
Game_Action.prototype.itemCri = function(target) {
return alias.apply(this, arguments) + (this.subject().agi - target.agi) * 0.05;
};
})(Game_Action.prototype.itemCri);

(function(alias) {
Game_Action.prototype.itemEva = function(target) {
if (this.isPhysical()) {
return alias.apply(this, arguments) - (this.subject().agi - target.agi) * 0.05;
} else {
return 0;
}
};
})(Game_Action.prototype.itemEva);
Necro-post notice: @jerzy861

Original thread: https://forums.rpgmakerweb.com/threads/i-want-to-set-agility-affect-critical-chance-and-dodge-chance.134183/