MV [Yanfly] Help with set bonus passive condition/Or operator

Hello there!
I'm attempting to implement a set bonus system to my game, where if the player wears certain sets of clothing, they'll gain a passive state that gives them a bonus. below is the custom passive condition code I tried using to achieve this effect

JavaScript:
if (user.hasArmor($dataArmors[2])) || if (user.hasArmor($dataArmors[3])) && if (user.hasArmor($dataArmors[4])) || if (user.hasArmor($dataArmors[5])) {
condition = true;
} else {
condition = false;
}

basically it checks if players is wearing armor 2 OR 3, alongside armor 4 OR 5, but for some reason, whenever I try to run the game with those code in the passive condition, I get a crash

Spoiler: crash image
1691131439343.png

As far as I'm able to tell, I used the "or" operator correctly, so I'm not quite sure what the issue is. Would anyone mind pointing it out to me and how I could fix this?

EDIT 1:
I've also tried the following alternatives for my above code but I still receive and error regarding the or operator
Spoiler: alternative code that I tried that didn't work
JavaScript:
if (user.hasArmor($dataArmors[2])) || (user.hasArmor($dataArmors[3])) && (user.hasArmor($dataArmors[4])) || (user.hasArmor($dataArmors[5])) {
condition = true;
} else {
condition = false;
}
JavaScript:
if (user.hasArmor($dataArmors[2])) || if (user.hasArmor($dataArmors[3])) {
   if (user.hasArmor($dataArmors[4])) || if (user.hasArmor($dataArmors[5])) {
   condition = true;
   } else {
   condition = false;
   }
else {
condition = false;
}
}
JavaScript:
if (user.hasArmor($dataArmors[2])) || if (user.hasArmor($dataArmors[3])) && if (user.hasArmor($dataArmors[4])) || if (user.hasArmor($dataArmors[5])) {
condition = true;
} else {
condition = false;
}
[/SPOILER]

So the issue with this code is that you have unnecessary If statements and extra parentheses where there shouldn't be.

It should look like this instead:

JavaScript:
if (user.hasArmor($dataArmors[2]) || user.hasArmor($dataArmors[3]) && user.hasArmor($dataArmors[4]) || user.hasArmor($dataArmors[5])) {
condition = true;
} else {
condition = false;
}
So the issue with this code is that you have unnecessary If statements and extra parentheses where there shouldn't be.

It should look like this instead:

JavaScript:
if (user.hasArmor($dataArmors[2]) || user.hasArmor($dataArmors[3]) && user.hasArmor($dataArmors[4]) || user.hasArmor($dataArmors[5])) {
condition = true;
} else {
condition = false;
}
I see, I did guess that the extra if statements were wrong, but not the parenthesis. I guess my lack of coding knowledge lead me to believe those extra parenthesis were needed

despite that however i found that the code didn't work properly and I could get the passive state by only wearing one piece of the armor set. luckily I was able to fix this but altering the code to look like this instead:

JavaScript:
if (user.hasArmor($dataArmors[2]) || user.hasArmor($dataArmors[3])) {
   if (user.hasArmor($dataArmors[4]) || user.hasArmor($dataArmors[5])) {
   condition = true;
   } else {
   condition = false;
   }
} else {
condition = false;
}

regardless, I couldn't have done this without your help. thank you both for helping and for your time in general.
or shorten it with
JavaScript:
if (user.hasArmor($dataArmors[2]) || user.hasArmor($dataArmors[3]) && user.hasArmor($dataArmors[4]) || user.hasArmor($dataArmors[5])) {
   condition = true;
   } else {
   condition = false;
   }

as || after the condition is closed wont work and nested can give trouble if they check it vice versa and never is true either,
resulting to false unless you have the armor 2 and 3 🙂

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-help-with-set-bonus-passive-condition-or-operator.160009/