I can't figure out in the eventing commands how to check if the main character/player, actor 1, is dual wielding or not. Is there a script call I can use to have an IF / ELSE check for this? Like if the main character is dual wielding a weapon, return 1 - otherwise return 0. Thanks
How to check if an actor is dual wielding?
RPG Maker MV Support
Code:
$gameActors.actor(1).weapons().length>1
Since you've gotten the proper answer, I feel less bad about responding with my smartass one of "Look in their non-dominant hand: if there's another weapon there, they're dual wielding". 😛
I set this up in a conditional code branch, making it say 'true' if the condition is met and 'false' if not, and it always returns 'false'. I tested for when wearing the armor that enables dual wielding and without, both with weapons and without as well. Always returns false D:
Am I using it right?
This is what i'm looking at to test the code
That looks correct. Are you sure you're doing the equipping and everything on actor ID 1?
Don't ever forget that the function
has something to say about this...
JavaScript:
$gameActors.actor(1).isDualWield()
has something to say about this...
That is absolutely a thing, but it's a bit of a misnamed method.
It only looks at the slots - it returns true if the actor can dual wield, whether or not they are.
WHOOPS, I thought that would check the party member 1. My actor is #12 in the database, and it works correctly when I changed that 1 to 12. Thanks again!
You could also do $gameParty.leader() instead if you wanted to specifically check the actor leading the party.
Ah, your first post said "actor 1," so I assumed that was Actor ID 1.
You can keep your modification if you always want to check that specific actor, or use Trihan's modification if you're always checking the leader and that can be someone different.
Thanks so much guys, that little bit of extra fine tuning code is awesome 🤘
learning this stuff bit by bit lol
learning this stuff bit by bit lol
fladdles said:
Since the OP actually mentioned dual wielding as an issue there, I thought why not calling the corresponding function at once. Plus if the actor or party leader is not allowed to dual wield at all, it's better to return false right away. Otherwise, you could end up looking for 2 weapons without ever realizing if the current actor CAN dual wield from the very beginning. It never tells the OP WHY that actor has not equipped another weapon at that point.
My suggestion would be to use both functions. Dual wield first and then how many weapons it has equipped so far. At least if the OP does care about checking if both results are true...
Checking isDualWield() is redundant in this case though. If weapons() returns a value higher than 1, the only possibility is that that's true.
The OP never mentioned wanting to see if the actor is *capable* of dual wielding, just whether they are or not. And if they are, they must be able to. If they're not, whether they can or not doesn't matter for this purpose unless I've missed something.
I see what you were suggesting, but I don't see the point in checking two conditions when one condition will cover anything the first one would have achieved to begin with.
He never mentioned caring about it.
Only, as you quoted, knowing whether two weapons were equipped, which the code I provided will do but the isDualWielding() method won't.
Original thread: https://forums.rpgmakerweb.com/threads/how-to-check-if-an-actor-is-dual-wielding.164622/