How to check if a specific type of armor is equipped

I feel a bit embarrassed by this one, since there actually are SEVERAL responses to this question on the forum over the years, however after a couple of hours experimenting with the solutions presented, I'm still not able to get it working.

I simply need to check if actor 1 is wearing any pairs of gloves (he is trying to handle a scalding hot pan).

There have been several scripts suggested to use in a conditional event, but I haven't been able to get any of them working after extensive testing.

2022-11-01 02_57_57-Database.png


This would indicate that the equip slot to check for would be 6 if I'm checking for gloves.

I'm using
Code:
!$game_actors[1].equips[6].nil?
but it isn't working.

If anyone has any ideas it'd be a great help. Thank you!

c
That looks like Ruby, not JavaScript. Probably a VX Ace script call or something.

Try Conditional Branch -> Script:

!!$gameActors.actor(1).equips()[6]
I.e. "does actor ID 1 have something equipped in slot index 6?" The first equip slot is index 0.

(Strictly speaking the !! in front isn't necessary here, but it's good form. It just converts the output to boolean, i.e. true/false, but JS will auto-convert if needed.)
That looks like Ruby, not JavaScript. Probably a VX Ace script call or something.

Try Conditional Branch -> Script:

!!$gameActors.actor(1).equips()[6]

I.e. "does actor ID 1 have something equipped in slot index 6?" The first equip slot is index 0.

(Strictly speaking the !! in front isn't necessary here, but it's good form. It just converts the output to boolean, i.e. true/false, but JS will auto-convert if needed.)

Hi caethyril!

Unfortunately this isn't working as written. yet ... here's what I have so far, I'm keeping it real simple for testing (pardon the weird tint, my screenshot software doesn't know how to ignore my nighttime monitor tinting software lol)

2022-11-02 21_28_23-Conditional Branch.png


2022-11-02 21_28_41-ID_021 - Event Editor.png


I've confirmed over and over that it's actor 1, and that they're wearing equip 6 (gloves). But I keep getting "not wearing gloves".

Any thoughts as to what might be going wrong?

Thank you as always!!

EDIT: I got it working, I forgot that the equipment index starts from ZERO, not one, so changing from 6 to 5 got it working 🙂 🙂

You rock as usual @caethyril, couldn't do it without you!!

I'll report as closed.

c

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/how-to-check-if-a-specific-type-of-armor-is-equipped.152387/