[Solved] Yanfly/Javascript question

Hello, as per above, I'm having difficulty achieving my wish for a specific Yanfly scripting. More specifically, it's in regards to: YEP.56 - Limited Skill Uses - RPG Maker MV

I'm trying to utilize the plugin to make it so my character has limited skill uses (let's say 3 uses), but only per level. So after using 3 times, it is 0/3. Then, when level-up, reset the value to 3/3. They don't stack, so if 2 levels gained, not 6/3, just always 3/3.

The code I was trying to utilize is the following:

<Limit uses: 3>
<Custom Skill 27 Limited Uses>
if user.level += {
user.recoverAll();
}
</Custom Skill 27 Limited Uses>

Obviously, this is incorrect, I am definitely learning improvements everyday, I'm no expert. I couldn't find the scriptcall code to be used for the event (under Actor) ==> 'Recover All...' (specifically for Variable). My thinking was to use a scriptcall for it under my Skill (with the code I have used above), and define a variable, then just recoverAll on that variable so the variable refreshes back to 3/3 skill uses when the character levels up. I might be going about this incorrectly, I know there's a lot of people on here who are very smart when it comes to doing these things.

Thank you if anyone is able to solve this. I'm thinking the fix is fairly easy, and someone will understand it very fast. Feel free to post the correct code if solve-able.

P.S. Is there a way to console.log the event I have on the map to specifically have it show all information the event is using? As-in, I have an event6 doing only RecoverAll Variable. I console.log($gameMap.event(6)); but I don't recall seeing any code to help me find the exact scriptcall I could use from it for debugging this (meaning whatever the scriptcall for RecoverAllOnVariable is). I didn't wish to have to go-about opening json files yet, so I thought if I could get the info in the console.log I could debug it. Any info on if that can be done will probably help out I, and maybe even others, for the future [in regards to debugging]. Again -- thank you.
There isn't an easy "on level up" feature to the Limited Uses plugin, but you can achieve this with a common event:

1595925695154.png


You'd just have to make sure you turn whatever switch you select for the activation condition on at the beginning of the game. You'll have to do a separate set of these lines for each character in your game.

There is a way to do is more efficiently with JS code instead; let me know if you'd rather go down that route.
@Trihan -- thank you for taking the time to reply. I'd be happy to look at your JS version of what you think is efficient; I'm sure it'd help me learn and improve. I was thinking the easiest way to tackle this was by way of JS in the notetag of the skill (could be wrong, not sure).
Actually, now that I think about it, do you have the "Level Up Growth Effects" plugin? Because you can do it in the notetag using that.
YEP 197 -- yes I have access to that.
Code:
<Custom Level Up Effect>
   actor.recoverAll();
  </Custom Level Up Effect>

Or if you don't want to recover HP and MP as well:

Code:
<Custom Level Up Effect>
  actor.recoverAllLimitedSkillUses();
</Custom Level Up Effect>

To answer your other question: let's say I have a fairy on my map that fully recovers the party. The event's ID is 1. If I open the console, I can do this:

1595927531135.png


Then I can open up that object (the little arrow pointing right) and see the properties/functions it has access to:

1595927564454.png


If you scroll down and open "__proto__" you can see the details of its parent class:

1595927603419.png


One of these is "page", which contains the event code:

1595927703617.png


This is where you need to know a bit about the interpreter and event codes, but since we only have one command, it's obvious that the 0 element in "list" is our "Recover All" meaning that command has a code of 314. From there, you can open up rpg_objects.js and look up command314:

1595927784681.png


Now that we know it's calling the recoverAll function, we can enter that in the console on an actor to see what it does (if you enter a function name without the (), it'll show you the function itself:

1595927903722.png


Then click the f () { part to be taken to the actual source that it's referring to:

1595927942130.png


So here we can see that the "most recent" version of the function is in YEP_BattleEngineCore.js, and you can see from there what changes the overwrite has made.
I utilized the YEP 197 and the 2nd code you listed (that doesn't heal HP/MP), and it worked ^_^ Thank you very much for guiding me through to a solution (I'm sure there were more than 1, but this works). The only question in regards to the code given -- it reads "actor.recoverAllLimitedSkillUses();" -- is 'AllLimitedSkillUses' applying to all skills? Does that mean if I were to give the character a different skill that also has a limitation like 4/4 skills but refreshed when leveled, it will also apply to that? Or is it note-tag specific to each skill? (This is my first time using YEP 197, so apologies if it is a dumb question).


As per the script-call list posted by Archeia: https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-mv-script-call-list.46456/

I checked here to try and find the recoverAll (for variable), but I only saw the recoverAll for Party and Enemies listed. The command314 you have just shown suggests actor.recoverAll(). I'm guessing this isn't the same for the variable recoverAll, or it is?

You posting the screenshots and explaining helped me a great deal. I checked every part except prototype because I was thinking I wasn't going to find it there lol. Guess it is really deep in there (ya gotta know code well like yourself to know it's hidden down there). Been trying to avoid opening the json until I get a better understanding on javascript.

Thanks again Trihan.
recoverAllLimitedSkillUses will refresh the uses of any limited-use skill that actor has, you don't need to do a tag specific to each skill.

The party and troop have a recoverAll function, but that just iterates through the members of the unit and calls their own personal recoverAll function, which is what actually does the recovery.
Well this specific thing is resolved, and I bet your info will help others improve their knowledge-base. Thanks again mate. Is there something special I am to do to label this thread as solved? I'm new so I don't know.
If you report the post, I think you can select "solved" as the reason so the mods will know. You can also edit "[solved]" into the post title to make it even clearer.

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/solved-yanfly-javascript-question.124625/