Why are my Potions missing when they're "certain hit?"

All my healing items (potions, high potions ect) sometimes miss for seemingly no reason, even when I mark them "certain hit." I even misses in menus! What is going on? I'm using a custom hit formula that takes Luck (renamed to Skill in my game) into account, so maybe that's it? Please help!
Do you have your potions set SUCCESS parameter to 100%?

If yes, then perhaps you have installed a plugin that alters certain hit param.
no, luck can't have anything to do with it - not unless one of your plugins changed the engine.

there are several possibilities of what can have happened - the parameter above or a bad formula or problems with traits and so on.
to really help we need to see a screenshot of an example item where that happens - and if that has no problems, then screenshots of an actor and class where it happens.
@Soulrender @Andar My success rate for all my items is set at 100%. I am indeed using a plugin in order to have a custom hit formula. That's what I meant by using Luck to determine Hit Rate. To be exact, I'm using Yanfly's HitAccuracy plugin and am using a custom hit and evade formula. The hit formula is (skillHitRate + (a.luk / 100) / 2) * (userHitRate - targetEvadeRate) and the evasion formula is (targetEvadeRate + (a.luk / 100) / 2) * (userHitRate + skillHitRate) Can someone please tell me if this formula is causing problems and if so, I better formula I can use to take LUK into account in determining Hit and Evasion rate? Thanks.

Here is a screenshot
Potion Stat Page.PNG
You could try instead using in your formula a.luk, use user.luk.
Second thing, do you have changed these parameters to something else?
No, I have not changed those parameters. I believe they are the same as before. I change it to user.luk to see if anything changed. Thanks for the help!

Edit: Can confirm the parameters you outlined have not been changed.
I have almost all Yanfly's plugins and I've noticed he likes to use that variables like:
user, target, ally, foe etc.
The potions still miss! I don't know what the problem is! They're also certain hit! What is going on?
try default formula:

skillHitRate * (userHitRate - targetEvadeRate)
The hit formula is (skillHitRate + (a.luk / 100) / 2) * (userHitRate - targetEvadeRate)
If you do the math on that formula with your characters' stats, you can figure out what the hit frequency should be.

If the user's Luck is 30, for example, the user's Hit Rate is 75%, and the target's Evade Rate is 0% (or is ignored, which it might be because Certain Hit is selected), then your actual hit frequency should be (100% + 30%/2) * (75% - 0%) = 115% * 75% = 86.3%. Not 100%. Despite your item being 100% Success and Certain Hit, it could still miss under these conditions, because your user's HIT is well under 100%.

To rule out other causes, you could try just setting the hit formula to a straight 100% (which I think would be written as 1.00 but it might need to be 100).
OK, first a bit of trivia/clarification...by default the hit types work like this:
  • Physical: hit = success rate * user HIT; evade = target EVA.
  • Magical: hit = success rate; evade = target MEV.
  • Certain: hit = success rate; evade = 0%. Also, Certain Hit type causes all applied states to ignore the target's state rate (so you can use it for ally-buffing skills, for example).
The default code returns different hit calculations based on the hit type (cf rpg_objects.js)...
Spoiler: Relevant code excerpts
JavaScript:
Game_Action.prototype.itemHit = function(target) {
    if (this.isPhysical()) {
        return this.item().successRate * 0.01 * this.subject().hit;
    } else {
        return this.item().successRate * 0.01;
    }
};

Game_Action.prototype.itemEva = function(target) {
    if (this.isPhysical()) {
        return target.eva;
    } else if (this.isMagical()) {
        return target.mev;
    } else {
        return 0;
    }
};
Yanfly's Hit Accuracy plugin basically lets you replace those two methods. This means that unless you explicitly check the hit type in your formula, hit type will have no effect on hit chance. (Ditto for evasion.) 👋

So, maybe try these formulae instead:
  • Hit:
    JavaScript:
    this.isCertainHit() ? 1 : ((skillHitRate + (a.luk / 100) / 2) * (userHitRate - targetEvadeRate))
  • Evade:
    JavaScript:
    this.isCertainHit() ? 0 : ((targetEvadeRate + (a.luk / 100) / 2) * (userHitRate + skillHitRate))
All I've done here is take your formulae and added bits at the front that say "if the skill is Certain Hit, it has 100% hit rate and 0% evade rate". 😮‍💨
Using the default formula worked! Thanks so much. I think it was actually due to the "evasion formula" I set up alongside the hit formula. I reset the plugin settings, and found that the default setting for the evasion formula is simply 0. Also, I was under the impression that the "certain hit" thing in the database guaranteed that the item/skill would hit, but maybe I was wrong.
I'm having the exact same problem, but where am I supposed to put the default formula for it to work?

1708400466903.png
I'm having the exact same problem, but where am I supposed to put the default formula for it to work?
If you're using something default, you'd put it where it comes...by default.

But you explicitly have changed your hit formula, so why would you want to change it back?

If all you want is to restore the Certain Hit functionality, then you'd do exactly what caethyril already showed above and prefix your formula with:
Code:
this.isCertainHit() ? 1 :
Weird, I tried that before and it didn't work, so I must've typed something wrong. Thank you!

@cthulhusquid, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.


Next time make a new thread instead.

Original thread: https://forums.rpgmakerweb.com/threads/why-are-my-potions-missing-when-theyre-certain-hit.123182/