How to detect if a actor evades an attack?

Hello there!
I'm trying to make an Armor piece that grants this effect when worn:
"After a successful evasion, the next attack has a 99% critical chance"
Well, the only problem is, I can't seem to find a way to detect if the actor evaded or not...
I looked into battle events, parameters and skills, but no luck so far, the most that can be done appears to just be increasing evasion chance.
Any ideas? Or is it simply impossible?
I'm not an expert by any means, but I might have an idea. I found in Tools/Script Editor, Game_ActionResult, lines 112 - 114, a place where hit is determined:

def hit?
@used && !@missed && !@evaded
end

Maybe (or not, someone more knowledgeable might correct me) if you added a condition before the "end", something like

if @evaded $game_switches[N] = true (does it need an "end"? not sure, as I said, not an expert :LZSjoy:)

and then you can work with the switch (N) in conditions (always remembering to turn it off when the effect is performed). Let's hope someone else chimes in whether it could work or not.
I'm not an expert by any means, but I might have an idea. I found in Tools/Script Editor, Game_ActionResult, lines 112 - 114, a place where hit is determined:

def hit?
@used && !@missed && !@evaded
end

Maybe (or not, someone more knowledgeable might correct me) if you added a condition before the "end", something like

if @evaded $game_switches[N] = true (does it need an "end"? not sure, as I said, not an expert :LZSjoy:)

and then you can work with the switch (N) in conditions (always remembering to turn it off when the effect is performed). Let's hope someone else chimes in whether it could work or not.
This looks promising! Sadly when I tried it out, the game crashed. Perhaps I formatted it incorrectly?
螢幕擷取畫面 (23416).png
螢幕擷取畫面 (23417).png
Update: Changed the script to:

def hit?
@used && !@missed && !@evaded
if @evaded
$game_switches[184] = true
end
end

and it is not crashing anymore. Gonna keep testing, thanks for the idea!
I'm not an expert by any means, but I might have an idea. I found in Tools/Script Editor, Game_ActionResult, lines 112 - 114, a place where hit is determined:

def hit?
@used && !@missed && !@evaded
end

Maybe (or not, someone more knowledgeable might correct me) if you added a condition before the "end", something like

if @evaded $game_switches[N] = true (does it need an "end"? not sure, as I said, not an expert :LZSjoy:)

and then you can work with the switch (N) in conditions (always remembering to turn it off when the effect is performed). Let's hope someone else chimes in whether it could work or not.
Terrible implementation. Do you know what would be the outcome of your modification?
If the attack or skill gets evaded, it'll return a true value even if it's supposed NOT to do that.

If you prefer to keep that check inside the hit? method, you better place it above the 3 checks it has always performed at that point.
Terrible implementation. Do you know what would be the outcome of your modification?
If the attack or skill gets evaded, it'll return a true value even if it's supposed NOT to do that.

If you prefer to keep that check inside the hit? method, you better place it above the 3 checks it has always performed at that point.
Haha, not a coder but figured that it wouldn't work quite quickly, it was breaking the game and no one was taking any damage 😅

Could you possibly provide an example of what would work?
As I told you before, just move your new check right ABOVE the original check with those 3 variables and that's it.
As I told you before, just move your new check right ABOVE the original check with those 3 variables and that's it.
Thank you, that does seem to be the trick. Just one more question, if you will!
How would I go about repeating it?
Currently the first time the player evades, it works, but only the first time.
I have it set up like this. When I tried using things like "Loop" or "Jump to label", the battle just freezes...
I'm still fairly new to all this so apologies if it's a stupid question.

螢幕擷取畫面 (23419).png
Try changing Span to Turn.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-detect-if-a-actor-evades-an-attack.179304/