MV Yanfly plugins; how to make an item upgrade that clears the augments on that same item?

So I'm trying to use Yanfly's Item Upgrade Slots and Attachable Augments together to create an equipment enchantment system. Every "augment" is an enchantment scroll with a unique effect that can not be removed and that uses the <Augment Attach: type> notetag so that the effects are not reversed when the augments are cleared. Then, I want to create an item (e.g., a binding rune) that acts as an item upgrade, but what it really does is it clears the augments on that particular piece of equipment (without removing their effects) so that the player can then put more enchantments on that same piece of equipment. I assume I need to use the Eval: effect, but I can't figure out what code I need to use.
im not completely sure why youre using attachable augments for this and not just item upgrade slots. the augments being removable and transferable are the major differences between the systems. you could made the augments all item upgrade items and then the binding would just reset the boost count, no?

I assume I need to use the Eval: effect, but I can't figure out what code I need to use.
you probably could. iirc theres a variable provided to get the item in question, so it would be making a call to remove the augments on it. id have to look for a function that you could use later.
you could made the augments all item upgrade items and then the binding would just reset the boost count, no?
The issue with that is that the item upgrades are far more limited in terms of what they can do. The only significant changes I can make to the equipment is increasing or decrease its base stats; everything else is just cosmetic. However, with the attachable augments I can make the enchantments increase or decrease the equipment's base stats, parameters, state, debuff, and element rates, and even add skills and change the price of the item. Also, decreasing the boost count wouldn't remove the upgrades from the list on the side (at least I don't think it does).

The idea is that "binding" a piece of equipment would, from a narrative perspective, cause it to permanently absorb the enchantments on it and allow new enchantments to be added. Of course, mechanically speaking, all it does is clear the enchantments (augments) on the item without undoing their effects.
However, with the attachable augments I can make the enchantments increase or decrease the equipment's base stats, parameters, state, debuff, and element rates, and even add skills and change the price of the item.
you could actually do all of that with the upgrade items plugin, but you would have to get comfortable with the eval command and using it to manipulate properties and traits in the item. Not familiar enough to know about the UI portion though.

you probably could. iirc theres a variable provided to get the item in question, so it would be making a call to remove the augments on it. id have to look for a function that you could use later.
untested, but try this as the eval code for the binding
Code:
ItemManager.removeAllAugments(item)
since youre using attach evals to permanently add stuff to the items, it should be fine
untested, but try this as the eval code for the binding
Code:
ItemManager.removeAllAugments(item)
it didn't work unfortunately.
it didn't work unfortunately.
take #2 then
Code:
for (var i = 0; i < item.augmentSlots.length; i++) ItemManager.installAugmentToSlot(item, null, i);
i dont know how many augment slots your gear has, but that should clear everything on them
Code:
for (var i = 0; i < item.augmentSlots.length; i++) ItemManager.installAugmentToSlot(item, null, i);
alright, now the augment is being removed and the augment slot is empty, but it's still greyed out and I can't put a new augment in the slot even though it's empty now.

Edit: so I just discovered that if I remove Cannot Detach from the augment effects, this doesn't happen.

Edit 2: also, I just realized that there are no options in the plugin to change the sound effects for adding or removing augments; it's always the default equip sound effect, which doesn't really fit that well with the idea of enchanting.
Edit: so I just discovered that if I remove Cannot Detach from the augment effects, this doesn't happen.
add this as an additional line
Code:
for (var i = 0; i < item.augmentSlotEnable.length; i++) item.augmentSlotEnable[i] = true;

also, I just realized that there are no options in the plugin to change the sound effects for adding or removing augments; it's always the default equip sound effect, which doesn't really fit that well with the idea of enchanting.
the line for it is 1636. you can change it to play some other sound set in the database or use the script call for playing specific sounds from the sound effect folder
add this as an additional line
Code:
for (var i = 0; i < item.augmentSlotEnable.length; i++) item.augmentSlotEnable[i] = true;
This works, thank you!


the line for it is 1636. you can change it to play some other sound set in the database or use the script call for playing specific sounds from the sound effect folder
Unfortunately, this is giving me an error message.
You need to create the sound effect you want like this:
Code:
var sound = {
      name:   "soundFile",
      volume: 100,
      pitch:  100,
      pan:    0
    };
    AudioManager.playSe(sound);

Where soundFile is the name of the audio file from your SE folder WITHOUT the extension.
(You'd replace the highlight line in the pictured code with this.)
this is giving me an error message.
what you added isnt a function. In the linked spreadsheet theres a list of calls to get the database sounds to play under "Play System Sound".
if none of those are the sound you want to play, then as shown above, thats a way to use the regular command to play a sound from within the SE folder
You need to create the sound effect you want like this:
Code:
var sound = {
      name:   "soundFile",
      volume: 100,
      pitch:  100,
      pan:    0
    };
    AudioManager.playSe(sound);

Where soundFile is the name of the audio file from your SE folder WITHOUT the extension.
(You'd replace the highlight line in the pictured code with this.)
what you added isnt a function. In the linked spreadsheet theres a list of calls to get the database sounds to play under "Play System Sound".
if none of those are the sound you want to play, then as shown above, thats a way to use the regular command to play a sound from within the SE folder
Thank you both so much! I really appreciate the help! It's all working the way I wanted it to now.

Just some quality of life things, but might one of you know how I can keep the augments from greying out and playing the buzzer sound effect when an augment with the "Cannot Detach" notetag is used? Since every single augment in this game will have the "Cannot Detach" notetag, these effects shouldn't be necessary.
Glad the Sound thing is working for ya.

Using a Cannot Detach Augment turns off a flag that prevents interacting with the slot (Graying it out).

@Robro33 listed the correction AND you said it worked...
This works, thank you!
So I'm unsure of what the problem here is.
So I'm unsure of what the problem here is.
Not necessarily a "problem", I'm just not a fan of the super annoying buzzer sound effect that plays when you press space on an augment slot that has an augment with the "Cannot Detach" effect in it.
If they ALL NEED to have CANNOT DETACH, then I struggle to understand why you don't just use the Upgrade Slots plugin alone.
Perhaps if you help us with this, maybe I can help find a solution.
(I have made a few extension plugins for the Augment plugin and am pretty familiar with that and the Upgrade plugin.)
I struggle to understand why you don't just use the Upgrade Slots plugin alone.
Well...
The issue with that is that the item upgrades are far more limited in terms of what they can do. The only significant changes I can make to the equipment is increasing or decrease its base stats; everything else is just cosmetic. However, with the attachable augments I can make the enchantments increase or decrease the equipment's base stats, parameters, state, debuff, and element rates, and even add skills and change the price of the item. Also, decreasing the boost count wouldn't remove the upgrades from the list on the side
Also, upon binding the enchantments to the equipment, they're supposed to disappear from list on the side, allowing you to add new enchantments and preventing them from running off the bottom of the screen and being unviewable.

In short, there are two main factors;
  1. Attachable Augments lets me create a much more diverse array of different enchantments with unique effects
  2. I don't know how to remove the upgrades from the upgrade list on the side without removing their effects.
So, basically, if you could remove the item add list, you'd be fine, cause you can do EVERYTHING you listed here with both plugins. The under-the-hood difference is that the augments are designed to be removable.
So if you intend for all items to hold infinite upgrades, then I can look into removing the slots and limits.

EDIT: NVM. YF already had params to remove the slots and printed upgrades being shown.
So all I'd have to do is make a snippet to keep the open slot count from being adjusted.
So, basically, if you could remove the item add list, you'd be fine, cause you can do EVERYTHING you listed here with both plugins. The under-the-hood difference is that the augments are designed to be removable.
So if you intend for all items to hold infinite upgrades, then I can look into removing the slots and limits.
I think the ideal scenario would be; every piece of equipment has a max of 5 upgrade slots, and once the boost count of an item reaches 5, it can "evolve", causing the enchantments to be permanently absorbed into the item and disappear from the upgrade list on the side, and bringing the boost count back to 0.

Either that, or just give the player the ability to scroll through the list of enchantments (upgrades) so that after 5 of them they don't run off the bottom of the screen and become unviewable. In retrospect, a lot of this was my attempts at working around this specific aspect of the plugin (that, and the greater utility of the augment plugin without needing programing knowledge).

I want to keep the info window, but I don't want the enchantments to get cut off at the bottom of the screen like this ↓;
My issue here is that if the items get absorbed and disappear anyway, you don't really need them to be shown.
I will admit that I do a very similar thing in my game where you can put 10 items on an item them. But in my case, the item itself is destroyed so the list being present is fine. But if you want to just want to keep piling them on the same equipment, the list itself will become a mess if you leave it as I do not believe YF allows scrolling thru it. I feel the item screen itself showing the stats is enough and if you needed to show more (like crit percentage, etc.), then maybe redoing the item screen itself might be a solution, even if you'd need some coding know-how.

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-plugins-how-to-make-an-item-upgrade-that-clears-the-augments-on-that-same-item.180064/