How to check who is the actor using the item

Hellow everybody!

I'm trying to make a "Hungry" status for my actors. This stat will buff or debuff their power during the battle. So, to fill this stat, the actor need to eat food. I made variables to each actor to set their hungry status, and put it on the main menu using some Yanfly's plugins.

Now, I'm trying to make these foods to heal the hungry variable of the actor who eat it, but im gotting troubles with the code. I think it should be something like this:

When the actor uses an apple on himself or an ally:

Check if the target is the actor(1):
then increase +10 (for exemple) in the variable 0011;
else
if the target is the actor(2)?
then increase +10 in the variable 0012;
else
...[and there it goes].

Is there someway to made it?
'Plugin Releases' is where people who have written a plugin which they want to share with others can post them. It might be that you need a plugin for this, but at the moment, it looks like you just need to event it correctly.

Moved to: RPGMaker MV
You can do this part with a variable, the damage box, and a common event. I've assumed here that the food items are usable both in and out of battle.

Step 1) Store the target actor ID in a variable using the item's damage box.
In the damage box for the item, put the following, with x being whatever variable ID you want to use:
(SceneManager._scene.constructor == Scene_Battle) ? $gameVariables.setValue(x, $gameParty._actors[this._targetIndex]) : $gameVariables.setValue(x, $gameParty._targetActorId);

Step 2) Use a common event to do the conditional processing.
Have the item call a common event. In the common event, use a conditional branch to check the target's actor ID (using the variable you set in Step 1), then increase the appropriate variable under that branch.
guess I got it. Tell me if its right:

The step on I put the code on the damage box, using type "HP Regen". The variable used will be set as 1, or 2, etc, according to the actor ID selected as target. The item call a common event, just like u said on step 2. So, after I check what's the value of the variable "x", then I add the variable "hungry" of the respective actor, and set the variable "x" again to 0.

Am I right?
"Failed do execute 'createLinearGradient' on 'CanvasRenderingContext2D': float parameter 3 is non-finite."

It showed the above message.
That is a known issue. I don't recall the cause or the solution, but if you copy/paste that error into the search box, you should be able to find it.

Also, if you want to know who is using the item, you are after the user, not the target. The target is the person the item was used on. You can also use a and b in the damage formula to refer to the user and target. Don't need to go to $gameParty._actors[this._targetIndex] (which would put an actor object into the variable, not an actor id).
IT WORKED!

When u told "in the damage box", I didn't understand exaclty, despite I could read the code at least. When i used <post-damage eval>, then it worked perfectly! Thanks everyone, and thank u Llareian for ur help!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-check-who-is-the-actor-using-the-item.87138/