How to add a chance to parry when an ennemy attacks

Hi everyone !
For my game, I want one of my character to have a chance to parry and counter every time an ennemy attacks her.
It's for the basic turn by turn combat system in RPG Maker MZ.
I think that the best way is to add a troop event where I can set up variables :
If ennemy attacks character, then character is not affected by attack and attacks the "ID latest ennemy who acted"
But I can't find a variable that says "if ennemy attacks". I can only find if character HP is below x
But I want my character to have, let's say, 50% of chance of stopping the attack before it touches her. So this variable can't work.
Does anyone know how to set up variable is ON if ennemy attacks character ?
Thanks !
Use VS Battle Core action sequences. Put in enemy skills to check target and to roll the parry chance before you use MECH: Action effect. Then if the parry is a success you call a common event that's the parry sequence (and don't use action effect). In the parry sequence you can use motion on the actor and play a "cling" SE and damage the attacking enemy.

EDIT: Oh and in the parry sequence also add MECH: Text Popup (or whatever it was) that says "Parry"
Use VS Battle Core action sequences. Put in enemy skills to check target and to roll the parry chance before you use MECH: Action effect. Then if the parry is a success you call a common event that's the parry sequence (and don't use action effect). In the parry sequence you can use motion on the actor and play a "cling" SE and damage the attacking enemy.

EDIT: Oh and in the parry sequence also add MECH: Text Popup (or whatever it was) that says "Parry"
Thank you. I will try that
Use VS Battle Core action sequences. Put in enemy skills to check target and to roll the parry chance before you use MECH: Action effect. Then if the parry is a success you call a common event that's the parry sequence (and don't use action effect). In the parry sequence you can use motion on the actor and play a "cling" SE and damage the attacking enemy.

EDIT: Oh and in the parry sequence also add MECH: Text Popup (or whatever it was) that says "Parry"
Hello !
I tried to implement your advice and I am still stuck but I think that it's because I don't understand how to translate it into RPG MAKER with Visu Stella battle core
So I made this common event for the parry:
"◆If:Bloc has equipped Cube Hache
◆Control Variables:#0001 Est attaqué = Random 1..2
◆If:Est attaqué = 1
◆Plugin Command:VisuMZ_1_BattleCore, ACSET: Setup Action Set
:Plugin Command:Display Action = true
:Plugin Command:Immortal: On = true
:Plugin Command:Battle Step = true
:Plugin Command:Wait For Movement = true
:Plugin Command:Cast Animation = true
:Plugin Command:Wait For Animation = true
◆Plugin Command:VisuMZ_1_BattleCore, MECH: Emulate Guard Effect
:Plugin Command:User(s) = ["user"]
:Plugin Command:Targets = ["user"]
◆Plugin Command:VisuMZ_1_BattleCore, MOTION: Motion Type
:Plugin Command:Targets = ["user"]
:Plugin Command:Motion Type = guard
:Plugin Command:Show Weapon? = true
◆Plugin Command:VisuMZ_1_BattleCore, MECH: Text Popup
:Plugin Command:Targets = ["target"]
:Plugin Command:Text = Parade !
:Plugin Command:Text Color = #ffffff
:Plugin Command:Flash Color = [255, 0, 0, 160]
:Plugin Command:Flash Duration = 60
◆Plugin Command:VisuMZ_1_BattleCore, ACSET: Finish Action
:Plugin Command:Immortal: Off = true
:Plugin Command:Wait For New Line = true
:Plugin Command:Wait For Effects = true
:Plugin Command:Clear Battle Log = true
:Plugin Command:Home Reset = true
:Plugin Command:Wait For Movement = true
◆Wait:5 frames
◆
:End
◆
:End"

And then In the troop event, I tried to say for each turn, if Bloc (the character) is targetted then launch the Parry event so I did this, but this doesn't sound right.
1771510835451.png

Would you be ok with explaining to me the step by step on how to set the
"If Bloc is targetted by ennemy then Common Event : Parry" ?
Thanks,
If it's just a basic attack counter, you could just give the actor 50% counter attack trait. When I wrote my earlier post I was thinking more complicated sequences. If you wanna do it with action sequences, the idea is for enemy skills that target one dude:

"action sequence stuff"
.
.
.
IF (BattleManger._targets[0].actorId() === 1 && Math.random() < 0.5)
-> Call Common Even (that has parry sequence motions + where you can deal damage to BattleManager._subject)
ELSE
-> MECH: Action effect
.
.
.
If it's just a basic attack counter, you could just give the actor 50% counter attack trait. When I wrote my earlier post I was thinking more complicated sequences. If you wanna do it with action sequences, the idea is for enemy skills that target one dude:

"action sequence stuff"
.
.
.
IF (BattleManger._targets[0].actorId() === 1 && Math.random() < 0.5)
-> Call Common Even (that has parry sequence motions + where you can deal damage to BattleManager._subject)
ELSE
-> MECH: Action effect
.
.
.
I see. Sorry for the misunderstanding. I want my character to have a chance to parry and counter when attacked, but with the turn by turn mechanics.
I will try to change their animation and add a MECH event where she says "Parry!" and "Counter!" when it happens.
So for Counter, I will use the counter attack trait and for parry, I will use the dodge stats and change the "Miss" pop up by "Parry" I think.
Thanks for your answer !

Original thread: https://forums.rpgmakerweb.com/threads/how-to-add-a-chance-to-parry-when-an-ennemy-attacks.181734/