Check if party leader has a weapon <Resolved>

Status
Not open for further replies.

marbeltoast

Your future fish emporer
Veteran
Joined
Nov 11, 2018
Messages
80
Reaction score
28
First Language
English
Primarily Uses
RMMV
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!
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,729
Reaction score
4,682
First Language
English
Primarily Uses
RMMZ
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.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,087
Reaction score
1,508
First Language
EN
Primarily Uses
RMMZ
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
 

marbeltoast

Your future fish emporer
Veteran
Joined
Nov 11, 2018
Messages
80
Reaction score
28
First Language
English
Primarily Uses
RMMV
Works like a charm! Thank you both!
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,835
Reaction score
5,221
First Language
Dutch
Primarily Uses
RMXP

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.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,977
Members
137,563
Latest member
cexojow
Top