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

I've spent some cash on foley and other sound effects. I wonder sometimes if I made a poor choice, but I remember that I really want to improve the sound of my games. n...n; My frugalness haunts me sometimes.
elex 50s face.png

Experimenting with an old 50's style face set. I have done about a dozen variations of face sets for my characters, but am never happy with the results for very long. Different attempts. Second one is the same character as the first image. The third is Ivan, another character entirely.
treele.jpg
A them/they in a forest... a still for the game I'm working on.

Forum statistics

Threads
108,843
Messages
1,039,988
Members
141,307
Latest member
ZeroJyllmeiko
Top