I have this script that goes
$gameParty.leader().actorId() === 4
What if i want it to be === 4 OR 5 OR 34
Is that possible?
$gameParty.leader().actorId() === 4
What if i want it to be === 4 OR 5 OR 34
Is that possible?
if ($gameParty.leader().actorId() === 4 || $gameParty.leader().actorId() === 5 || $gameParty.leader().actorId() === 34) <do whatever here>;I see i remember now! Yeah, you're right, i tested it and it works, thanks a bunch
if($gameParty.leader().actorId() == (4 || 5 || 34))
That won't work. A logical OR like that will return the left value if it's truthy, and the right if the left is falsy. 4 is always truthy so you will never get anything from those parentheses but a 4.
let actor = $gameParty.leader().actorId();
if (actor === 4 || actor === 5 || actor === 34) {
//whatever happens here
}
[4,5,6].includes($gameParty.leader().actor().id)
A && B == !(!A || !B)
A || B == !(!A && !B)
That will also error because you've capitalised the A in Actor but not in actor; you've defined one variable then used one with a different name. You also missed the comparison operator in the last condition.
Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-ors-in-gamescripts.146263/