CarpenterScr

Veteran
Veteran
Joined
Nov 2, 2020
Messages
66
Reaction score
6
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,957
Reaction score
5,580
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
66
Reaction score
6
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,957
Reaction score
5,580
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 Profile Posts

My Game Development Livestream

Of course, so, someone had covid at work today and I was exposed to them, so, I'm stuck at home for...TWO WEEKS!
oh god I'm going to die
AAAAAAAAi.png
Kind of relieved that I had medibang installed when I need to edit Sprite I was about to download gimp but I remember I had medibang installed lol

Forum statistics

Threads
110,368
Messages
1,052,667
Members
143,402
Latest member
IBanana
Top