MV Recovering MP and such using Yanfly

I'm using Yanfly's plugins in RMMV and I'm sure there is a way to do this, but I'm not super familiar with java script. I'm trying to make a few skills/states that cause the player to recover HP/MP/TP when attacking an enemy, but only for specific values like getting 1 mp every time you use a basic attack. I'd also like to figure out how to set up a way that states or equipment can recover these values at specific amounts as a regen effect.
The function for recovering MP is user.gainMp(X)

For a state, you'd simply put that inside of a Custom Regenerate Effect notetag.
I tried doing that, but for some reason it wouldn't work for me. Here is what I entered.

<Custom Regenerate Effect>

user.gainMp 10

</Custom Regenerate Effect>
Well, that is a plain syntax error. If you open your console via F8 you should see that. You must not leave out the brackets.
JavaScript:
<Custom Regenerate Effect>

user.gainMp(10)

</Custom Regenerate Effect>
This should work.
I actually tried that one as well. I just tried re-downloading the buffstatscore as well to see if my version was just outdated and it still isn't working. I'm not sure what's going on...
Then can you show us a screenshot of your code and where you put it?

We can only make a proper problem assessment with more information.
I made a couple samples and neither worked. Here is what I did

The version I tried giving it to a class...
MV class sample.png


...and to a armor.
MV ring sample.png
...you're putting it in a class and an armor. Both my post and the documentation for the plugin say that notetag functions in a state.

If you want the class or the armor to give the actor a state with that notetag, you'll need to use the Auto Passive States plugin.
The notetag you are trying to use only works with states.

You would need to create an invisible state (no icon) and give it to the character you want to have the effect.

Something like YEP_AutoPassiveStates could make this easier by applying the state automatically.

PS: As a piece of advice, most plugins have documentation on how to use them. These are the texts you can read when adding new plugins.

In your example, the notetag you used is found here:

1.png


edit: ninja'd by my arch-nemesis @ATT_Turan
edit: ninja'd by my arch-nemesis ATT_Turan
I've never been an arch-nemesis before! Do I get a special cape or something?
@ATT_Turan
I'm pretty sure you already landed on multiple peoples' black list already. Without even knowing it.
Not that you should care anyways.

As for me:

Spoiler
4f8alf.jpg

Well okay for real though, let's try to not derail the thread with memes 😀

@Azrik
Anyways, tell us if you need further help with setting things up.
But invisible states + YEP_AutoPassiveStates should do the trick.

Make sure to follow the plugin documentation to avoid any plugin related issues.
Thank you so much. Now that part works. I need to pay more attention to those details.

Now the question is if I can set up a way to have basic attacks regen 1 MP.
Why not? You just do the exact same thing in your damage formula.
Code:
a.gainMp(1); then your damage formula

You may find this thread helpful:
Thank you both so much. That did the trick. I do have one more unrelated question though. I'm using the Yanfly selection control plugin and I was trying to only have specific skills have the option of choosing if they target all enemies or not. So I set the "Single Multiple" parameter to "false" to try to disable all skills from having the option, but it still shows up whenever I do a test battle. Is there something else I need to change to prevent this from effecting all skills?

Edit: Ok. Ignore that last part. It seems to be working now. Not sure what changed. Thanks for all your help.

Original thread: https://forums.rpgmakerweb.com/threads/recovering-mp-and-such-using-yanfly.147737/