MV Equipment requirements Issue

Ok, so I don't entirely know if this issue is a plugin issue so if this is the wrong place to put this, I apologize. I got yanfly's equip requirement plugin working but am having an issue with equipment not unequipping when the required equipment is no longer equipped. For example: Thunder blade gets equipped to be able to use the thunder helm. Now you equip the thunder blade, but then get a better weapon later on. When the new weapon is equipped, the thunder helm stays equipped and does not unequip like I want it to. How would I go at fixing this? Thank for any help and again, sorry if this is the wrong spot to post this.
Plugin: http://www.yanfly.moe/wiki/Equip_Requirements_(YEP)
That's not a functionality of that plugin.

You would have to use something like waynee's On Equip Eval and add JavaScript to every item that's a prerequisite for something else, which scans the actor's equipped items and removes any that no longer meet their requirements.
That's not a functionality of that plugin.

You would have to use something like waynee's On Equip Eval and add JavaScript to every item that's a prerequisite for something else, which scans the actor's equipped items and removes any that no longer meet their requirements.
Ok So I have the code in the notetags, but what would the actual javascript look like inside?
1697461210048.png

Would it be better the put the on equip or on remove? Would it be better for one of them to be on the weapon instead of the armor?
Bumping this because I need to know if I am doing this right.
There doesn't appear to be an on remove tag? Which would mean whenever you equip anything you would have to check the notetags of the other equipped items and remove them if their requirements aren't met.

Edit: Ok, Waynee's plugin does have a remove eval. So you only have to run the check when you remove the items that are part of a set
There doesn't appear to be an on remove tag? Which would mean whenever you equip anything you would have to check the notetags of the other equipped items and remove them if their requirements aren't met.

Edit: Ok, Waynee's plugin does have a remove eval. So you only have to run the check when you remove the items that are part of a set
Ok, I do apologize, but I am a bit confused as to what you mean. I know about the on remove eval part, but the issue is I don't know whether it goes on the armor that requires the blade or the blade itself. I also don't know what the code needs to be in the eval in the first place. What would I put for the code part?
Ok, I do apologize, but I am a bit confused as to what you mean. I know about the on remove eval part, but the issue is I don't know whether it goes on the armor that requires the blade or the blade itself. I also don't know what the code needs to be in the eval in the first place. What would I put for the code part?
It would have to go on the blade. You want:
Unequip blade>
if(character has armor id x equipped){unequip armor}

There is a script call thread to look up the exact syntax for this
It would have to go on the blade. You want:
Unequip blade>
if(character has armor id x equipped){unequip armor}

There is a script call thread to look up the exact syntax for this
So it would look like this, right?
1698245537634.png

So I tried it like that and when I unequipped the blade afterwards it gave me this error:
1698245689418.png
That looks like you just made up syntax instead of getting it from the script call list. What does the script call list say to use?

You're also just checking if actor (you don't even clarify which actor) has an armor, there's no command to actually remove it.
That looks like you just made up syntax instead of getting it from the script call list. What does the script call list say to use?

You're also just checking if actor (you don't even clarify which actor) has an armor, there's no command to actually remove it.
1698249491561.png

Used the one that is on the list. Also, is there no way to make it check all actors instead of a specific one?
View attachment 281428
Used the one that is on the list. Also, is there no way to make it check all actors instead of a specific one?

That's generalized syntax, the bold are variables that need to be changed to the actorId, or a reference to an actor, and the armorId, or a reference to one.

If you scroll to the right of that it shows examples:
// Does actor 5 have armor 13 equipped?
$gameActors.actor(5).hasArmor($dataArmors[13])

So it would look something like:

if($gameActors.actor($gameParty._targetActorId).hasArmor($dataArmors[66]){
$gameActors.actor($gameParty._targetActorId).changeEquip(2, $dataArmors[0]);
}

The 2 is the armor type, where
0 is shield
1 is head
2 is body
3 is accessory
That's generalized syntax, the bold are variables that need to be changed to the actorId, or a reference to an actor, and the armorId, or a reference to one.

If you scroll to the right of that it shows examples:
// Does actor 5 have armor 13 equipped?
$gameActors.actor(5).hasArmor($dataArmors[13])

So it would look something like:

if($gameActors.actor($gameParty._targetActorId).hasArmor($dataArmors[66]){
$gameActors.actor($gameParty._targetActorId).changeEquip(2, $dataArmors[0]);
}

The 2 is the armor type, where
0 is shield
1 is head
2 is body
3 is accessory
Ok, but how would I go at making it check all actors instead of a specific actor? Still a bit confused about some of this. Would I do the same on the blade for both pieces of armor that require the blade?
Ok, but how would I go at making it check all actors instead of a specific actor? Still a bit confused about some of this. Would I do the same on the blade for both pieces of armor that require the blade?
Then you would need to write a loop to go through the entire party but... I don't think that's what you want? That would be saying, "When I unequip the thunderblade from an actor, check if anyone in the party has armor 66 or 67 equipped. Then unequip the armor from that person."

You put in the script whichever pieces of armor to check for and remove

JavaScript:
if($gameActors.actor($gameParty._targetActorId).hasArmor($dataArmors[66]){
    $gameActors.actor($gameParty._targetActorId).changeEquip(2, $dataArmors[0]);
}

if($gameActors.actor($gameParty._targetActorId).hasArmor($dataArmors[67]){
    $gameActors.actor($gameParty._targetActorId).changeEquip(1, $dataArmors[0]);
}

Make sure the armor type is correct. I assumed 66 is body armor (2) and 67 was the helmet (1).
Or instead of 2 and 1 I believe you can replace 2 and 1 with
$dataArmors[66].etypeId-1
$dataArmors[67].etypeId-1
to get its armor type automatically
Then you would need to write a loop to go through the entire party but... I don't think that's what you want? That would be saying, "When I unequip the thunderblade from an actor, check if anyone in the party has armor 66 or 67 equipped. Then unequip the armor from that person."

You put in the script whichever pieces of armor to check for and remove

JavaScript:
if($gameActors.actor($gameParty._targetActorId).hasArmor($dataArmors[66]){
    $gameActors.actor($gameParty._targetActorId).changeEquip(2, $dataArmors[0]);
}

if($gameActors.actor($gameParty._targetActorId).hasArmor($dataArmors[67]){
    $gameActors.actor($gameParty._targetActorId).changeEquip(1, $dataArmors[0]);
}

Make sure the armor type is correct. I assumed 66 is body armor (2) and 67 was the helmet (1).
Or instead of 2 and 1 I believe you can replace 2 and 1 with
$dataArmors[66].etypeId-1
$dataArmors[67].etypeId-1
to get its armor type automatically
So 66 is the helm and 67 in the body armor, so 66 would be (2) and 67 would be (3)? Or does the shield start by 0 instead of 1?
It should look like this?
1698252854428.png
1698252884756.png
So 66 is the helm and 67 in the body armor, so 66 would be (2) and 67 would be (3)? Or does the shield start by 0 instead of 1?
The shield is 0. So it may make your life easier to make the script look up the equipment type automatically, i.e.

JavaScript:
if($gameActors.actor($gameParty._targetActorId).hasArmor($dataArmors[66]){
    $gameActors.actor($gameParty._targetActorId).changeEquip($dataArmors[66].etypeId-1, $dataArmors[0]);
}
if($gameActors.actor($gameParty._targetActorId).hasArmor($dataArmors[67]){
    $gameActors.actor($gameParty._targetActorId).changeEquip($dataArmors[67].etypeId-1, $dataArmors[0]);
}
The shield is 0. So it may make your life easier to make the script look up the equipment type automatically, i.e.

JavaScript:
if($gameActors.actor($gameParty._targetActorId).hasArmor($dataArmors[66]){
    $gameActors.actor($gameParty._targetActorId).changeEquip($dataArmors[66].etypeId-1, $dataArmors[0]);
}
if($gameActors.actor($gameParty._targetActorId).hasArmor($dataArmors[67]){
    $gameActors.actor($gameParty._targetActorId).changeEquip($dataArmors[67].etypeId-1, $dataArmors[0]);
}
Ok, so I would put the Actor ID number in the target actor id part correct?
Edit: So I tried it with the actor id number in the target ActorID part and when I unequipped the blade, it gave me this error:
1698253212406.png
Ok, so I would put the Actor ID number in the target actor id part correct?
No, you leave it as is, because you want the script to run on the actor you're unequipping from. If you give it an exact number it will check the equipment of and remove the equipment of whichever actor is that id number, regardless of who you're unequipping.
No, you leave it as is, because you want the script to run on the actor you're unequipping from. If you give it an exact number it will check the equipment of and remove the equipment of whichever actor is that id number, regardless of who you're unequipping.
Ok, so I also tried it with the regular setup and got this error when trying to take off the sword:
1698253355000.png
Ok, so I also tried it with the regular setup and got this error when trying to take off the sword:
View attachment 281433
That means there's an extra curly brace in the syntax or it's missing the first closing one. Did you copy/type it in exactly as I posted?
@slickdeath97 Did you read the instructions for the plugin you're using? They say
This code will run when an actor unequips the item. You can use 'user' or 'a' to reference the actor who unequipped the item.

I don't understand why you'd go messing around with stuff looking for and referencing actor IDs.

Original thread: https://forums.rpgmakerweb.com/threads/equipment-requirements-issue.162051/