Status
Not open for further replies.

MarxMayhem

Veteran
Veteran
Joined
Apr 17, 2020
Messages
108
Reaction score
83
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
126
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,154
Reaction score
1,866
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
108
Reaction score
83
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,336
Reaction score
9,052
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

ok hear me out here: if the only way my brain can describe things is like with colors is this normal? Like I've described a smell as "dark green and fuzzy" and a taste as "dark blue" like is this a normal thing that happens to people or am I just going insane?? o.0
I'm sitting here, programming, when suddenly, in the distance, I hear a deep booming shout, "Dovahkiin". In an instant, my mind and body is pulling me away, my fingers twitch and notepad++, almost by itself, turns off. The Steam starts to rise and a big green play button appers and I am teleported to Skyrim, because, I am, the Dragonborn! 200 hours played last three weeks, omg o_O
Shora Lighting Plugin version 1.5 are out! Wanna add more features to it, but just fixing the bugs is already a pain :kaocry: .

スクリーンショット 2022-01-19 002122.png
I wonder how one goes about picking a good font for a game. I find the default kinda lacking, but you gotta pick a font that's legible ya know.

Forum statistics

Threads
118,483
Messages
1,116,275
Members
155,465
Latest member
HenryP
Top