MV Variable = Equipped Weapon/Armor

I want to control a variable so it equals the piece of armor currently equipped in a certain character's certain armor slot.
I can already make it equal "Actor A's Max HP" But I want it to equal "Actor A's Currently Equipped Helmet"
Yeah, that's not one of the options under Game Data in Control Variables.

If you're not using any plugins that customize slots, I think this should work:

JavaScript:
$gameActors.actor(12).equips()[9 -1].id

Replace 12 with the ID of actor A and 9 with the ID of the helmet slot (under Equipment Types, not Armor Types).
I want to control a variable so it equals the piece of armor currently equipped in a certain character's certain armor slot.
I can already make it equal "Actor A's Max HP" But I want it to equal "Actor A's Currently Equipped Helmet"
Conditional Branch that the actor is wearing the armor then that changes a variable to what you want.
That's the way to go if you only need to check for a few specific armours, yeah. But if you want it to be able to handle every armour, it's not a great solution.
Yeah, that's not one of the options under Game Data in Control Variables.

If you're not using any plugins that customize slots, I think this should work:

JavaScript:
$gameActors.actor(12).equips()[9 -1].id

Replace 12 with the ID of actor A and 9 with the ID of the helmet slot (under Equipment Types, not Armor Types).
I think if he have multiple helmets, maybe extend it:

[1,2,3,4,5,6,7,8,9].some(armor => $gameActors.actor(12).equips()[armor -1].id)

unless in can use includes version? but I don't know how to check the index this way.
unsure if armor index start with 0 too, or as 1?
I want the save screen (I'm using Yanfly's save core) to show currently equipped gear.

Original thread: https://forums.rpgmakerweb.com/threads/variable-equipped-weapon-armor.182009/