Can't make a item that gives user Exp

I'm trying to make items that gives the user Exp, but it seems impossible by default. I tried using a common event using the Change EXP option but there's no way to apply the effect directly to the user & there's no option to target the user by default. The only way I see to get around this without a plugin would be to use a script call to either directly give the user Exp or to detect the user's Actor ID & store that in a variable.

Does anyone know if such a script call exists?
What about damage formula? a.gainExp(30); or something, not sure now what is the exact method as I don't have the script with me (although can be found inside the core scripts)

Then just add ;0; to make sure the eval returns 0 and doesn't heal your character.
or you could do what others do when needing to target an skill-event on an actor:
have the skill add an invisible and useless state to the user, and then use conditional branches to check which actor got the state. It's a bit more complicated than the solution above (it needs one conditional branch per actor), but it works even when the effect doesn't fit into the damage formula.
a.gainExp(x) is the correct method.

If you're looking to pass information about the user or target to a common event from a skill you can assign their id to a variable using the damage formula as well, then you can just use event commands by designating with said variable.

Code:
$gameVariables.setValue(x, a.actorId())

Replace x with the variable id you want to use.

This avoids the need for any conditional branches.

Original thread: https://forums.rpgmakerweb.com/threads/cant-make-a-item-that-gives-user-exp.108439/