How to make Pokemon trainer-like npc event?

I have been wanitng to do an event. That makes npcs act like in pokemon where trainers will battle you if you are just a short
distance from them. I think it's really cool. But how could I implement this in rpg maker mz?
Just to make sure, what you want is thtt when you are in the line of sight of an enemy they will walk towards you and initiate a battle? You don't care about the pokemon battle system, you just want them to notice you if seen a close enoug distance and start a regular rpg maker battle?
Yup! that is all I look for!
fellow swede
You can simply do this by making one event with the image of the trainer, then create an event that's Below Player with Touch activation in front of them.

Give that event the code to do whatever - say a challenge, start Battle Processing, then activate a switch as the last command.

Give the event a second page with the condition of that switch and everything else is blank.

Copy and paste that event in a straight line as far as you want the line of sight for the trainer to activate.
I am sorry but what do you mean with touch activation in front of them?
In front of them.
in front.jpg
Activates on touch.
touch.jpg
Oh alright. I am really grateful for the help though I can't see the trainer for some reason
Okay now I fixed it I made a mistake and made an extra event page that I didn't need. Thanks again!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-pokemon-trainer-like-npc-event.153730/