MV YEP Attachable Augments: Adding a slot to equipment

This is for the YEP Attachable Augments plugin. I'm trying to add a specific augment slot at certain points in the game for specific armor ids with script calls.

I tried following the code snippet from this thread on the rpgmaker subreddit, but it doesn't seem to work.


JavaScript:
// Array of item IDs you want to modify 
var itemIds = [500, 501, 502];
for (var i = 0; i < itemIds.length; i++) { var item = $dataArmors[itemIds[i]]; // Replace 'itemIds[i]' with the desired item ID
    if (item !== undefined) { 
        if (item.meta.attachAugmentSlots !== undefined) { 
            var slots = Number(item.meta.attachAugmentSlots); item.attachAugmentSlots += 1; item.slots += 1; 
             if (slots > 0 && item.augmentSlots === undefined){ 
                 item.augmentSlots = []; } 
             for (var j = 0; j < slots; j++) {
                 item.augmentSlots.push("Glyph"); } 
        } 
    } 
}
That code doesn't make sense to me. It's reading a notetag that doesn't exist, and modifying properties on the items that don't exist.

I don't know if it's going off of code that someone wrote just for their own game, but that wouldn't do anything with Yanfly's Attachable Augments.

The first problem with what you want to do is the whole independent item aspect. Once an item is spawned, it has its own slots, so you changing the slots of an armor ID won't have any effect on copies of that armor that the party already has.

The second problem with what you want to do is that the slots for an armor ID are a property of its database entry, and are constructed every time your game boots up. So you could change that during gameplay, but that change wouldn't save.

Adding a slot to a specific item that already exists in the game is simple: item.augmentSlots.push("type");

For example: $gameParty.members()[0].armors[0].augmentSlots.push("Glyph");
That code doesn't make sense to me. It's reading a notetag that doesn't exist, and modifying properties on the items that don't exist.

I don't know if it's going off of code that someone wrote just for their own game, but that wouldn't do anything with Yanfly's Attachable Augments.

The first problem with what you want to do is the whole independent item aspect. Once an item is spawned, it has its own slots, so you changing the slots of an armor ID won't have any effect on copies of that armor that the party already has.

The second problem with what you want to do is that the slots for an armor ID are a property of its database entry, and are constructed every time your game boots up. So you could change that during gameplay, but that change wouldn't save.

Adding a slot to a specific item that already exists in the game is simple: item.augmentSlots.push("type");

For example: $gameParty.members()[0].armors[0].augmentSlots.push("Glyph");
I want the extra slot to appear on all of that armor id in inventory equipped or not, not just what is currently in the equip slot.

Is there a way to check for every one of those in the inventory and apply it to all of them?
Code:
$gameParty.armors().forEach(armor => {if (DataManager.getBaseItem(armor)==$dataArmors[69]) armor.augmentSlots.push("Glyph")});

That should add a Glyph slot to every armor in the party inventory that is a copy of ID 69.

Code:
$gameParty.members().forEach(actor => actor.armors().forEach(armor => {if (DataManager.getBaseItem(armor)==$dataArmors[69]) armor.augmentSlots.push("Glyph")}));

Then that's equipped sets.
Code:
$gameParty.armors().forEach(armor => {if (DataManager.getBaseItem(armor)==$dataArmors[69]) armor.augmentSlots.push("Glyph")});

That should add a Glyph slot to every armor in the party inventory that is a copy of ID 69.

Code:
$gameParty.members().forEach(actor => actor.armors().forEach(armor => {if (DataManager.getBaseItem(armor)==$dataArmors[69]) armor.augmentSlots.push("Glyph")}));

Then that's equipped sets.
Nice

It worked! Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/yep-attachable-augments-adding-a-slot-to-equipment.163514/