Check if party leader has a weapon <Resolved>

Hey all!

An event I am making needs to know whether the player has a weapon equipped or not. I don't care what weapon, any weapon will do, but if they don't have one my event will make a treasure chest contain a weapon for them to use, as apposed to some other random thing.

Additionally, if you know how I could do this with every equipment slot, that would be really good. There are five in my game, being weapons, shields, armour, rings and trinkets. I'm not sure if that is important info but I'm putting everything that might be helpful in here.

Any help you could provide would be appreciated, and if there is no way to do this in the base engine then a plugin that could do this would also be helpful.

Thanks for reading, and have a nice day!
Use the conditional branch with "script" (on page 3 I believe) and copy paste this:

Code:
$gameParty.members()[0].weapons().length > 0

This will check if the first party member has at least one weapon equipped.
As above! Party leader is index [0], swap the number for 1, 2, 3, etc if you need to check other party members~

You can use a similar approach for armors if needed: just replace weapons() with armors(). 🙂

For specific equip slots, I'd suggest this instead (Conditional Branch > Script):
Code:
$gameParty.members()[index].equips()[slotId] !== null
This should return true if that slot has equipment in it, else false. Replace:
  • index with the position of the actor in the party (0 for the leader, 1 for first follower, etc) and
  • slotId with the ID of the equip slot you want to check (0 for first slot, 1 for second slot, etc).
So, for example, this would return true if the party leader has a ring equipped:
Code:
$gameParty.members()[0].equips()[3] !== null
Works like a charm! Thank you both!

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/check-if-party-leader-has-a-weapon-resolved.108768/