How to make it so when two events touch, an action is triggered?

I have a puzzle where the player needs to get to events to touch each other. How can I make it so when one of the event the touches the other one, it triggers the end of the puzzle?

(Both of the events are moving with Player touch)

I've moved this thread to MV Support. Thank you.

...

... dang I really do need to update this one now that I know much more about MV and JS...
...but perhaps that's at least a helping start for ya
I totally forgot about this Thread i was involved in. Thanks for reminding me =).

EDIT: SORRY Posted this into the wrong thread....😢.
You could just do this in a Script box in the conditional branch - I'll assume the events are 5 and 6, so replace those numbers with the real event ids (the id, not the name, no leading zeros)

Code:
Set Move Route: This Event (wait): Move Away from Player
Conditional Branch: Script: Math.abs($gameMap.event(5).x - $gameMap.event(6).x) + Math.abs($gameMap.event(5).y - $gameMap.event(6).y) === 1

The wait in the move route ensures the event has stopped moving before doing the check. That way the condition won't become true at the start of the move - only when the events are together after finishing the move.

This will result in true when the events are touching and are horizontal or vertical. If they are touching diagonally, the condition won't be met.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-it-so-when-two-events-touch-an-action-is-triggered.118168/