get equipped armor id?

is there a way to get the ID of an equipped accessory of a specific armor type and assign it to a variable? i ask this because i have a part of the game where i need to compare it to a different variable to make sure they're not the same, and doing the "if: armor equipped = [x]" thing with every accessory of that type isnt super efficient haha, if theres a way to do this with scripts please let me know!! thank you, i can provide better wording if need be
As a quick tip, MV has been out for a long time - pretty much everything has been asked 😉

So if you were to Google "rpg maker mv script call equip slot" you'd find threads with it in there.

But the function is equips()[slot number].id

The slot numbers start at 0, so if your accessory slot is 5 in your database, you'd look at equips()[4].id

Then you need a point of reference for the actor to put in front of that, which is where your exact usage comes into play.

Are you checking a specific actor? $gameActors.actor(13).equips()[4].id

Are you checking a party member location? Whether anyone in the party has it?
hmm, the script didnt seem to work, although i'm not sure why (i used it in a control variable command, making variable #55 be equal to the id that the script gives you)
also just the main character (actor 1) - using yanfly's equip core they have an equipment slot that no one else has. i just wanna check what that ID is so i can cross reference it with a selected item's ID at some point in the game...
Is the slot a new one you added with the plugin?
nope, i tried without the equip core plugin and the script still get the ID
hmm, the script didnt seem to work, although i'm not sure why
What value do you end up with in the variable? Screenshot of exactly how the script is entered in the game, and one of your equipment slot list? If you press F8 and look at the console, are there any errors?

Just saying "it didn't seem to work" doesn't give us anything to try to help you with 😛
nope, i tried without the equip core plugin and the script still get the ID
Not what I had asked. You said the actor has an equip slot that no one else has. I asked if you added this slot with the plugin.
What value do you end up with in the variable? Screenshot of exactly how the script is entered in the game, and one of your equipment slot list? If you press F8 and look at the console, are there any errors?

Just saying "it didn't seem to work" doesn't give us anything to try to help you with 😛
yes, sorry... not sure what i thought thatd get done lol

i just get returned a 0 😛 attached below are some screenshots of the event stuff and the console when the event is run


1694212450320.png


1694212500735.png

1694212648907.png


hope this helps, sorry for the lack of info before hahaha
If I were to go based off of that image alone, I'd say you were trying to check a slot that apparently doesn't exist. As Turan mentioned, the slot IDs start at 0, so you would need to change that script to
$gameActors.actor(1).equips()[3].id in order to check the fourth slot.

At least I think so. I'm still a bit drowsy at this moment, so I might have misread something.
At least I think so. I'm still a bit drowsy at this moment, so I might have misread something.
Nope, you're exactly right. According to what I see in the screenshot and what I said in my first reply, that's slot 3.
right you are... my bad. not sure why i didn't clock that, thank you

the only other issue is that the returned ID is now in the 3000s? i expected it to be in the 10s or something, equipping armor ID 7 returns 3002 weirdly
no worries i figured out a solution we are all good now
the only other issue is that the returned ID is now in the 3000s?
That means you're using Yanfly's Item Core and have independent items turned on. Per the instructions in the plugin, and what you set up in the parameters, item types with independent items will be placed in a high number range and every single item will have a unique ID.

You would change the script call I gave you above to reference baseItemId and that will return the value you can compare to your database ID.

Original thread: https://forums.rpgmakerweb.com/threads/get-equipped-armor-id.161020/