WanderingDudeBM

Villager
Member
Joined
May 8, 2021
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMZ
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.
 

Attachments

  • Rats.jpg
    Rats.jpg
    253.8 KB · Views: 8
  • Rat detection spot.jpg
    Rat detection spot.jpg
    137.9 KB · Views: 8
  • Campsite.jpg
    Campsite.jpg
    307 KB · Views: 9
  • Campsite event window.jpg
    Campsite event window.jpg
    135.6 KB · Views: 8

Dev_With_Coffee

Veteran
Veteran
Joined
Jul 20, 2020
Messages
596
Reaction score
268
First Language
PT-BR
Primarily Uses
RM2k3
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, $gameMap.event(1).y, $gameMap.event(1).x, $gamePlayer.y) === 2

Reference:
RMMZ - Script Calls


"During Player Participation":
I did not understand the purpose of this.
 
Last edited:

WanderingDudeBM

Villager
Member
Joined
May 8, 2021
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMZ
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.
 

Attachments

  • Event Triggers.jpg
    Event Triggers.jpg
    149.8 KB · Views: 3

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,544
Reaction score
14,853
First Language
English
Primarily Uses
RMMV
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.
 

WanderingDudeBM

Villager
Member
Joined
May 8, 2021
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMZ
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.
 

Latest Threads

Latest Profile Posts

I wish character bust packs had options for both side-facing and front-facing for the same characters.
Looks like I'm going to have to cancel another game.
For now it is in testing phase: Changing the game icon from Rm2k/2k3 without needing to edit the executable.
Rm2k-DinChangeIcon.png
When there's a will, there's a lifehack. :ninja:

Before i mess with battle UI further, does it look decent enough? :hswt:

Forum statistics

Threads
112,528
Messages
1,068,961
Members
146,210
Latest member
thespirithero
Top