Yanfly Critical Core: Using a character parameter to help determine critical rate

Morning everyone!

Now that Yanfly has a plugin for criticals, I am wondering if there's a way to get criticals to be based not just on ex-parameters but also influenced by base parameters as well. Currently, I am using

rate = (user.mdf/2 + user.cri)/100 * (1 - target.cev+target.luk/2)/100;This turns half of the user's dexterity into part of the percentage to be used for the critical rate. Furthermore, I have adjusted the target's rate to include half the target's luck and I also have it as a percentage.

Unfortunately, I can't land a critical at all.

If I remove the 100 from the target rate, all attacks on my party become criticals.
I think your parentheses are lacking and you are creating a negative number

With an Crit evasion rate of 0 and luck of 50

(1 - target.cev+target.luk/2)/100

evaluates to (1 - 25 ) / 100 or  -24%

if you use this isntead

1 +  (target.cev+ (target.luk / 2)  )  / 100)

1 +  0.25 = 1.25

I'm pretty sure you don't want either of those however. Also you are using magic defense and not agility.
Well, I renamed magic defense as dexterity. Looking at the Fire Emblem wiki for answers, I changed my formula to this:

rate = (user.cri + user.mdf/2)/100 - 1 + (target.cev + (target.luk/2))/100;Not gaining any critical hits from this one.

I think your parentheses are lacking and you are creating a negative number

With an Crit evasion rate of 0 and luck of 50

(1 - target.cev+target.luk/2)/100

evaluates to (1 - 25 ) / 100 or  -24%

if you use this isntead

1 +  (target.cev+ (target.luk / 2)  )  / 100)

1 +  0.25 = 1.25

I'm pretty sure you don't want either of those however. Also you are using magic defense and not agility.
EDIT

I tried your formula and this error occurs as well:

SyntaxError: Unexpected token )at Game_Action.applyItemCriticalRate (YEP_X_CriticalControl.js:601)at Game_Action.itemCri (YEP_X_CriticalControl.js:585)at Game_Action.apply (rpg_objects.js:1655)at Game_Action.apply (YEP_BattleEngineCore.js:2361)at Game_Action.apply (ellye's_atb.js:1411)at Game_Action.apply (YEP_BattleAICore.js:653)at Game_Action.apply (YEP_SkillCore.js:733)at Function.BattleManager.invokeNormalAction (rpg_managers.js:2181)at Function.BattleManager.invokeAction (YEP_BattleEngineCore.js:1299)at Function.<anonymous> (YEP_BattleEngineCore.js:1839)UPDATE: Using 

rate = (user.mdf/2 + user.cri)/100 * 1 + ((target.cev+ (target.luk / 2) ) / 100);Seems to mostly work, except that enemies, without any critical rates, seem to always crit. Otherwise, my characters with crit rates rarely crit.
Your problem is that parameters like MDF and LUK are not handled the same way as EX-parameters like CRI and CEV. Parameters are simple integer values, but EX-parameters are percentages and treated as 100% = 1. If you have 5 MDF, then that's simply 5 MDF—but 5% CRI is 0.05 CRI, not simply 5 CRI.

This formula should work properly:

Code:
rate = (user.mdf/200 + user.cri) * (1 - target.cev + target.luk/200);
Your problem is that parameters like MDF and LUK are not handled the same way as EX-parameters like CRI and CEV. Parameters are simple integer values, but EX-parameters are percentages and treated as 100% = 1. If you have 5 MDF, then that's simply 5 MDF—but 5% CRI is 0.05 CRI, not simply 5 CRI.

This formula should work properly:

rate = (user.mdf/200 + user.cri) * (1 - target.cev + target.luk/200);
Sounds just about right. Thanks lilyWhite. How should I go about crediting you?
Sounds just about right. Thanks lilyWhite. How should I go about crediting you?
Oh, there's no need to credit me for anything. X3
Oh, there's no need to credit me for anything. X3
Then I'll credit you in my Special Thanks section.  😉

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-critical-core-using-a-character-parameter-to-help-determine-critical-rate.49970/