RMMV Conditions check multiple actors

kako05

Veteran
Veteran
Joined
Sep 11, 2017
Messages
160
Reaction score
18
First Language
Australian
Primarily Uses
RMMV
Hey. Is there a way for condition event to check multiple actors. For example, IF actors with ID 50,51,52,53 have skill "X"?
Converting actor ID to variables is not a good solution as I'll need to keep creating variables as I add actors which is messy.
Is there a script line like Actors.ID(50,51,52,53,54) which would work with "Actors.ID(50,51,52,53,54) any of them have skill "X" == true?".
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,091
Reaction score
1,508
First Language
EN
Primarily Uses
RMMZ
You can loop through the actor IDs, e.g. Conditional Branch > Script:
JavaScript:
[50,51,52,53].some(function(id) { return $gameActors.actor(id).hasSkill(123); })
I believe this will return true iff at least one of those actors (ID 50, 51, 52, or 53) has learned skill ID 123. Change the numbers as needed, of course. :kaothx:

Here I've used the array method some:
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,085
Members
137,585
Latest member
Reversinator
Top