MV How to make a sound effect when performing a critical

I want to make a sound effect when a fatal blow occurs.

However, no matter how hard I searched, I couldn't find any data on him.
Is there anyone who knows about this?
JavaScript:
Game_Action.prototype.makeDamageValue = function(target, critical) {
    var item = this.item();
    var baseValue = this.evalDamageFormula(target);
    var value = baseValue * this.calcElementRate(target);
    if (this.isPhysical()) {
        value *= target.pdr;
    }
    if (this.isMagical()) {
        value *= target.mdr;
    }
    if (baseValue < 0) {
        value *= target.rec;
    }
    if (critical) {
        value = this.applyCritical(value);
        AudioManager.playSe({name: "YourSoundFile", pan: 0, pitch: 100, volume: 100})
    }
    value = this.applyVariance(value, item.damage.variance);
    value = this.applyGuard(value, target);
    value = Math.round(value);
    return value;
};

That's it - save as plugin and done.
It works very well. Thank you!
While technically correct, the example above will very likely cause compatibility issues with other plugins that affect damage calculations.

Your best bet would instead be to alias the applyCritical function and tuck the audio edit in there.

Try this. It should work the same while leaving the rest of the makeDamageValue function alone.

JavaScript:
var alias_applyCrit = Game_Action.prototype.applyCritical;
Game_Action.prototype.applyCritical = function(damage) {
    AudioManager.playSe({name: "YourSoundFile", pan: 0, pitch: 100, volume: 100});
    return alias_applyCrit.call(this, damage);
};
Thank you very much!
That's very kind of you.
Moved to: Learning Javascript

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-a-sound-effect-when-performing-a-critical.139952/