Changing how critical rate, hit ratio and evade are calculated

Hi everyone,


I was wondering if someone knew of a way to add a stat influence over the aforementionned parameters. For exemple, I want to add 20% of agi to the base evade and 20% of luck to crit rate.


BTW I mostly use Yanfly scripts and I am aware of the extra param formula script. Turns out it doesn't work well with the way stats work in my project and when I tried it, all attacks were misses or evade, no matter what I did (and before someone asks, yes I had Hit % set on my actors/battlers).


I would rather just modify the formulas for calculations of evade, crit rate and hit% in the core script but cannot for the life of me figure out how to go about it. I am not able to write scripts but have enough scripting knowledge to edit/tweak scripts to my needs most of the time. But now, I would need some help about that! 🙂


Alternatively, if someone knows of a way to use yanfly extra parameter and still hit normally that would also do it for me...


Thanks in advance!
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.
In Game_Battler, you can see the following methods:


- item_hit


- item_eva


- item_cri


That is where you can directly write your own hit/eva/cri formulas.


You will see that all of those methods got a 'user' argument. In order to get the user's AGI, you can use 'user.agi', for example.


Most of the stuffs happening in those methods are self explanatory, I think, but feel free to ask if you can't get it to work your way.


Yanfly's Extra Params script should work, btw. I used it and it did what I wanted.


You most probably did not write the formula right in the script, which is, honestly, not surprising, because it is not explained well what those 2 settings actually do for each stats.


If I remember right, you will need to use "agi * 0.2" for the ':eva_n_value' setting and use "base_eva + n" for the ':eva_formula' setting. This should add 20% of the user's AGI to  hit rate.


You can follow the same format for all of your settings too.
Question: When you state...

For exemple, I want to add 20% of agi to the base evade and 20% of luck to crit rate.

...did you implement this as "agi * 0.2"?


The thing to note about ex-parameters and sp-parameters is that they're based on a percentage value, using 1 to represent 100%. So an evasion chance of 5% is really a EVA value of 0.05.


If you didn't compensate for this and used "agi * 0.2", then even an Agility of 5 would result in 100% Evasion. The default hit calculation determines hit and evasion separately, so an Evasion of 100% would result in all attacks never hitting.


If that's the problem, then you just need to reduce the stat modifiers to an appropriate number by dividing by 100. For 20% of AGI added to EVA, you would use "agi * 0.002". For example, an Agility of 62 would give 0.124, or 12.4%.
Ohh, yeah, I forgot that it takes 1.0 as 100% for X/S-params. *-*


It should indeed be "agi * 0.002".
Thanks a lot to both of you for your answers! I indeed used "agi * 0.2" so that explains why all attacks always missed...I'll do some tests with "agi * 0.002" and see what it does, but I'm quite confident it should do the trick!


EDIT: Tested it and it works just fine! Thanks a lot, problem solved! 😉

Original thread: https://forums.rpgmakerweb.com/threads/changing-how-critical-rate-hit-ratio-and-evade-are-calculated.56015/