How to make trainer activate their line of sight to the main player, just like in Pokémon

Hello,

I am creating a scene where the main character can trigger a trainer's responses by walking within their line of sight just like in the original Pokémon games. I am not doing the battle scene, I just want to set a trigger from a nearby trainer and that is enough. This means I walk in front of the trainer, I freeze, he walks to me and says something and I go. Can do battle later.

Problem: If I return to any of the remaining 6 (7 total) tiles, it will attempt to reactivate the line of sight. How do I make it ignore the event even if the player returns back to one of the 6 remaining tiles?

Here is an image of my events:

oEyEOlV.png


In front of the trainer, I have 7 "player touch" event tiles. Each player touch tile directs the trainer closer to me (the player) depending on how many blocks are away.

My question: If I go on any of the seven-player tiles, it will trigger the trainer (in this case its Ash). He would approach me just like in the game. However, there is one problem. If after encountering the trainer (Ash), I go back to one of the previous seven player touch tiles in line with the trainer's sight, it would result in a glitch/repeat and freeze. How do I make it so I can establish a line of sight trigger like in Pokemon, and how do I fix the issue of going back to one of the already placed 7-player touch tiles without it recreating the event of Ash/trainer going to me?

I trigger the trainer/ash by going through his line of sight (player touch tiles). If I go back to one of the 7 player tiles, how do I prevent it from doing the same thing?
a default engine solution would be to use a switch on each of those trigger events to disable the main page when youve activated any of them already, but youll need to reserve switches for each trainer doing that in the long run.

you could also use a self switch on all of them and use a script call to flip all of the other events self switches on, but youd have to do it for all of the events for all of the trainers.

its not one of the free plugins, but yanfly has a hitbox plugin that would let you make all 7 of those trigger events one event, and then youd use a self switch to disable them.
didnt notice the MZ. Visustella may have a port of it
if your problem is 7 individual objects doing 7 different things conflicting with one another, you have 2 solutions to that:
1- unify the differences so that they all do the same thing, so you can shut them down with the same command.
2- get rid of them altogether and handle the logic through the trainer itself, which is the one thing that's bound to change.

for 1, you can set them all to move the trainer forward [the number of tiles the space is wide] and set them to not wait for completion. Set their condition to a global switch for the trainer battle.
set the trainer itself to trigger on contact, play the battle, raise that switch, and the triggers will disappear. You then have the trainer available for further interaction, through another page.

for 2, set the trainer's move route to always check for the line in front of them through XY coordinates.
the event's own coordinates, you can grab from itself.
"in front of me" is basically "me" + N [in the direction of motion].... and direction you can also grab.

^^ all of that, there's tutorials for.
look around.

Spoiler
and then there's the hacker solution which is to make a proximity trigger and a custom move route... but you'll need advanced coding for that. 😉
As @Robro33 says, you'd make all the events' disabled page have the same switch as a condition. I'm inclined to think it's not a big deal to do that, since you have some thousands of switches available.

But if you want to do the self-switch route, Mac15001900 has a plugin to make the syntax easier.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-trainer-activate-their-line-of-sight-to-the-main-player-just-like-in-pokemon.173136/