Have critical rate + evasion rate be based on the difference between your Agility and the target's.

Hello hello!
So I'm creating a game where turn order doesn't matter whatsoever, which makes Agility completely useless. I want to have a system where if an actor has a much higher agility than the enemy, they are more likely to crit / dodge their attacks.
I have tried using Yanfly's Extra Parameter Plugin, with this formula:


Math.min((base + plus) * rate + flat ) * (a.agi / b.agi) , 80)

For the evasion rate - essentially, lets say the first part of the formula came out to 10%, it would then be multiplied by a.agi / b.agi - if your agility was 5x that of the opponents, then your evasion rate would be 50%. If it was half that of the opponents, it would be 5%.

However, this seems to have no effect once in game. I imagine it's probably due to the use of adapting values (b.agi) within a formula that may not get updated?

If anyone has a fancy solution it'd be much appreciated 🙂
i imagine either the b.agi is causing an error and its defaulting to some value, or Yanfly added a "b" variable and it is just a reference to the same battler "a" does.

you wouldnt want be adjusting the xparam since that is only ever used with the single battler as its context. youd want to be looking at Game_Action.itemHit() and Game_Action.itemCri() as thats where the calculation for hitting and critting actually takes place and uses both battlers involved. yanfly's critical control and hit accuracy plugins do each.

Original thread: https://forums.rpgmakerweb.com/threads/have-critical-rate-evasion-rate-be-based-on-the-difference-between-your-agility-and-the-targets.177208/