For Fire Emblem-based criticals, if you're interested. This also involves hit rates, because they have to pass for criticals to happen.
Turn on a switch on Pre-Battle event and turn it off on Post-Battle event. Use that same switch for below.
YEP_HitAccuracy
------------------
First, I suggest doing this for the first two, accuracy applies before evade is factored.
Accuracy: 1
Evade: 1 - (skillHitRate * (userHitRate - targetEvadeRate))
Now under User Hit Rate / Target Evade Rate, use this below and place at the very front of any code you got.
User Physical Hit / Magical Hit:
Code:
$gameSwitches.value(x) === true && user._hitChanceRoll <= user._hitChance ? 1.00 : $gameSwitches.value(x) === true && user._hitChanceRoll > user._hitChance ? 0.00 : user.hit
User Physical Evade / Magical Evade:
Code:
$gameSwitches.value(x) === true && user._hitChanceRoll <= user._hitChance ? 0.00 : $gameSwitches.value(x) === true && user._hitChanceRoll > user._hitChance ? 1.00 : target.eva
YEP_X_CriticalControl
----------------------
Place at the very front as well.
Critical Rate Formula:
Code:
$gameSwitches.value(x) === true && user._crtChanceRoll > user._crtChance ? 0.00 : $gameSwitches.value(x) === true && user._crtChanceRoll <= user._crtChance ? 1.00 : user.cri - target.cev;
YEP_X_ActionSequences
--------------------------
Insert this on setup action notetag, and adjust your sequences how you see fit. You want to know if you've activated a critical.
<setup action>
eval: user._hitChanceRoll = Math.randomInt(100) + 1;
if (user._hitChanceRoll <= user._hitChance)
eval: user._crtChanceRoll = Math.randomInt(100) + 1;
end
if (user._crtChanceRoll <= user._crtChance)
animation x: user
wait for animation
wait: 2
end
</setup action>
SRPG Troop Event
--------------------
Make sure Turn 0 is checked and insert this in the script box:
Code:
if ($gameSwitches.value(x) === true) {
var user = $gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1]; var target = $gameSystem.EventToUnit($gameTemp.targetEvent().eventId())[1];
user._hitChance = Math.max(0, Math.min(100, parseInt(parseFloat(Math.round(user.action(0).itemHit(target) * 100))) - parseInt(parseFloat(Math.round(user.action(0).itemEva(target) * 100)))));
user._crtChance = Math.max(0, Math.min(100, parseInt(parseFloat(Math.round(user.action(0).itemCri(target) * 100)))));
if (target.currentAction() && target.canUse(target.currentAction().item()) === true) {
target._hitChance = Math.max(0, Math.min(100, parseInt(parseFloat(Math.round(target.action(0).itemHit(user) * 100))) - parseInt(parseFloat(Math.round(target.action(0).itemEva(user) * 100)))));
target._crtChance = Math.max(0, Math.min(100, parseInt(parseFloat(Math.round(target.action(0).itemCri(user) * 100)))));
}
}
Also, find the DrawSrpgBattleHit (and the Critical one) in Srpg_core and comment that Math.floor code out and use this.
Code:
this.drawText(parseInt(parseFloat(Math.round(val * 100))) + '%', x + 64, y, 64, 'right');
You can test it by giving some actors very high critical rates and see for yourself.