Checking if Armor is equipped doesn't work

Hi,

I 'm trying to check if a certain armor is equipped with $gameParty.isAnyMemberEquipped("Hero 1").
If it's true it should change a variable. I have attached a picture with what I did, but the problem is that it simply doesn't work.
I don't get an error but the varibale doesn't change. What am I doing wrong?
Hi,

I 'm trying to check if a certain armor is equipped with $gameParty.isAnyMemberEquipped("Hero 1").
If it's true it should change a variable. I have attached a picture with what I did, but the problem is that it simply doesn't work.
I don't get an error but the varibale doesn't change. What am I doing wrong?

I thought isAnyMemberEquipped() dosen't require name but object.

I don't know 'Hero 1' is what object, but I can show one example.
Code:
$gameParty.isAnyMemberEquipped($dataWeapons[1])

Hope this reply help🙂

Edit:
Armor is also OK.
Code:
$gameParty.isAnyMemberEquipped($dataArmors[4])
I thought isAnyMemberEquipped() dosen't require name but object.

I don't know 'Hero 1' is what object, but I can show one example.
Code:
$gameParty.isAnyMemberEquipped($dataWeapons[1])

Hope this reply help🙂

Edit:
Armor is also OK.
Code:
$gameParty.isAnyMemberEquipped($dataArmors[4])

Thanks, this does work. But I have another question. How can I find out in which slot the armor is equipped?
For example: If the armor is an accessory I want to change a certain variable to 1.

I tried doing this:
Code:
hero1 = $game_actors[1].equips[5]
if !hero1.nil? && hero1.name.eql?("Hero 1")
$gameVariables.setValue(45, 1);
end

But I always get an error: Unexpected Token.
Please let me confirm the one question.
You are using RMMV , aren't you ?
But, your code looks like RGSS.
You get an error for that reason.

OK, anyway, 'etypeId' is the equip number in RMMV.

For example.
Code:
$dataArmors[4].etypeId


More example.
Checking if Actor1 is equipped Armor1.
Code:
$gameActors.actor(1).isEquipped($dataArmors[1])
Spoiler: Sample Image
WS000038.JPG


This sample does not use 'etypeId' because if you know what equip is equipped, you can know the equip is what type beforehand.
In other words,It seems unnecessary to know the equipment type.
And...To tell the truth, this is not need script.You can do the same thing at an event.

Hmm...but, I can not figure out what you want to do.
This reply may not be useful.
If so, my bad, and please explain a little more what you are going to do.
Yes, I'm using RPGMV. I found these codes at the internet so I wasn't sure if it's the right one.

Alright, so here is what I'm trying to do:
I added two new equipment types called Card slot 1 and Card slot 2. Now everytime I start a battle I want to summon Card 1 (But only if it is equipped).
But for this, I need to know what card is in slot 1 and save it into a variable.

For example:
Hero 3 is at Card slot 1->Set Variable Slot 1 to 3->Summon Hero 3 at battle.
Hero 5 is at Card slot 1->Set Variable Slot 1 to 5->Summon Hero 5 at battle.

And of course I need to do the same with Card slot 2:
Hero 4 is at Card slot 2->Set Variable Slot 2 to 4->Only summon Hero 4 after Card Slot 1 is defeated.
Gotcha !

First code.
Code:
$gameActors.actor(1).equips()[1]

actor(1) means Actor1, of course.

equips()[1] means equipped type 1.
If you set 'equips()[2]',then means equipped type 2.

And...I recognized you want to know Hero name.

Next code.
Code:
$gameActors.actor(1).equips()[1].name

This return the equipment name of slot1 equipped with Actor1(for example 'Hero 3').

This is what you wanted!


If I still misunderstand, excuse me, and please more information or mention what is my mistaken.
Hope this reply help !
Thank you very much! Everything works like I intended it to be.

Original thread: https://forums.rpgmakerweb.com/threads/checking-if-armor-is-equipped-doesnt-work.82964/