EXP

Hi everyone, I'm using an object's notetags:
<JS Item Effect>
user.target().gainExp(1000);
</JS Item Effect>
to give experience to a single character, but it's not working. Do you know what the error is? I'm using the Visustella and RPG Maker mz plugins.
The error is : user.target() (target method does not exist for object user)

To affect the target : target.gainExp(1000, true);
To affect the user : user.gainExp(1000, true);

Make sure the item has a proper scope (One Ally or The User) or target may be undefined
it doesnt work, i dont know why 🙁
We will need a bit more explanation to further assist ^^

It doesn't work often happens, but never without errors or logic.

What are you doing exactly?
How did you set it up?
Where/How are you using the item? (In battle, from the item menu, through an event process)

What plugin are you using (exactly, not just visustella) for your effects?

When you try to use your item, open your console (F8) and take a screenshot of the error message(s)
The item is set for the user to use, only from the menu screen. It's a normal item and can be consumed. When I tap it on a character, the sound that says when an item can't be used plays. It doesn't consume or do anything; it's simply as if it can't be used. I've attached the note tags.

1749893415279.png
For RMMZ to play the buzzer sound, it means it is assessed as non-usable.

Since you don't show the way the item is made I can only guess one of these might be wrong :

- Scope (it must be "one ally" or "the user")
- Occasion (must be set to always if you want to use it outside combat)
- No effects whatsoever in the effect branch (meaning the items is considered as having no effects and won't work)

I'm not here to steal your work, please share your entire item window for further help. 🙂
I didn't understand you, I hadn't passed the capture for something else xD

1749895087123.png
Yes, so the "Efectos" tab is empty, which is likely why it does not work.
(the game considers the items as having no utility)

Try adding a dummy effect in your "Efectos" tab, such as "Heal 0%" to make it work.
Now it lets me use the item, but nothing happens.
It would be helpful to know which plugin you are using.
If the plugin alters the user object, it could be your original code works

Hence, try again with :
<JS Item Effect>
user.target().gainExp(1000);
</JS Item Effect>

If this does not work, please add this line after <JS Item Effect> :
console.log("Giving EXP to user:", user.name());

Then press F8 after you used the item, and share results
it might be easier to sidestep the plugin and use the damage formula for it.
Code:
b.gainExp(1000, true); 0
It would be helpful to know which plugin you are using.
If the plugin alters the user object, it could be your original code works

Hence, try again with :
<JS Item Effect>
user.target().gainExp(1000);
</JS Item Effect>

If this does not work, please add this line after <JS Item Effect> :
console.log("Giving EXP to user:", user.name());

Then press F8 after you used the item, and share results

I've done what you said and nothing happens. I'll show you what appears in the console. On the other hand, I have many plugins installed, practically all of the Visustella plugins.

1749912892860.png
it might be easier to sidestep the plugin and use the damage formula for it.
Code:
b.gainExp(1000, true); 0
doesnt work
doesnt work

then one of your installed plugins is probably blocking it by some means. the damage formula mentioned works in both a default project and the visustella sample one. if one of your plugins youre using doesnt immediately come to mind, start disabling plugins and testing until you find the one that causes it

1749915080094.png
exp.gif


Edit:
I've done what you said and nothing happens. I'll show you what appears in the console. On the other hand, I have many plugins installed, practically all of the Visustella plugins.
also, if youve done what Artille said, there would be a console output unless the notetag isnt being processed. which visustella plugin is the notetag from?
I think there was a problem with the objects already created because now I have created a new one doing what you told me and it works... sorry and thanks for your patience.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/exp.178314/