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

Finally started working on Grim Trigger episode 2 today :LZScat: it's half comic/half visual novel!

GfY3Rwj.png
Is it interesting to get more backstory on villains? A key moment in their past, their childhood, or maybe something that shows they've always been that way? To see or not to see?
"Everything tastes like chicken until it's chicken, then it doesn't taste like chicken."
Context: chicken samosas do not taste like chicken. I thought it was veggie samosas.
Just another ordinary evening.
This pig girl is a merchant and playable character.
Currently there's no name for her yet. a suggestion is welcomed.
Merchant.jpg
Merchant-1.jpg
Want for a Nail: I'm trying to figure out what controllers work with MZ, one support thread, a plugin request thread, a dead controller, and a $48 eBay purchase, and a PS1/PS2 USB adapter later. Still stuck with keyboard controls...

Forum statistics

Threads
110,351
Messages
1,052,570
Members
143,393
Latest member
cobertk
Top