CarpenterScr

Veteran
Veteran
Joined
Nov 2, 2020
Messages
59
Reaction score
5
First Language
english
Primarily Uses
RMMV
Is it possible to recharge a skill without using the Recover All default event?
It does work this way but I find it pretty restraining that there is not just a call to do it... without having to use Recover All??
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,850
Reaction score
5,416
First Language
English
Primarily Uses
RMVXA
There's almost definitely a way to do this via a script call, based on the way that notetags can directly change the value of a skill's remaining limited uses. However, since the script is not available to download for free, I can't help you figure it out. Look within the code for a script line that sets the uses for an individual skill (probably within the scripting that handles the <Custom Skill x Limited Uses> notetag) and play around with trying to replicate that in a script call, taking note that you may need to have a complete object reference like $gameActors.actor(1) call a method or property, rather than the keyword "this" or another internal reference that has already been defined using const/var.
 

CarpenterScr

Veteran
Veteran
Joined
Nov 2, 2020
Messages
59
Reaction score
5
First Language
english
Primarily Uses
RMMV
There is something like this but I'm not sure I understand it well.

<Custom Skill name Limited Uses>
value += user.level;
</Custom Skill name Limited Uses>

The 'value' variable is the number of uses the user will gain for all Limited Use skills of skill x.


EDIT:
It probably has to do with this bit of code:

Code:
    for (var i = 0; i < notedata.length; i++) {
      var line = notedata[i];
      if (line.match(/<(?:LIMIT USES|LIMIT USE|LIMITED USE):[ ](\d+)>/i)) {
        obj.limitUses = parseInt(RegExp.$1);
        obj.isLimitedUse = true;
      } else if (line.match(/<(?:RECOVER ALL USES)>/i)) {
        obj.limitRecoverAllUses = true;
      } else if (line.match(/<(?:NOT RECOVER ALL USES)>/i)) {
        obj.limitRecoverAllUses = false;

or that one:

Code:
Game_BattlerBase.prototype.recoverAllLimitedSkillUses = function() {
    if (!this.isActor()) return;
    var length = this.skills().length;
    for (var i = 0; i < length; ++i) {
      var skill = this.skills()[i];
      if (!skill) continue;
    if (!this.isSkillLimitedUse(skill)) continue;
      if (skill.limitRecoverAllUses) this.setSkillLimitedUse(skill.id, 0);
    }
};

Sadly my scripting skills are not good enough to pull out the right script call for what I want.
 
Last edited:

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,850
Reaction score
5,416
First Language
English
Primarily Uses
RMVXA
My instinct from looking at this is that in order to recover a skill's uses in a script call, you would need to use the format:
[[battler reference]].setSkillLimitedUse([[skill id]], 0);

So for example, to fully restore Actor #1's uses for Skill #98 in the database, you'd write:
$gameActors.actor(1).setSkillLimitedUse(98, 0);

You can just replace the entire battler reference with "a" or "b" (for the user or target respectively) when using it in a skill formula, but you need the entire reference when using it in a script call.

I'm not totally sure whether the skill id reference is done correctly but I think it is. I'm also not sure whether the 0 is correct (I think it is based on the way Yanfly wrote it but I don't have the full context), or whether you need to replace it with the max number of charges the skill can have.
 

Latest Threads

Latest Posts

Latest Profile Posts

Making a blue-magic-heavy game is very fun but there's a lot of extra hassle as well. Balancing skills for both enemy and player usage isn't easy.
BTW everyone on staff who made the forum jump, thank-you! This time I am not panicked and lost all rounds.
I'm not searching for bugs, just pleasant surprises, for now on ^^
Been a while since I've been here, whoops. My computer's been acting really stupid so I wasn't able to work on my projects, but the good news is I've got a new one, meaning I can get back to work. And I've got a nice idea in mind, I'll just need to find some good scripts for the Aesthetic.
Have a random update.

Forum statistics

Threads
108,834
Messages
1,039,915
Members
141,297
Latest member
Anyxx
Top