MV I want to use items when actors are critical hits

Hello.
I've been searching and studying JavaScript for months, but I'm not sure.

I want to use items when actors are critical hits
Finally I found a script that calls a common event on critical hits.
Bobstah.CriticalEvents.GameAction_applyCritical = Game_Action.prototype.applyCritical;
Game_Action.prototype.applyCritical = function(damage) {
if (Bobstah.Param.CriticalEvents_CommonEventID !== 0) {
$gameTemp.reserveCommonEvent(Bobstah.Param.CriticalEvents_CommonEventID);
}
return Bobstah.CriticalEvents.GameAction_applyCritical.call(this, damage);
};



but, I want to know that actors use items after critical hits
The code I wrote in the common event script doesn't work.
What the hell is the problem?
I'm so stressed out.
Tell me how to modify the code

Or is there a plugin that uses items on critical hits?

Returns a variable so that I can specify an actor name
$gameActors[criticalActorId].name()


i found item name
$dataItems[16].name
but I can't use the item...
So you're saying you want an automatic reaction? Like, Harold gets critically hit and automatically uses a potion?

I don't know where you got that code you pasted from, but that's not going to do anything by itself.

I think you should work off of Yanfly's Auto-Potion Tip & Trick:

Just change the top two lines to read:
Code:
<Counter Condition>
Eval: target.result().critical
</Counter Condotion>

Original thread: https://forums.rpgmakerweb.com/threads/i-want-to-use-items-when-actors-are-critical-hits.157396/