Status
Not open for further replies.

MarxMayhem

Veteran
Veteran
Joined
Apr 17, 2020
Messages
172
Reaction score
188
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,031
Reaction score
2,457
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
172
Reaction score
188
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,539
Reaction score
9,183
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

Even if you made 1% progress today in your making-game, that's 100% success!
This is Ralph from VX!
index.php

Always be consistent with your project.
Making backups regularly is good for the soul.

Forum statistics

Threads
121,854
Messages
1,144,692
Members
160,110
Latest member
Zeisak1
Top