Status
Not open for further replies.

MarxMayhem

Veteran
Veteran
Joined
Apr 17, 2020
Messages
251
Reaction score
256
First Language
Filipino
Primarily Uses
RMMV
As title says.

I'm making a Monk-class like that from the Bravely series, and I'm trying to make states that checks if a user has no weapon. I know how to check if they have a specific weapon type or armor type, but I'm wondering if there's an easier way of doing this, instead of making the state check through each type (I have 18 weapon types) and switching the condition around.

TIA
 

VVraith

Villager
Member
Joined
Nov 21, 2021
Messages
9
Reaction score
13
First Language
English
Primarily Uses
RMMV
You can check how many weapons an actor has equipped with something like:
$gameParty.members()[actorid].weapons().length

So something that goes like " $gameParty.members()[actorid].weapons().length == 0 " I think?
 

eomereolsson

Veteran
Veteran
Joined
Sep 29, 2021
Messages
543
Reaction score
462
First Language
German
Primarily Uses
RMMV
Actor.weapons().length == 0 should indeed be true, if that actor has no weapons equipped.
However $gameParty.members()[number] will return the actor of the position number +1 (since arrays start their indexing at 0) in the party's formation.
Presumably this is not useful for @MarxMayhem 's case since they don't know in which position in the party the player places the monk character.
To actually get the actor with the actorId $gameActors.actor(actorId) should work. So the whole condition would be:
JavaScript:
$gameActors.actor(actorId).weapons().length == 0
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
7,546
Reaction score
5,311
First Language
English
Primarily Uses
RMMV
You shouldn't need to go to any of those lengths. Per the OP, this is in a state (presumably a Yanfly passive state), so you'd just check user.weapons().length==0
 

MarxMayhem

Veteran
Veteran
Joined
Apr 17, 2020
Messages
251
Reaction score
256
First Language
Filipino
Primarily Uses
RMMV
Thanks y'all. I got it to work through what ATT_Turan said. Posting here for future seekers of knowledge:

Code:
<Custom Passive Condition>
condition = false;
if (user.isActor()) {
 if (user.weapons().length == 0) {
 condition = true;
 }
}
</Custom Passive Condition>
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
16,739
Reaction score
9,288
First Language
English
Primarily Uses
RMMV

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.

Latest Threads

Latest Posts

Latest Profile Posts

I'm really sorry I haven't done any streams. I actually just got home from the hospital after a week and a half.
I'm not dead - I promise :stickytongue:

Anyway, some pokemon inspired art (dont ask me which one tho xD)
reali.png
Writing boss music for Pale Coins. This is the Goblin Mage's theme!

Caz
I've been trying to upload more video tutorials for RMMZ lately! Does anyone have a topic they'd like to see covered? :ehappy:

Forum statistics

Threads
129,716
Messages
1,204,585
Members
170,788
Latest member
Shinsly
Top