Using Events to trigger other events in MZ.

I know events can be triggered by the events touching the player or the player touching the events. What I would like is for an event to be able to touch another event and trigger its own event or the other event.

Imagine 2 events with there movement set to random. Now imagine if those events randomly bumped into each other. At this moment some simple logic would control which event would run.

I have set this up in MZ but so far with no success. I should also add that I am trying to do this with no plugins on purpose. I find it fun that way 😛
You can find some tutorials and information on this concept. Explore using a parallel event that checks the X & Y coordinates of he events you want to track using variables. You will need logic of what to do when the X & Y coordinates of the events end up next to each other.

You can search for things like proximity detection and things like that.

I can’t search for anything specific right now, but hopefully this gets you on he right track or someone else can point you to something more specific.

Good luck!
You'll find there are a lot of ways to do this so find the workflow that works best for you.

This is how I usually set things up. Let's say you have event 2 and event 5 on the map, both with autonomous random movement.

This script call code (or something that looks like this) will be in event 2, set to parallel trigger, normal move speed, highest move frequency. (Same with event 5 but event 5 will use action button trigger instead of parallel).

Change the wait time or things as needed. Remove the comments if you need more scripting space (or use comment commands and place them above the script call):
JavaScript:
const e    = $gameMap._events;
// Get hypot distance between events
const dist = Math.hypot(
    $gameMap.deltaX(e[2].x, e[5].x),
    $gameMap.deltaY(e[2].y, e[5].y));
// if events are 1 tile distance or less, run code
if (dist <= 1) {
    // run your code, switch, etc.
};
// Wait time scale with move speed for performance
this.wait(2 ** (8 - e[2].moveSpeed()));
Then do what you need with a new page, more code, etc.

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

There's CT_Bolt's Event Trigger Event
An alternative might be to do it in a move route. Since they are moving at random, it would just be a custom move route with "Move at Random" and something like the following script:

if (this.pos($gameMap.event(eventID of target).x, $gameMap.event(eventID of target).y)) {$gameSwitches.setValue(switchID, true);}

Original thread: https://forums.rpgmakerweb.com/threads/using-events-to-trigger-other-events-in-mz.168996/