Status
Not open for further replies.

MarxMayhem

Veteran
Veteran
Joined
Apr 17, 2020
Messages
177
Reaction score
194
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
164
Reaction score
142
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
4,039
Reaction score
2,463
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
177
Reaction score
194
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,544
Reaction score
9,185
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

Maybe I should get rid of the Banish ability in my game. It's a non-elemental spell that doesn't even appear in the magic chart. It's only there because my Elementalist doesn't use light or dark magic. It only effects summoned creatures.
ScreenShot_5_18_2022_0_37_0.png
I've been redoing all of the major areas in my game. starting with a place called Century Park. thankfully because all of the locations are distorted memories, I can make these places pretty abstract.
HexMozart88 wrote on RHachicho's profile.
Hey wait a minute, I remember you!

Forum statistics

Threads
121,909
Messages
1,145,090
Members
160,171
Latest member
mutou000
Top