Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,737
Reaction score
2,296
First Language
English
Primarily Uses
RMMV
I'm trying to find a script call with the same effect as the following notetag:
<Skill Tier 1 Slots: +1>
The reason I can't use a notetag in this situation is because it's for my stat allocation system which also allows players to upgrade the number of skill slots. It is all done in @SomeFire's Skill Tree plugin. Basically, the player "learns" a skill that triggers a common event that contains a script call which increases the player's skill slots for a certain skill tier by +1. The same common event then causes the player to "unlearn" said skill so that he/she can increase skill slots multiple times. I'm not certain, but perhaps one of the following functions is involved?
JavaScript:
DataManager.processESTierNotetags2 = function(group) {
    var note1 = /<(?:SKILL TIER)[ ](\d+)[ ](?:SLOTS|SLOT):[ ]([\+\-]\d+)>/i;
    for (var n = 1; n < group.length; n++) {
        var obj = group[n];
        var notedata = obj.note.split(/[\r\n]+/);

    obj.equipTierSlot = {
      1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0
    };

        for (var i = 0; i < notedata.length; i++) {
            var line = notedata[i];
            if (line.match(note1)) {
                var tier = parseInt(RegExp.$1).clamp(1, 6);
        obj.equipTierSlot[tier] = parseInt(RegExp.$2);
            }
        }
    }
};
JavaScript:
Game_Actor.prototype.getEquipSkillTierCount = function(tier) {
    var value = 0;
    for (var i = 0; i < this.battleSkillsRaw().length; ++i) {
      if (this.battleSkillsRaw()[i] === 0) continue;
      var skill = $dataSkills[this.battleSkillsRaw()[i]];
      if (skill.equipTier === tier) value += 1;
    }
    return value;
};
JavaScript:
Game_Actor.prototype.getEquipSkillTierMax = function(tier) {
    var value = Yanfly.Param.ESTierMaximum[tier];
    value = value.clamp(0, this.maxBattleSkills());
    value += this.actor().equipTierSlot[tier];
    value += this.currentClass().equipTierSlot[tier];
    for (var i = 0; i < this.battleSkillsRaw().length; ++i) {
      var skill = $dataSkills[this.battleSkillsRaw()[i]];
      if (skill) value += skill.equipTierSlot[tier];
    }
    for (var i = 0; i < this.states().length; ++i) {
      var state = this.states()[i];
      if (state) value += state.equipTierSlot[tier];
    }
    for (var i = 0; i < this.equips().length; ++i) {
      var equip = this.equips()[i];
      if (equip) value += equip.equipTierSlot[tier];
    }
    return value.clamp(0, Yanfly.Param.EBSMaxSlots);
};
Edit: I just tried $gameParty.menuActor().equipTierSlot[1] += 1; but to no avail...
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,500
Reaction score
2,855
First Language
English
Primarily Uses
RMMV
You could avoid mucking about in the code by using states granted by the skill/common event. Yanfly's plugin says the notetag in your title works on states.
 

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,737
Reaction score
2,296
First Language
English
Primarily Uses
RMMV
There were issues when I tried using multiple states with those notetags. For some reason, the math wasn't checking out. I need to manipulate the number of slots for a specific tier separate from the total number of skill slots.

I ended up using the states method as you suggested, but I had to edit a bit of the plugin's code in order for the math to work as intended. Basically, I had to edit line 379 of YEP_X_EquipSkillTiers.js from:
  • var value = Yanfly.Param.ESTierMaximum[tier];
to...
  • var value = 1;
Anyway, thanks for the states suggestion. With this, I've finally finished my stat allocation system in its entirety, yay!
 
Last edited:

Anastasius

Veteran
Veteran
Joined
Feb 7, 2022
Messages
51
Reaction score
37
First Language
English
Primarily Uses
RMMV
Hello. :kaohi:
Since you're overwriting a function you might as well overwrite that this way:
JavaScript:
Game_Actor.prototype.getEquipSkillTierMax = function(tier) {
    var value = Yanfly.Param.ESTierMaximum[tier];
    value = value.clamp(0, this.maxBattleSkills());
    value += this.actor().equipTierSlot[tier];
    value += this.currentClass().equipTierSlot[tier];
    for (var i = 0; i < this.battleSkillsRaw().length; ++i) {
      var skill = $dataSkills[this.battleSkillsRaw()[i]];
      if (skill) value += skill.equipTierSlot[tier];
    }
    for (var i = 0; i < this.states().length; ++i) {
      var state = this.states()[i];
      if (state) value += state.equipTierSlot[tier];
    }
    for (var i = 0; i < this.equips().length; ++i) {
      var equip = this.equips()[i];
      if (equip) value += equip.equipTierSlot[tier];
    }
    value += this._customESTslot[tier] || 0; // add this line
    return value.clamp(0, Yanfly.Param.EBSMaxSlots);
};

Then in your common event script call:
JavaScript:
var tier = 1;    // skill tier; modify as necessary
var user = $gameParty.menuActor();
if (!user._customESTslot) user._customESTslot = [0, 0, 0, 0, 0, 0, 0];
user._customESTslot[tier] += 1;
Use an array of size 7 so you don't have to worry about index numbers.
Edit: I just tried $gameParty.menuActor().equipTierSlot[1] += 1; but to no avail...
This is because equipTierSlot isn't attached to the actual actor object but rather the associated database entry of that actor.
 

Latest Threads

Latest Profile Posts

Suddenly, games mean nothing. The money spent was worth it to bring souls towards the light of life. May God bless my path forever. I pray that all are shaken for truth and poured out flat on the table of true understanding, knowledge, and wisdom. Bless you.
Finally I bought OMORI...cant wait to get traumatised!!!
Finished making this pretty ambitious forest map. Was wondering what y'all think of it! :kaopride:
1656136876015.png
All this anger everywhere,Who's happy but me?
Seems to be all the people that don't follow Jesus wholeheartedly. My smile might burn you ahhhhhhhhhhh!
Zoom in for cut-scenes and the like? Yay or Nay?

Forum statistics

Threads
123,020
Messages
1,153,442
Members
161,362
Latest member
Dthwithdoom
Top