Script Request: Short Range / Long Range battler seperation

Good morning / afternoon / evening, everyone.

I am in need of your assistance once again. This time for a new idea for a battle system.

In my game there are characters with long range attacks and short range ones, and I wish to design enemies and bosses around this idea.

For example, the enemy is a flyer, so short range attacks will have a much higher chance of missing than ranged ones, requiring a ranged fighter. And also make it so in certain battles close range attacking is completely useless, prompting the player to resort to ranged battlers who will be able to hit their target. Kind of like in Final Fantasy VII or 10 where certain battles melee attacks wouldn't reach their targets for being too far away.

So, maybe an idea like notetagging skills or weapons with <shortrange>, and notetagging enemies <flyer> or <unreachable to shortrange> would make the skills or weapons notetagged with <shortrange> either very unreliable (promting a lot of MISSes) or be completely useless for attacking the enemies tagged with <flyer> / <unreachable to shortrange>

Is this possible to achieve?

Any help would be appreciated, this idea would be a game-changer for my project.
Im thinking about using traits for this...
You can try this script:
Spoiler

You can modify the user's hit rate based on the target with it.
You are my hero/heroine.

Seems to work perfectly! It does alot of things I wanted to accomplish.

Thank you for this. I will let you know if I encounter any issues!

Original thread: https://forums.rpgmakerweb.com/threads/script-request-short-range-long-range-battler-seperation.129973/