Triggering a fight event.

Hello,
What's the best way to trigger an event?
Cause I have that feeling like I was doing to much complicated event constructions for what I want to achieve.
I want my NPC to stand still or have a little walk around and when the player is close (or in sight), it will stop the player and make the NPC go toward him, talk a little and start a fight. So nothing fancy, all classic.
Please correct me if it can be done in a simplier way. I've been making autorun events with line of events activating a switch that is required for that autorun event.
There are a lot of NPCs that my hero has to fight so I can't allow him to go pass them without an interaction.
My idea was a line of events (switch activators) before the NPC that makes him move towards the player.
But I had to make 3 event pages. One for the NPC standing still before activating a switch. Second for actual action. And third for the NPC staying in place after the fight.
I think that maybe it can be done smarter. It seems to me like laying 5-tiles long events (because of the road's width) before the NPC starts its movement towards the player is unnecessary. And making hundreds of events with new switches before every fight..
Please tell me there's a better way.
Can't you just use a regular transparent touch event?

In normal case, you block the player path with player touch event.
The entire event will be inside that transparent event alone. Any NPC movement will be controlled remotely from there.
1599386856316.png


it's okay to roadblocking the player by placing more events. It's still considered simple for something that triggered once for the entire gameplay.
1599387400931.png


I think your solution is much more organized. Using the line of events to only trigger a switch that activated the autorun inside the NPC.

It can be shortened to 2 pages if interacting normally is not possible firsthand.
The first page is the aftermath, and the second page is the autorun.
The switch can be turned off so you can reuse it.
The line of events can use self-switch to be turned off permanently.
This is the plugin you are looking for.
By MOG
Can't you just use a regular transparent touch event?
Actually thats what I'm using. I just thought that maybe there is some easier way.
But you helped me anyway. I have no idea why I haven't thought about reusing the same switch for every fight. Now I feel stupid 😉

This is the plugin you are looking for.
By MOG
I'm trying to avoid plugins as much as it's possible, but thank you anyway.
This case might be the only situation where switch-controlled cutscenes have no problems, in almost every other case this would be an extremely bad idea.

Usually you need ONE controlling event that handles the entire cutscene. And as soon as several other events are involved (more than one), that is the ONLY way to prevent timing problems in the events.

In the case of a controlling master-event, that would be the invisible trigger event that the player steps on. This event would have a single page with all the commands, and all NPCs controlled by it would be nothing than pllaceholders that contain no commands at all.
When the player steps on and activates the trigger event, that event would remotely command the NPC-Event to move to the player (set move route targeted on the NPC event), then place any show text and batte processing commands in that trigger after the NPC completed the movement.

No plugin needed, but the different trigger events would all contain the commands for the fight but with different set move route commands because the NPC would have to take a different number of steps to get to the player.
Different number of steps to get to the player is achievable by setting, for example, 10 moves towards the player and marking "Skip if cannot move".
Anyway, your idea is impressive. So, If I understand it correct:
By master event you mean a common event that is only about the movement, same for everyone, right?
And everything else, like dialogues, battle settings would be in the event trigger?
Is this really better?
I mean, in relation to my map's width, I would have to set up to six traps (event triggers) with all the instructions what to do with the scene. In my case, traps contain only switch controls, and the whole event is written once in a NPC.
But the problem is creating a new switch for every battle in the same map. So reusing switches does not help unless I'm doing something wrong. Because If I use the same switch for every NPC that is set on autorun, they will all start their events together.
So maybe this idea is not bad but I have to think through this.
By master event you mean a common event that is only about the movement, same for everyone, right?
no

It is usually a map event, and it only controls a single cutscene - but that cutscene can control dozens of other events like for example a marching army or so. You'll need a different master event for each different cutscene

And there are several reasons to handle things that way - for one you don't need any switch at all, but most importantly it allows you to control the sequence in detail without problems.
If you have several moving events, then your way of doing it would risk the timing of different switch-controlled events intersection with each other. Only if one event gives the commands remotely you can guarantee which NPC moves in which order, and to make sure everyone stops at the correct moment for show text send by the same controlling event and so on.

If you follow the link "bughunting" in my signature, I wrote some explanations on why a sequence of switch-controlled autorun or parallel processes is a bad choice for handling cutscenes
Your idea is brilliant! Now I totally get it.
But there's another thing bothering me. (I can't reach my RM now, so I can't just check it)
Can I set one event multiple times on the same map? Let's say that one road in my game is 5 tiles wide. And there's an enemy in the middle. You can get to him from both sides of the road. So I would set 5 traps (those master events) on each side with "erase event" option at the end. Is it possible that all ten events will vanish after the fight?

Edit: I have this funny feeling that it's all going down to switches again.
yes, if you want a larger trigger area then you'll have to use multiple events.
however it should only use one single switch to disable all those events by triggering one of them.

Original thread: https://forums.rpgmakerweb.com/threads/triggering-a-fight-event.126856/