Checking coordinates for a group of events

Hey all.

To check the coordinates of a single event, the script call in a conditional branch looks something like this:

$game_map.events[@event_id].x == 1 (For x coordinate 1)

$game_map.events[@event_id].y == 1 (For y coordinate 1)

My question is, is it possible to create a system of events to check for an array of events if they are at a specific position without creating more than 1 conditional branch? Something like

$game_map.events[001, 002, 003, 004].x == 1 

Or can this only be achieved with scripts? Thanks in advance.
What you want is called and array variable value.
 

Try calling this:

$game_variables[x] = [$game_map.events[1].x, $game_map.events[2].x, $game_map.events[3].x]

and after that set a conditional with a script like:

$game_variables[x] == [1, 1, 1]


I tested it and it works. Your only problem should be fitting the entire script call into one line.

EDIT: Okay, so I took it personally and I ended up finding a way to break the command to multiple lines. Your first script call should be like this:

$game_variables[x] = [$game_map.events[1].x, $game_map.events[2].x, \

$game_map.events[3].x, $game_map.events[4].y, $game_map.events[5].x, \

$game_map.events[6].y, $game_map.events[7].y]

That way, you can track as many events as you want.
$game_switches[id of an available switch] = [1, 2, 3, 5, 20, 42].all? { |event| $game_map.events[event].x == 1 }

Then you can use the switch in a conditional branch. This method allows as many event IDs as you want, they don't have to be sequential, and it'll all fit on a couple of lines at most.
Thanks lots to both of you, I'll test it out and get back.

Original thread: https://forums.rpgmakerweb.com/threads/checking-coordinates-for-a-group-of-events.39823/