Force a missed attack

Hey, is there a script command to force an (incoming) attack to miss?

I've seen these threads:
https://forums.rpgmakerweb.com/index.php?threads/force-miss-command.62636/#post-604303
https://forums.rpgmakerweb.com/inde...ting-an-always-evade-state.72797/#post-687079
https://forums.rpgmakerweb.com/index.php?threads/force-critical-or-miss.70510/#post-668719

But the solutions involve directly altering either the attacker's hit rate or defender's evasion rate. Would be complicated to factor in for scenarios where a battler already has an altered rate. For eg:

The defender developed a 50% evasion rate through some means. However, using the above methods would change it to 100% evasion (to avoid the incoming attack) and then either leave it as 100% or default back to 0%. Wouldn't it be complicated to retain the previous evasion rate?

That's why I'm asking if there's an equivalent to:
this.actionForceCritical();
this.actionForceNoCritical();

for forcing a miss.

Edit my current attempt using the above methods:

Code:
<Custom Select Effect>
$gameVariables.setValue(99,target.eva);
console.log(target.name() + "'s Current Evasion: " + target.eva);

if ($gameVariables.value(280) == 1){
    target.setEva(100);
    console.log(target.name() + "'s New Evasion: " + target.eva);  
}
</Custom Select Effect>

<Custom Deselect Effect>
    console.log(target.name() + "'s [Pre-Deselect] Evasion: " + target.eva);
    target.setEva($gameVariables.value(99));
    console.log(target.name() + "'s [Post-Deselect] Evasion: " + target.eva);
</Custom Deselect Effect>

To retain their prior evasion rate, I store it in a variable. However, I'm not sure that is efficient or safe. When multiple enemies capable of evading, via this way, are attacked, the coding is run for each of them in order (So the value stored in variable 99 SHOULD be unaffected by another enemy's evasion rate) - in other words, enemy A's evasion rate is managed in variable 99, and then enemy B's evasion rate is managed.

I'm uncertain if this can cause other complications though.
If you are using the Yanfly plug-in that calculates the attacker's hit and the defender's evade simultaneously, you could probably just add a state that grants +1000% Hit Rate before the attack and remove it when your done. Might be easier to manage.

If you're not using that plug-in though, the defender can still Dodge the attack, unfortunately.
@Frogboy Not sure what plug-in you're referring to off-hand, but I'd check. And what do you mean the defender can still dodge? Are you referring to the currently implemented method in my edited post above? And well, I'd want the defender to always dodge in that case, so wouldn't that be good?
Sorry, I got mixed up with what you were trying to do and was thinking the opposite. I was thinking that you wanted a guaranteed hit instead of miss.

So all you really need to do is create a state which grants at least 100% Evade, apply it to the target of the attack and then remove it after the attack is complete.
You can use Yanfly's counter control plugin (or how is it called). There is a note tag command that allows you to force the next attack to miss and then have a counter, so if you set the counter to an empty skill, it should work.
@Poryg Hmm, I tried that I believe. The problem I encounter is that there is a specific condition for the battler to be able to evade the attack. So I need to set a custom condition for the evade to trigger and that can only be set within a skill - not within the state itself. So as far as I understand, I have to call a skill with that defined. I had the skill do no damage (target no one, etc), but it still gave a "had no effect" message, which breaks the illusion.
@Rink27 Can you elaborate the conditions? I won't see the problem otherwise.
@Poryg The attack has to have a certain property to be evaded 100%. At the moment I use a sort of elaborated method with variables, but it's the same as if I had the condition requirement as: the incoming attack must have the Earth element (Instead I'm using something other than elements, but same principle).

Under the skill the counter state calls, there'd be a:

<Counter Condition>
Element: Earth // Instead I have a different requirement here
</Counter Condition>

<Evade Counter>
I see now.
Then maybe what about using something like this inside the state?
<Custom Select Effect>
if (whatever conditions){
target.result().evaded = true
}
</Custom Select Effect>
I'm not sure if it works though. Didn't try it.
@Poryg Didn't work :/
Damn... Then there is only one solution that comes to my mind.
Victor engine contains a script that allows you to evade attack elements based on a state. From what I've heard, Victor engine is not incompatible with Yanfly engine, so perhaps it could help.
https://victorenginescripts.wordpress.com/rpg-maker-mv/action-dodge/
You'll need to download Victor engine core with it. But again, it does the same, influencing evasion rates...

Original thread: https://forums.rpgmakerweb.com/threads/force-a-missed-attack.78949/