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
208
Reaction score
113
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,351
Reaction score
2,476
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,118
Reaction score
611
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 Profile Posts

So yesterday Dad took me to Volcano Bay, and it was almost ruined by a thunderstorm... then it passed by and the lightning warning got lifted, leading to an awesome time sliding and swimming. Hopefully we get to go to the arcade tonight. The one we're planning on has a restaurant built in with AWESOME food. Not to mention how big the arcade itself is!
image_2021-06-13_150033.png

Maybe I'll actually try making a retro pack. Already have the shark fin made so why not xD
Hey everyone, for everybody following along with my RPG Maker MZ streams: There will unfortunately not be a stream tonight. There is a big exciting event that will go live next week that has been taking all my time, so look forward to that!
Took a small break by playing VR. Latest update of these glasses unfortunately caused a little of trouble but it can be fixed with a manual operation.

Until You Fall is freaking awesome.
I am SO HYPED to share this trailer with everyone when its done. I almost want to tear up i had no idea how far i came along with Fallen Feather in these last 3 years.

Forum statistics

Threads
112,192
Messages
1,066,486
Members
145,800
Latest member
ArkiPDZ
Top