I would like Magical Attack hit types to be affected by the actor's hit rate.
MZ Magical Attack Hit Rate
JS Plugin RequestsAlright, you have my permission to do that.
Joking aside, if you're using VisuStella's plugins you can incorporate this fairly easily in the battle core parameters.
Joking aside, if you're using VisuStella's plugins you can incorporate this fairly easily in the battle core parameters.
Hey, now it works!

I've been using VisuStella's plugins, though, I haven't been able to figure out how to incorporate this with their plugins.
In the Core Engine "Quality of Life Settings", I enabled the accuracy formula. I tested a Magical Hit skill with an actor that has a 0% hit rate, against a target with no evasion traits. The Magical Hit always hits, while Physical Hits miss.
Was there another option I'm missing in their plugins?
The accuracy formula setting won't do what you're looking for as it just adjusts the existing one for physical hits. What you'll need to do is add some code to the JS: Pre-Damage parameter in Battle Core to recalculate whether it hits if it's magical.
I see. Do you happen to have suggestions for code to create this? I've searched the engine's code for code that determines hit rate, but I haven't been successful.
Try
JavaScript:
if (this.isMagical()) {
const result = target.result()
result.missed = result.used && Math.random() >= this.itemHit(target);
}
Unfortunately, it did not work. I tested the following:
Actor with 1% hit rate used a Magical Attack skill on an enemy with no evasion bonuses. The actor consistently hit the target, despite the 1% hit rate.
I'll have a play with it myself when I'm able and see if I can't whip up something that works.
Bump
Hi! I would really appreciate some solution in this matter too... I'm also trying to implement a new Magic Hit Rate and to have more control over the Accuracy formulas, but VisuStella only allows the QoL setting to "Accuracy formula" true or false in the CorePlugin.
Also, I'm grasping to understand how the VisuStella QoL setting of "Accuracy Boost" works too... Could you help me guys?
Thanks in advance!
Also, I'm grasping to understand how the VisuStella QoL setting of "Accuracy Boost" works too... Could you help me guys?
Thanks in advance!
So I believe Trihan was mistaken in his suggestion above - unless he knows something I don't, I don't see how his result would get used by the engine.
But it's pretty simple to overwrite the default functions to do this. From the game code:
Code:
Game_Action.prototype.itemHit = function(/*target*/) {
const successRate = this.item().successRate;
if (this.isPhysical()) {
return successRate * 0.01 * this.subject().hit;
} else {
return successRate * 0.01;
}
};
You can simply add magical attacks, so:
Code:
if (this.isPhysical() || this.isMagical()) {
So change that bit, save the entire function in a .js file, include it as a plugin.
The first part of your question was at least germane to this thread, even if it was technically necro-posting - this part has nothing to do with this other user's thread. Please start your own to ask different questions.
Oh! Thanks Turan! Firstly, sorry for the necroposting... I was searching for topics in the subject of Accuracy and found this one that was exactly the same I want to achieve! About the other question, I'll create a new topic for it! Thx!
I may use this suggestion but firstly creating a new custom parameter for Magic Hit Rate with Hakuen plugin and then in this case I'll use something like:
I still need to figure how to call the custom parameter from the plugin instructions, but I thing it can work...
And a final question: when I made this as a plugin and activate it on RMMZ, it will deactivate the Game_Action.prototype.itemHit from core entirely, correct?
I may use this suggestion but firstly creating a new custom parameter for Magic Hit Rate with Hakuen plugin and then in this case I'll use something like:
JavaScript:
Game_Action.prototype.itemHit = function(/*target*/) {
const successRate = this.item().successRate;
if (this.isPhysical()) {
return successRate * 0.01 * this.subject().hit;
} else
if (this.isMagical()) {
return successRate * 0.01 * this.subject().magichit;
} else
{
return successRate * 0.01;
}
};
I still need to figure how to call the custom parameter from the plugin instructions, but I thing it can work...
And a final question: when I made this as a plugin and activate it on RMMZ, it will deactivate the Game_Action.prototype.itemHit from core entirely, correct?
Original thread: https://forums.rpgmakerweb.com/threads/magical-attack-hit-rate.143572/