Help making a pokemon trainer-npc like event

I'm currently trying to make a NPC that behaves like the trainers in the pokemon games: if you pass in a area of tiles in front of them they'll trigger a battle. I actually got this working with a parallel event and a bunch of coditions (if looking in a certain direction).

The only thing that's missing is activating the fight by 'talking' to the NPC, since i used parallel eventing for the NPC i don't know how to make it also trigger by pressing a button.

This is how it looks:


and this is how the first page looks (the other pages are the animation of it walking up to the player and triggering the fight), 'Jogador' means 'Player' in portuguese and Laminha is the name of the monster NPC

Code:
◆Control Variables:#0001 Jogador X = Map X of Player
◆Control Variables:#0002 Jogador Y = Map Y of Player
◆Control Variables:#0003 Laminha01_X = Map X of This Event
◆Control Variables:#0004 Laminha01_Y = Map Y of This Event
◆If:This Event is facing Down
  ◆If:Jogador X = Laminha01_X
    ◆Control Variables:#0002 Jogador Y -= Laminha01_Y
    ◆If:Jogador Y ≤ 3
      ◆If:Jogador Y > 0
        ◆Control Switches:#0002 Giro Pausa = ON
        ◆Control Self Switch:A = ON
        ◆
      :End
      ◆
    :End
    ◆
  :End
  ◆
:Else
  ◆If:This Event is facing Right
    ◆If:Jogador Y = Laminha01_Y
      ◆Control Variables:#0001 Jogador X -= Laminha01_X
      ◆If:Jogador X ≤ 3
        ◆If:Jogador X > 0
          ◆Control Switches:#0002 Giro Pausa = ON
          ◆Control Self Switch:B = ON
          ◆
        :End
        ◆
      :End
      ◆
    :End
    ◆
  :Else
    ◆If:Laminha 01 is facing Up
      ◆If:Jogador X = Laminha01_X
        ◆Control Variables:#0002 Jogador Y -= Laminha01_Y
        ◆If:Jogador Y ≥ -3
          ◆If:Jogador Y < 0
            ◆Control Switches:#0002 Giro Pausa = ON
            ◆Control Self Switch:C = ON
            ◆
          :End
          ◆
        :End
        ◆
      :End
      ◆
    :Else
      ◆If:Jogador Y = Laminha01_Y
        ◆Control Variables:#0001 Jogador X -= Laminha01_X
        ◆If:Jogador X ≥ -3
          ◆If:Jogador X < 0
            ◆Control Switches:#0002 Giro Pausa = ON
            ◆Control Self Switch:D = ON
            ◆
          :End
          ◆
        :End
        ◆
      :End
      ◆
    :End
    ◆
  :End
  ◆
:End
Plugins to help:

Personally I like option the one by Lyson
If you'd like to use the "event way" to minimize compatibility issues, or you just like to have fun with events, you can use regions.

In a common event running in parallel process, put this :

Code:
> Set variable "Region ID"  == Script : $gameMap.regionId($gamePlayer.x, $gamePlayer.y);
> wait 1 frame

That's all.

In all of your maps, you will make all your enemies as 3-pages event with a line of region drew in their line of sight.

Page 1) Action button triggered event, which wil start a fight when talked to
Page 2) Automatic Event triggered when the Variable "Region ID" matches the region in front of it
Page 3) Event for defeated enemy


Tip : If regions overlaps, just add them up, place a new region and a new page for all the enemies to be triggered at once

(Ex : Enemy 2 with Region ID 2'line of sight, and Enemy 3 with Region ID 3's line of sight are overlapping. Make the region ID where it's overlapping Region ID 5, and create a page for both events to trigger when the players enter Region 5)

Another tip : This also works when your enemies are looking around (therefore changing direction. If they do so place a line of sight of region IDS wherever the enemy will be looking, then just make it a parallel process instead of an automatic one, just to do an additional check for the direction + the X or Y difference

(Ex : if the enemy is looking down, and the player's Y is greater than the enemy's, given the fact the player is actually in one of the line of sights, the battle can be triggered)

IMPORTANT : This solution works ONLY if your enemies are NOT moving ! For moving enemies, you'll be using a plugin

Basically, it would look like this :

1588467361740.png
I tried the event method and its not working for me. could you possibly give me an example with what parallel process I'm supposed to use?
@enerjakRBY There's no reason to make a parallel process for this.

You make an event that's player touch and starts the fight, then turns on a switch at the end to go to a blank page.

Copy and paste that event in a straight line across the map.

Make one end trigger on Action Button and have the NPC's graphic.
@enerjakRBY , please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

Do not post disptuively. This includes but is not limited to: thread hijacking (posting in another person's thread with your own questions/resources, etc. that leads the focus away from the original topic and onto you).

Original thread: https://forums.rpgmakerweb.com/threads/help-making-a-pokemon-trainer-npc-like-event.121022/