RMMV SOLVED - Help with Yanfly Limited Skill Uses recovery

rue669

RueToYou
Veteran
Joined
Aug 29, 2016
Messages
477
Reaction score
386
First Language
English
Primarily Uses
RMMV
Hi all,

Hope everyone is doing well and staying safe and that ya'll are getting vaccinated!!

I'm hoping someone can help me out.

I use Yanfly's Limited Skill Uses for some of the skills in my game. Then I have another skill that can recover all limited uses.

So it works like this:
Various actors have skills that have limited uses (3/3 or 2/2).

Once those uses are used up in a battle, there is a skill an actor can use that recovers all the limited uses for all allies.

I tried the Recover All Uses but then realized that's just for the Recover All command which I don't want to use (I don't want everyone's HP and MP to recover every time you use this skill). I just want the limited uses on skills to recover completely.

Is there a way to do this? I find it odd that it's not already built into the plugin but perhaps I'm just missing it. Any help you can provide would be appreciated. Thank you!
 

Htlaets

Veteran
Veteran
Joined
Feb 1, 2017
Messages
219
Reaction score
118
First Language
English
Primarily Uses
Have a skill with the following notetag:
<Global Limited Uses: +X>
It's a little confusing but I'm fairly certain that that notetag doesn't increase maximum uses, so you could make the +9999.
For specific skills there's another notetag.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,512
Reaction score
2,616
First Language
English
Primarily Uses
RMMZ
You can do this with a script call: [battler].recoverAllLimitedSkillUses()
 

rue669

RueToYou
Veteran
Joined
Aug 29, 2016
Messages
477
Reaction score
386
First Language
English
Primarily Uses
RMMV
Thanks guys! I’m gonna try both of those!

@Trihan by battler, is that the actor id? And do I write it in []? I suppose I would call the script as a comment event in the skill?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,168
Reaction score
640
First Language
English
Primarily Uses
RMMV
The trick is that if you just use the Global Limited Uses tag, I don't see how you'd avoid it replenishing that skill as well. So unless your intention is to have that always available, you'd want to use a loop with the script call Trihan mentioned. (and if it is your intention to have that always available...why bother? Just replenish all your skills at the end of each battle).

@Trihan by battler, is that the actor id? And do I write it in []?
No, a battler is an actor variable, not the id of one. So an example of usage would be
Code:
$gameParty.actors()[0].recoverAllLimitedSkillUses();
to recover for the first actor in your party.

If you wanted to recover for the entire party except the person who is casting the replenish skill, you could do this:
Code:
for (var i=0; i<$gameParty.actors().length; i++)
{
    if ($gameParty.actors().id!=X)
        $gameParty.actors()[i].recoverAllLimitedSkillUses();
}
where X is the ID of the actor who gets that skill. If you want to include him in the replenishment, then just take out the line starting with "if" (but see my comment above).
I suppose I would call the script as a comment event in the skill?
You can do it anywhere JavaScript is recognized. Yes, you can call a common event that includes that in a script box. Since you're using Yanfly's stuff, he has tons of places you can include code to be run, such as in action sequences, various times in combat using states, etc.
 

rue669

RueToYou
Veteran
Joined
Aug 29, 2016
Messages
477
Reaction score
386
First Language
English
Primarily Uses
RMMV
And it works!!

Thanks everyone so much for your help with this. Much appreciated on the quick and informative responses.
 

Latest Threads

Latest Posts

Latest Profile Posts

Is it unusual to think your own music is strange? xD I honestly don't know if I'm gonna use any of them :p
I've been keeping my cards fairly close to my chest, but Team Muxedo Task is proud to present the first offering for our contest entry: the title screen background.1624496085488.png
I love work placement programs. Part of it is to get a resume done by a "professional" even though I use a portfolio in my profession.

Forum statistics

Threads
112,506
Messages
1,068,790
Members
146,186
Latest member
miwrky
Top