MZ VisuStella Item and Equip question

I was wondering if there is a method to disable certain armor to be equipped if you have another equipped.
For example, if you have the "Light Sword" (Weapon) equipped you can't equip the "Dark Gauntlets". (Armor) and vice-versa.
By default there is only a general seal option - like sealing the shield slot for every two-handed weapon equipped.

What might be possible is to have equip requirement notetags to check with javascript what else is equipped, but that would either require a very long list of javascript checks or be limited to very few interactions of specific items.
Sure! Are ya using any plugins for your project?
I may have overlooked it, but I surprisingly didn't see any relevant note tags for this in the help documentation for VS Items and Equips Core. Since I may actually want to do something similar to this some day, I went ahead and wrote a plugin that allows you to use a JavaScript note tag to determine whether or not a weapon/armor can be equipped.

With my plugin installed, and pretending that your Light Sword has an ID of 23, and your Dark Gauntlets has an ID of 102:

Put this in the note box of your Light Sword:
Code:
<JS Equip Enable>
 enabled = !user.hasArmor($dataArmors[102]);
</JS Equip Enable>

And put this in the note box of your Dark Gauntlets:
Code:
<JS Equip Enable>
 enabled = !user.hasWeapon($dataWeapons[23]);
</JS Equip Enable>

Then you will only be able to wear one or the other at any given time. You can use any JavaScript you want within the note tag. These variables will be available to you:
- The 'enabled' variable stores a boolean value that will determine if the
armor/weapon will be enabled or not.
- The 'user' variable refers to the user that is trying to equip the item.
- The 'item' variable refers to the armor/weapon in question.

Btw, if you have VS Items and Equip Core installed, then my plugin needs to be lower than it in the plugin list. Also, I didn't test it super extensively, so let me know if there are any issues.
You might also try using passive traits with VS Skills and States Core. Simply add a state (trait) when equipping one set of armor that seals the other, undesirable equipment.
You might also try using passive traits with VS Skills and States Core. Simply add a state (trait) when equipping one set of armor that seals the other, undesirable equipment.
I think I might be misunderstanding you, because I don't see how that solves the OP's issue. Are you talking about using the "Seal Equip" trait? If so, why use a passive state, instead of directly attaching the trait to the item?

And more importantly, "Seal Equip" requires you to seal an entire equipment slot, whereas to my understanding, the OP just wants to disable one specific item while still allowing you to equip other items in that slot. For example, they want to prohibit you from equipping the Dark Gauntlets, but still allow you to equip other gauntlets.

But I could be completely off-base in my understanding of what you were talking about. If so, could you please elaborate?
I may have overlooked it, but I surprisingly didn't see any relevant note tags for this in the help documentation for VS Items and Equips Core. Since I may actually want to do something similar to this some day, I went ahead and wrote a plugin that allows you to use a JavaScript note tag to determine whether or not a weapon/armor can be equipped.

With my plugin installed, and pretending that your Light Sword has an ID of 23, and your Dark Gauntlets has an ID of 102:

Put this in the note box of your Light Sword:
Code:
<JS Equip Enable>
 enabled = !user.hasArmor($dataArmors[102]);
</JS Equip Enable>

And put this in the note box of your Dark Gauntlets:
Code:
<JS Equip Enable>
 enabled = !user.hasWeapon($dataWeapons[23]);
</JS Equip Enable>

Then you will only be able to wear one or the other at any given time. You can use any JavaScript you want within the note tag. These variables will be available to you:


Btw, if you have VS Items and Equip Core installed, then my plugin needs to be lower than it in the plugin list. Also, I didn't test it super extensively, so let me know if there are any issues.
I used this plugin you provided and works like a charm.
I used this plugin you provided and works like a charm.
However, in my game, I have a series of items that need to be unequippable when one of them is equipped. Namely an "Dark" equipment cannot be worn if you have "Light" equipment. I tried to use this on more than just one armor/weapon but it only cancels out one of them.
There are a few ways you could go about it. I guess I'll go with one that's a bit tedious, but reasonably straightforward.

Suppose that your light weapons have IDs of 21-25. Your light armors have IDs of 26-30. Your dark weapons have IDs of 31-35, and your dark armors have IDs of 36-40.

You would put this in the note tag of every light item:
Code:
<JS Equip Enable>
 const darkWeaponIds = [31, 32, 33, 34, 35];
 const darkArmorIds = [36, 37, 38, 39, 40];
 
 for (const id of darkWeaponIds) {
     if (user.hasWeapon($dataWeapons[id])) {
         enabled = false;
     }
 }
 for (const id of darkArmorIds) {
     if (user.hasArmor($dataArmors[id])) {
         enabled = false;
     }
 }
</JS Equip Enable>

And put this in the note tag of every dark item:
Code:
<JS Equip Enable>
 const lightWeaponIds = [21, 22, 23, 24, 25];
 const lightArmorIds = [26, 27, 28, 29, 30];
 
 for (const id of lightWeaponIds) {
     if (user.hasWeapon($dataWeapons[id])) {
         enabled = false;
     }
 }
 for (const id of lightArmorIds) {
     if (user.hasArmor($dataArmors[id])) {
         enabled = false;
     }
 }
</JS Equip Enable>

Just change the first two lines of each script to reflect the actual IDs in question. You can use any amount of IDs, as long as they are separated by commas.
Howdy! You could also try going this route as well so you don't have to get the IDs of each individual item ID and instead use the equipment type.

Using FOSSIL to enable Bobstah's Enhanced Restrictions (it may work without FOSSIL, untested).

Then use the following notetags on your dark/light equipment where x equals the opposite dark/light ID to the equipment. So Light ID is 1 and Dark ID is 2 for example.

Dark Equipment
<Restrict>
!Weapon: 1
!Armor: 1
</Restrict>

Light Equipment
<Restrict>
!Weapon: 2
!Armor: 2
</Restrict>

To equip a dark equipment you can not have any weapon/armor type of 1 (light) equipped.
To equip a light equipment you can not have any weapon/armor type of 2 (dark) equipped.

---

Other notetags from the plugin file (these can be inverted by adding ! to the beginning)

This will restrict the equipment to only actor 1.
<Restrict>
Actor:1
</Restrict>

This will restrict the equipment to everyone but actor 1.
<Restrict>
!Actor:1
</Restrict>

Code:
<Restrict>
LevelMin: X - Minimum level
LevelMax: X - Maximum level
Class: ID - Actor must be class ID
Actor: ID - Actor must be this ID
State: ID - Actor must have state ID applied
Weapon: ID - Actor must be wearing this weapon
Armor: ID - Actor must be wearing this armor
StatMin(Symbol): X - Stat Symbol must be at least X
StatMax(Symbol): X - Stat Symbol must be at most X
Switch(ID): On/Off - Switch ID must be on/off
VarMin(ID): X - Variable ID must be at least X
VarMax(ID): X - Variable ID must be at most X
Custom: $(codeHere) - Run some Javascript
</Restrict>
I think I might be misunderstanding you, because I don't see how that solves the OP's issue. Are you talking about using the "Seal Equip" trait? If so, why use a passive state, instead of directly attaching the trait to the item?

And more importantly, "Seal Equip" requires you to seal an entire equipment slot, whereas to my understanding, the OP just wants to disable one specific item while still allowing you to equip other items in that slot. For example, they want to prohibit you from equipping the Dark Gauntlets, but still allow you to equip other gauntlets.

But I could be completely off-base in my understanding of what you were talking about. If so, could you please elaborate?
You're right, I don't know why I forgot you can seal equip with weapon or armor.

In that case, the OP could create different weapon and armor types ('Light Sword', 'Dark Sword', 'Light Armor', 'Dark Armor') and just seal opposite types traits on each piece of equipment. EDIT: I see Selenity proposed something similar. Though, for the player, I could see that becoming frustrating when finding new equipment, if you have to first unequip all of your light equipment to see a new piece of dark equipment.

Your plugin appears more versatile if the situation is not so simple, for sure.
Could use custom js on equip eval to make it so when you equip a Dark-type item it will check the players equipment for all Light-type items and unequip them and then equip the Dark-type item. And vice versa for light equipment.
There are a few ways you could go about it. I guess I'll go with one that's a bit tedious, but reasonably straightforward.

Suppose that your light weapons have IDs of 21-25. Your light armors have IDs of 26-30. Your dark weapons have IDs of 31-35, and your dark armors have IDs of 36-40.

You would put this in the note tag of every light item:
Code:
<JS Equip Enable>
 const darkWeaponIds = [31, 32, 33, 34, 35];
 const darkArmorIds = [36, 37, 38, 39, 40];
 
 for (const id of darkWeaponIds) {
     if (user.hasWeapon($dataWeapons[id])) {
         enabled = false;
     }
 }
 for (const id of darkArmorIds) {
     if (user.hasArmor($dataArmors[id])) {
         enabled = false;
     }
 }
</JS Equip Enable>

And put this in the note tag of every dark item:
Code:
<JS Equip Enable>
 const lightWeaponIds = [21, 22, 23, 24, 25];
 const lightArmorIds = [26, 27, 28, 29, 30];
 
 for (const id of lightWeaponIds) {
     if (user.hasWeapon($dataWeapons[id])) {
         enabled = false;
     }
 }
 for (const id of lightArmorIds) {
     if (user.hasArmor($dataArmors[id])) {
         enabled = false;
     }
 }
</JS Equip Enable>

Just change the first two lines of each script to reflect the actual IDs in question. You can use any amount of IDs, as long as they are separated by commas.
This code did exactly what I needed it to. Thanks, for the help.

@Silenity The plugin @Arthran provided every I needed it to, though thanks for the suggestion.

Original thread: https://forums.rpgmakerweb.com/threads/visustella-item-and-equip-question.151857/