- Joined
- Jul 2, 2014
- Messages
- 8,837
- Reaction score
- 6,646
- First Language
- English
- Primarily Uses
- RMMV
Custom Hit Formula 1.0
ATT_Turan
ATT_Turan
Introduction
As far as I know, there's still no plugin written with the ability to provide a custom hit formula in MZ, and I got tired of telling people that
(apparently caethyril actually had one and I didn't know about it! Well, now you can try both and tell us who you like better. It should be me.)
So I wrote this to allow for custom hit formulae globally and/or per skill.
I tested the basic functions, please let me know if you run into any errors. Because it was necessary to modify code in the middle of the Game_Action.apply() function, this may cause conflicts with other plugins that modify the same function.
I will consider making compatibility patches if the other plugin is free to use and unobfuscated. Otherwise, other authors are free to modify this code to make it compatible with theirs so long as I am still credited.
You may use this plugin to bypass MZ's default hit formula (a percentile check against the attacker's hit rate). You can redefine one universal formula to supplant it, modify it at the skill level, and decide whether evasion is checked separately.
The default behavior of the engine is to determine a hit and then check for evasion or magic evasion, depending on the skill type. You can choose to bypass this behavior in order to incorporate the eva/mev parameters into your formula (or to disregard them).
The hit formula notetags and plugin parameter function identically; the notetags will always override the plugin parameter, and the parameter is set to MZ's built-in calculation by default. So this plugin is as plug-and-play as the user desires, with the ability to change the hit calculations on just one or few skills if that's all that's required.
The default behavior of the engine is to determine a hit and then check for evasion or magic evasion, depending on the skill type. You can choose to bypass this behavior in order to incorporate the eva/mev parameters into your formula (or to disregard them).
The hit formula notetags and plugin parameter function identically; the notetags will always override the plugin parameter, and the parameter is set to MZ's built-in calculation by default. So this plugin is as plug-and-play as the user desires, with the ability to change the hit calculations on just one or few skills if that's all that's required.
Use the following notetag in the notebox of your skills:
<hitformula: your_formula_here>
The formula can be any valid JavaScript expression. An evaluation of "true" means the skill will hit, whereas "false" is a miss.
The below example is fashioned after the D20 system, adding d20 + level and comparing it to the target's Defense:
<hitformula: Math.randomInt(20)+1+a.level >= b.def>
Included variables are the same as those listed in MZ's damage formula.
<hitformula: your_formula_here>
The formula can be any valid JavaScript expression. An evaluation of "true" means the skill will hit, whereas "false" is a miss.
The below example is fashioned after the D20 system, adding d20 + level and comparing it to the target's Defense:
<hitformula: Math.randomInt(20)+1+a.level >= b.def>
Included variables are the same as those listed in MZ's damage formula.
Terms and Credits
Free for non-commercial and commercial use. Credit ATT_Turan.
Attachments
Last edited: