MV Yanfly Limited Use Skills - Removing skill from actor when 0

Hi all.

I am using the Yanfly Limited Use Skills + SkillCore plugins as a base for my game's magic system. The concept is that you learn spells with limited uses, but once you run out of uses the spell is removed from the player character and you need to relearn it with an item/npc.


From what I could tell - there is no notetag function to achieve this built into the plugin. So I would need to write my own code to reference wherever this data is stored in the code. Would anyone have any ideas?
Can you go into more detail on how you want your spells to work exactly, because there are other plugins that do more of what you want it to do if what I think you're trying to do is what you are actually trying to do.
Can you go into more detail on how you want your spells to work exactly, because there are other plugins that do more of what you want it to do if what I think you're trying to do is what you are actually trying to do.

Hey KawaiiKid! Sure thing.

The system basically works like this:

1. Characters can find Scrolls in the game world or purchase them from NPCs.

2. The Scrolls teach a spell. This spell has limited uses (predetermined base on the spell. Let's say, Holy, and it has 3 uses. (Achieved by Yanfly plugin, easy)

3. Once the 3 uses are depleted, this spell is automatically removed from the actor. In order to use it again, they need to find or buy another Scroll.
Give it the notetag:
Code:
<After Eval>
if user.isSkillLimitedEmpty(this.item())
    user.forgetSkill(this.item().id);
</After Eval>
Give it the notetag:
Code:
<After Eval>
if user.isSkillLimitedEmpty(this.item())
    user.forgetSkill(this.item().id);
</After Eval>

This worked, thank you!!

It did bring to light another challenge though! Forgetting the skill works great. But when the same skill is relearned through a scroll a second time, the uses are not reset! So there are no charges left and it is unusable.

I know there is a Recover All function that can be called, but I can't seem to find anything that would allow you to recover just one skill (and just for the one character). I'm guessing this is not possible with this plugin?

EDIT: I was able to fix the secondary issue too! Limited Skill Uses has notetags you can put in items to help with this like so:

<Custom Skill 14 Limited Uses>
value += 3;
</Custom Skill 14 Limited Uses>

Thank you so, so much for your help!! 🙂
I know there is a Recover All function that can be called, but I can't seem to find anything that would allow you to recover just one skill (and just for the one character). I'm guessing this is not possible with this plugin?
Of course it's possible - how can it Recover All without recovering each individually? 😉 The plugin just doesn't provide documentation or easy plugin commands for us to reference.

I think the easiest way to do it would be to reset the uses before forgetting the skill. It's a little bit more complicated to find a reference to the actor when you're using an item on them.

So modify the above notetag to say:
Code:
<After Eval>
if user.isSkillLimitedEmpty(this.item())
{
    user.setSkillLimitedUse(this.item().id, user.skillLimitedUseMax(this.item().id));
    user.forgetSkill(this.item().id);
}
</After Eval>

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-limited-use-skills-removing-skill-from-actor-when-0.156800/