MZ Event Triggers from Console Edition

Hi everyone! This is my first post on the RPG Maker forums. I'm coming from the console edition on the Switch and I've recently purchased MZ for PC. The PC edition includes three new event triggers called "When Player Approaches" "When Player Leaves" and "During Player Participation". The first two triggers allow you to activate events at a distance from the player. They are extremely convenient and allow you to have NPCs walk across your event triggers as well as allow you to have enemies detect the player from a distance.

I was wondering if anyone here would know how to program event triggers such as these into the PC edition?

For a more clear explanation of what these can do and how I have used them, look here.

In this tutorial scene, the player is prevented from prematurely entering the area below where the monsters are by an event remotely triggered when the player is three tiles to the right of the event. A little later, after a sword is equipped, all four characters walk down to an area near the monsters while talking in a cutscene. This all happens smoothly thanks to the "when player approaches" trigger. Otherwise, you would have to have three separate "Player Touch" triggers on the walking path and NPCs can't cross events unless they are set to "through" in the movement commands.

For the second example, I have two rat enemies on both sides of the forest. They are turning left and right. The events next to them are "detection spots" as I call them. When the player enters any tile between those spots, if the rats are looking at them, they will both charge towards the player at the same time. And if the player evades them, they will return to their spots and wait for the player to enter the space again.

I've also set up other scenarios where players will be detected by enemies so long as they enter a four tile radius around enemies and the enemies will give chase. The "During Player Participation" event is important for this because it will detect and activate the event even when "through" is set without causing a glitch that happens when "player touch" is set as the event trigger. So for example, I was able to have an area that if the player entered it, then three bats would detect the player at once and they could fly over the lake in the image below.

If you read all that, then thank you. I think these event triggers are a great refinement to the RPG Maker engine, and it is a real shame that they aren't available on the PC edition. If anyone could take a look into this, I believe it would help not only me but the entire RPG Maker community as a whole.
The first two can be solved with Parallel Process and javascript:
Code:
$gameMap.distance(x1, y1, x2, y2)
0 -> Event side player
1 -> Player one tile away

Example with "Conditional Branch":
JavaScript:
$gameMap.distance($gamePlayer.x, $gamePlayer.y, $gameMap.event(1).x, $gameMap.event(1).y) === 2

Reference:
RMMZ - Script Calls


"During Player Participation":
I did not understand the purpose of this.
I see! Thank you very much. Clearly there is going to be a lot for me to learn coming to the PC edition. I tried the script you gave me and found that it is indeed good for making an event that detects the player within a circular radius of the player. I had to experiment with using control variables and conditionals to detect specific map locations (so for example three tiles to the right of the event location), and I did find a way to successfully do this. Thank you very much for your help!

I looked into "During Player Participation" and it is essentially a parallel process, but it only runs when the player is on top of the specified tile. So rather than a normal parallel process that is always running during each frame while the player is on the map, "During Player Participation" will run during each frame only when the player is on the tile itself. It's much less taxing on the system and also prevents an issue that sometimes happens where your event will activate twice when Parallel is turned on.
You can do that by creating an event with two pages. Page 1 has no condition, a Player Touch trigger, and simply turns on a self switch.

Page 2 is conditioned by the self switch, is set to parallel process, and contains the event commands you want to run, as well as a check to see if the player is still on the same tile, and if not, turns the self switch off.
I'm sorry for my slow response. I've been busy with work. Anyway, thank you very much for your responses! I've found some ways to accomplish the things I wanted. This thread can be closed.

Original thread: https://forums.rpgmakerweb.com/threads/event-triggers-from-console-edition.136319/