MV How to store critics in a variable

How to count the critics made by a player and store them in a variable. and stop this count when it reaches a certain number
The easiest way would be using this plugin:

Then create an empty state like this:

Then in note field paste this:
Code:
<Custom Establish Effect>
if (target.result().critical && value > 0){
var limit = 10;
$gameVariables.setValue(1, $gameVariables.value(1) + 1);
if ($gameVariables.value(1) >= limit){
$gameVariables.setValue(1, limit);
}
}
</Custom Establish Effect>

and give that state to your actors. Finally it should look like this:
You can't imagine how much I needed that for my game. Thank you
The easiest way would be using this plugin:

Then create an empty state like this:

Then in note field paste this:
Code:
<Custom Establish Effect>
if (target.result().critical && value > 0){
var limit = 10;
$gameVariables.setValue(1, $gameVariables.value(1) + 1);
if ($gameVariables.value(1) >= limit){
$gameVariables.setValue(1, limit);
}
}
</Custom Establish Effect>

and give that state to your actors. Finally it should look like this:
You can't imagine how much I needed that for my game. Thank you

Original thread: https://forums.rpgmakerweb.com/threads/how-to-store-critics-in-a-variable.127886/