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)
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. 🙂
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
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.