MV Yanfly Equip core - How to make it so you cannot equip 2 of the same item (but still have 2 accessory slots)

I'm actually calling them "pendants", not accessories, but that's not very important.

The fact that you can equip any 2 pendants you like is a core part of the game, however, I want to make it
so that, at least for some pendants, you can't equip 2 of the same one on a single character. For balancing reasons, naturally.
For instance, you can equip pendant a and b, pendant b and a, pendant f and c, ect, but you cannot say for instance, equip pendant a and a.

The concept is fairly straight forward, thing is, there doesn't seem to be a function for this built into the plugin at all, at least that I noticed. If anyone has a solution, it would be much appreciated, and the sooner the better, as I'm releasing a new demo at the end of the month, first impressions are important, and the ability to set this up would significantly improve the games balance!
If anyone can make a script for it, I'd be more than happy to pay them.

Thankyou VERY much in advance😢
The concept is fairly straight forward, thing is, there doesn't seem to be a function for this built into the plugin at all, at least that I noticed
Yanfly has an entire plugin for the purpose of specifying conditions for when something should be equippable.

you can try and set up a <Custom Equip Requirement Condition> and use
Code:
!user.isEquipped($dataArmors[999])
to specify that your Pendant A cannot be equipped when Pendant B (ID: 999) is equipped
I can verify that

<Custom Equip Requirement Condition>

if !user.isEquipped($dataArmors[10]) {

condition = true;

} else {

condition = false;

}

</Custom Equip Requirement Condition>

and

<Custom Equip Requirement Condition>
!user.isEquipped($dataArmors[999])
</Custom Equip Requirement Condition>

Do absolutely nothing.

Please, treat me as you would an infant child. The only things I am capable of is copy pasting what you give me, and changing the number that says what armor to refer to. Unless there's something else going here.
I'm sorry but I'm honestly pretty tired. As always, thankyou very much for your help.

-edit-

Also, before you ask:

Yes, I tried it with a new save
Both of the notetags I showed above
On multiple different armors
I can verify that the standard skill requirement DOES function properly, thus the plugin IS working.
I haven't tried it in a fresh project
The plugin is right underneath Yep_Equip Core which Yanfly said it should go there in the video but I can go comb through the order list and see if somehow that's wrong (it really shouldn't be but ig you never know)

EDIT!! I CRACKED IT!!

The problem was a simple lack of parenthesis. I love syntax 🙂
THIS WORKS:

<Custom Equip Requirement Condition>

if (!user.isEquipped($dataArmors[10])) {

condition = true;

} else {

condition = false;

}

</Custom Equip Requirement Condition>

Thankyou very very much and I must admit I am completely non-validly proud of myself for this 😤
Just to give the advice, this post comes across to me in a very off-putting way.

Please, treat me as you would an infant child. The only things I am capable of is copy pasting what you give me
This seems unnecessary. You could simply say "Can you please provide the complete contents for the notetag?"

I have no interest in helping an infant child make a video game, they should be messing around with sensory toys in a playpen.

I'm sorry but I'm honestly pretty tired.
Nobody is forcing you to write the post. Nothing will be different if you wait 8 hours to write your reply after you've slept.

From the plugin instructions,
1726163270049.png


So putting
Code:
<Custom Equip Requirement Condition>
condition = !user.isEquipped($dataArmors[999]);
</Custom Equip Requirement Condition>

should do exactly what you want, replacing 999 with the ID of the armor that can't be worn at the same time.
Well, I'm forcing me so-
I'm on kinda a tight deadline and struggling to balance not burning myself out with getting things done. I apologize for the tone, it's my tiredness gettin to me 😅
(oh, to be clear I mean mental tiredness not physical)

I did manage to work it out tho, as you can see in my last edit there! ^.^
Thankyou very much to both of you for all that you do, and have certainly done for me. <3
Just to give the advice, this post comes across to me in a very off-putting way.


This seems unnecessary. You could simply say "Can you please provide the complete contents for the notetag?"

I have no interest in helping an infant child make a video game, they should be messing around with sensory toys in a playpen.


Nobody is forcing you to write the post. Nothing will be different if you wait 8 hours to write your reply after you've slept.

From the plugin instructions,
View attachment 317627

So putting
Code:
<Custom Equip Requirement Condition>
condition = !user.isEquipped($dataArmors[999]);
</Custom Equip Requirement Condition>

should do exactly what you want, replacing 999 with the ID of the armor that can't be worn at the same time.

Hey, sorry to ask again, but what if I wanted to check to make sure the player isn't wearing more than just the one armor?
Like, if I had several accessories that boosted the same stats, but you could only wear one at a time.

I tried:


<Custom Equip Requirement Condition>

if (!user.isEquipped($dataArmors[10])) {

condition = true;

} else {

condition = false;

}

if (!user.isEquipped($dataArmors[12])) {

condition = true;

} else {

condition = false;

}

if (!user.isEquipped($dataArmors[14])) {

condition = true;

} else {

condition = false;

}

if (!user.isEquipped($dataArmors[16])) {

condition = true;

} else {

condition = false;

}

</Custom Equip Requirement Condition>

But obviously, it didn't work XD
It's just gonna check for the last armor and none of the others, in the end, which is plain to see in hindsight.
You don't have to but I'd really appreciate a little more help with this 😅

EDIT!! I figured it out! :XP01B:



<Custom Equip Requirement Condition>
if (!user.isEquipped($dataArmors[10])) {
condition = true;
} else {
condition = false;
}
if (!user.isEquipped($dataArmors[12])) {
;
} else {
condition = false;
}
</Custom Equip Requirement Condition>

Works!! ^.^
I am so proud of this. Anyways, thankyou again for all you do <3
the problem is that you keep overwriting the value of condition with every check based only on the current one. the only actual check that matters there is the one for armor 16 since regardless of its result the variable gets overwritten and is the last time its done.

since youre trying to use more than a couple accessories for this, ill make it simple to add on to.
Code:
<Custom Equip Requirement Condition>
const accs = [10,12,14,16];
condition = !accs.some(acc => user.isEquipped($dataArmors[acc]));
</Custom Equip Requirement Condition>
fill the array with the ids of all the accessories it shouldnt be worn with
Oh, thankyou that's so much easier! ^.^
Can also verify it works "perfectly"
I put that in quotes tho because I actually found that when swapping the current accessory, you're still technically wearing it, so you can't swap it to another accessory of the same type.
You'd definitely want to do that too, as this particular set are upgrades to each other.
(had this same problem with my Frankenstein code)

Was planning to put off fixing this for later, but if it's not too much trouble, this is one of the biggies that would def detract from the game if it isn't fixed before public launch 😅
the problem is that you keep overwriting the value of condition with every check based only on the current one. the only actual check that matters there is the one for armor 16 since regardless of its result the variable gets overwritten and is the last time its done.

since youre trying to use more than a couple accessories for this, ill make it simple to add on to.
Code:
<Custom Equip Requirement Condition>
const accs = [10,12,14,16];
condition = !accs.some(acc => user.isEquipped($dataArmors[acc]));
</Custom Equip Requirement Condition>
fill the array with the ids of all the accessories it shouldnt be worn with
when swapping the current accessory, you're still technically wearing it, so you can't swap it to another accessory of the same type.
yanfly's plugin has no way of identifying the current equip slot the way it is afaik.

I dont really see the need to fuss over it either. as long as the player has the ability to choose to remove equipment from their slots, theyll be able to equip the other pendants.
Its a minor inconvenience to the player, but imo, its something you cant really do anything about without editing the JS behind the equip menus. someone else may have an idea
Might request/commission a plugin for that then.
It is only a minor inconvenience for people who know that's what's up, but problem is I think of a lot of my players won't know, and will be very confused. I could try to find some way to explain it, but it'd be very cumbersome to try to do so.
The UI interactions being as intuitive as possible is pretty essential for me, so I'll do what it takes.
Also, the Pendants system is also used for stat upgrades (HP, MP, ect) so it's a very core aspect of the game. Even more important it's intuitive to use.

Thankyou though, you've been a huge help. Even that comment just now told me exactly what path I need to take to get this fixed. I'll have to put a special thanks to both of you in the credits ^.^
yanfly's plugin has no way of identifying the current equip slot the way it is afaik.

I dont really see the need to fuss over it either. as long as the player has the ability to choose to remove equipment from their slots, theyll be able to equip the other pendants.
Its a minor inconvenience to the player, but imo, its something you cant really do anything about without editing the JS behind the equip menus. someone else may have an idea

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-equip-core-how-to-make-it-so-you-cannot-equip-2-of-the-same-item-but-still-have-2-accessory-slots.171841/