Status
Not open for further replies.

MarxMayhem

Veteran
Veteran
Joined
Apr 17, 2020
Messages
112
Reaction score
86
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
11
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
152
Reaction score
127
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
3,178
Reaction score
1,878
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
112
Reaction score
86
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,353
Reaction score
9,058
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 Profile Posts

Doing clean-up on tall-ified sprites, filling in pixel by pixel where the stretching warped the image, feels incredibly tedious but also highly rewarding when one zooms out and the sprite looks even better than before.
I found this app on the playstore and I'm loving it, it's very good for organizing project ideas
hmm one of those days where there's a lot to work on with my game... annnnnd I have no idea what I wanna do. most of it tho, involves drawing lol. either enemies or NPCs.
I'm going back to the default RTP, in the interest of getting it done. FSM is lovely but slow to work with and has tall doors. And switching to tall sprites would mean a lot of franking, and also the horses will be small.
I think I developed a stalker trauma (stalkerfobia?) because of my previous work publishing games on Steam. :(

Forum statistics

Threads
118,574
Messages
1,117,067
Members
155,632
Latest member
GhostFrog
Top