Dodging Segments

I want there to be some sections where the player dodges moving obstacles (thrown spears, falling rocks, etc.), and I want a trigger (event) and a battle sequence opening on contact (common event), since I use an Undertale-instired battle system. Is there any way I can do this, plugin or not? Thanks in advance!
You want this to happen on the map?
You want this to happen on the map?
Yeah, I want it to be on the map. Just like the Undyne segments in Undertale.

Edit: Specifically, the Undyne chase segments. The bullet part, I mean.
I didn't play Undertale so I don't really know about that.

But technically it's technically possible if you set the move route of the different events, and when they finish their movement you transfer them back to their original position and repeat their movement via a parallel process event. So let's take a concrete example: let's say your map is built vertically and the player has to go only up (and can move on the side to evade obstacles), you need to create a couple of enemy/obstacle events. Those events have 2 pages:
  • The first page is the page that runs by default and the trigger is set to player touch (where you'll add the encounter). The event has a move route that makes it go only down (player has to go up so obstacles go down). For every step down the event takes, add +1 to variable of your choice (different variables for different events though). Calculate the max number of steps it takes to reach the bottom of the map.
  • The second page is empty, and the condition to get to that page is to have the variable >= total amount of steps to get to the bottom. So basically the first page is always running, until the event reaches the bottom of the map, then it transitions to the second page.
Now, create a parallel process event: it will always check the value of the obstacle event's variable. Once the obstacle event has reached the bottom, in the parallel process event move the obstacle event back to the top and reset its variable to 0. That way, it will create a loop in which the obstacle event will run from top to bottom, teleport back to the top and repeat the process.

Now copy paste that obstacle event a couple times and you get a system where there's many obstacles running from top to bottom in a loop. A couple things to keep in mind when you copy paste your obstacle events:
  1. Use different variables for different events.
  2. If the obstacle doesn't start at the top top (meaning the spot where the parallel process will transfer it after the completion), set its variable to value of the amount of steps it's suppose to take him to get there. Otherwise the obstacle will reach the bottom without reaching the max value for the variable necessary to reset back to the top.
Thanks for the help.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/dodging-segments.109835/