Forcing a conditional miss.

I'm looking for a script that will allow me to force a skill to miss based on conditions.
The scenario I have in mind is that a character has a suplex skill, sort of like Sabin in FF6, but it doesn't work on flying enemies. I figure I can make those enemies distinct by using a state or Hime's Tag Manager, but I'm not sure how to go about actually getting the skill to miss on them exclusively.
Do it yourself. Assume you're using tag manager, here is how.
Hit and miss is handled in Game_Battler, look into def item_hit
Code:
  def item_hit(user, item)
    rate = item.success_rate * 0.01     # Get success rate
    rate *= user.hit if item.physical?  # Physical attack: Multiply hit rate
    return rate                         # Return calculated hit rate
  end
You can change the code into something like
Code:
  def item_hit(user, item)
    return 0 if has_tag?("flying") # <-- modification here
    rate = item.success_rate * 0.01     # Get success rate
    rate *= user.hit if item.physical?  # Physical attack: Multiply hit rate
    return rate                         # Return calculated hit rate
  end
0 means it has zero chance to hit
1 means it's always hit
between 0 ~ 1 is a chance to hit. 0.5 means 50% chance to hit
That overwrites every skill and attack, effectively making the enemy with that tag untouchable. I'm looking for a way to limit that to specific instances like with a specific skill.
Just add the extra condition, like
Code:
has_tag?("flying") && item.is_a?(RPG::Skill) && item.id == 99
Okay, that makes sense.
Is there any way to force a miss in a damage formula? I ask because I know that you can make a higher rate for criticals that way.
Is there any way to force a miss in a damage formula?
Not without using a script, as Theo suggested. The reason behind that is that the damage formula is only evaluated when the attack hits. If you evaluate the formula it is already too late to miss.
Thanks for the advice.
One final question: What condition can I use to check to see if the skill has missed? Would it just be "@result.missed = true"? I'm trying to figure out how to code a sideview sequence now for this skill.
If you want to check it within the damage formula you simply cannot, for the very same reason I explained before: when you miss, the whole formula box is not evaluated. This means that you cannot use it to have your character miss, but you cannot use it to check if you missed either, because when you miss it does not run. If you want to use a script, then it is a different story.
I understood that part. I'm not asking about how to phrase it in the damage formula, but rather in a script condition. The sideview system I'm using (Journey/Tankentai) allows for script based conditional statements that change/end the animation sequence. I was asking how to phrase a result missing for that since I can't use the tag for that part.
You're using an (entirely) different battle system, which means the workflow may be different than the default.
Checking if the attack/skill/item miss can be as simple as use this code as long as the said skill is already evaluated beforehand (and the result don't get reset for whatever reason).
When exactly the skill/item is already evaluated? That is the thing I don't know. I'm not familiar with the script, and you didn't even link it here for the reference.
I'm sorry. I really should have linked it. This is the sideview I'm using.
I didn't think it was relevant as it actually doesn't reference item_hit at all.

Original thread: https://forums.rpgmakerweb.com/threads/forcing-a-conditional-miss.111567/