Battle Scripts to detect 'if player hits (or critical)'

So I'm implementing a 'Arena Battles' in my game, and I want basically a 'Cheer Rate'. So I tried using Variables 1-5 chance and seeing if that works, and well, they cheer when someone guards. That's a bit... awkward? So my thoughts are, "if player successfully lands a hit on the enemy (OR the enemy successfully hits the player), play a cheer sound of a variable 1-5, if 5, its a cheer, if lower, its none. But, if it is critical (for player or enemy) then do a bigger cheer"?
You will need these calls:

this.isHpEffect() - returns true if skill / state affects HP
this.result().critical - returns true if battler deals critical damage to opponent.

Also it will require Yanfly's Battle Core plugin and Action sequence pack 1, 2 and 3.

then in your state write something like this

Code:
$gameTemp.reserveCommonEvent(commonEventId);
$gameTemp.clearCommonEvent(commonEventId);

and in this common event use play SE.
And here you have whole plugin pack for this

Also I'll give you my state as reference that displays message when actor deals critical damage:
Code:
<Custom Establish Effect>
if (target.result().critical){
    /* Edit these params to fit your game */
 
    /* Define your critical damage messages */
    /* You may add as much as you like */
    var messages = [
        "dealt Critical Strike!"
    ];
 
    /* Choose ID of your common event that will play */
    /* when Critical strike occurs. */
    var commonEventId = 12;
 
    /* Select ID of variable that will store message of critical damage */
    var variableStore = 4;
 
    /* Lets make a random number between 0 and number of */
    /* Messages you defined in array "messages" */
    var randomNumbers = Math.floor(Math.random()*messages.length);

    /* Set variable to display message. */
    $gameVariables.setValue(variableStore, user.name() + " " + messages[randomNumbers] + " ( " + value + " points damage )");
 
    /* Play common event... And that's pretty much. */
    $gameTemp.reserveCommonEvent(commonEventId);
    $gameTemp.clearCommonEvent(commonEventId);
    user.gainExp(Math.floor(value * 0.5))
}
</Custom Establish Effect>
My Common Event as reference
and finally here is the result:

Original thread: https://forums.rpgmakerweb.com/threads/battle-scripts-to-detect-if-player-hits-or-critical.114202/