Change Event Move Route Through Touching Other Events

What I'd like to do is set out a track with a minecart on it.  Instead of having to manually plot a course for the entire move route of the cart (I've got ten big dungeon rooms to do this in), I was thinking, "Why not input the turns through 'event touch' events on the bends in the track?"  So, I set up a test run, but when the cart hits the bends, it just stops, and I can't figure out why!  I've attached some screens to show how I've got it all inputed right now.  It really seems like it should work, so I'm super frustrated!  Any insight into this problem would be greatly appreciated.

map.pngcart.pngcart-route.pngbend.png
Two issues here.

Events cannot move over other events, unless one of them is set to through. The priority of the event doesn't matter.

I suspect if you set the "lower" event to through, your cart would just keep moving forwards until it hits something it can't pass through.

BECAUSE (other issue) - events cannot trigger other events. Event Touch doesn't mean "when this event is touched by another event" - it means "when this event touches the player".

Does your cart only move around the track in one direction? Or does it turn around and go back the way it came? If it just keeps moving in one direction, you could do this:

- use region tags on each of the corners - one tag when you want the cart to turn down, another to turn left, another to turn up, and another to turn right.

- in the move route of the cart, do the following:

Script: turn_down if region_id == 1Script: turn_left if region_id == 2Script: turn_up if region_id == 3Script: turn_right if region_id == 4Move ForwardOf course, use the appropriate region ids - you may have 1-4 allocated for something else.Then you can get rid of all those events and the cart will control its own movement.
Thank you so much for your help. I feel pretty dumb for misunderstanding that function. I'm about to pass out now, but I'll be sure to try your method in the morning. I appreciate you taking the time to explain that. 🙂
Don't feel dumb ... "Event Touch" does sound like it's a trigger that activates when touched by an event, and many have been confused. I wish it WAS that! And the priority thing on events is something you'd only discover by being told, or by looking at the script. 🙂
So, I'm getting an error when the car hits the bend, and I'm not sure why.  Sorry for bugging you more with this.  Here's a screenshot of the error message.

benderror.png
sorry. It should be this:

Script: set_direction(2) if region_id == 1Script: set_direction(4) if region_id == 2Script: set_direction(6) if region_id == 3Script: set_direction(8) if region_id == 4Move Forward2 = down4 = left

6 = right

8 = up
Gah! Now, I'm getting a different error, and it's right at start up. D:

newerror.png

Nevermind, just a pasting error. Thanks so much for all your help! It's working great now! 😀
Script: set_direction(2) if region_id == 1

Script: set_direction(4) if region_id == 2

Script: set_direction(6) if region_id == 3

Script: set_direction(8) if region_id == 4

Move Forward
There are other ways to do this as well, which are not limited just to region_ids

Script:set_direction(2) if @x == 123 && @y == 345

That code will cause premature turning though, so you may want to use @real_x and @real_y, which is basically just @x, @y * 256 (or 128 in RMXP).  If you REALLY wanna get fancy, you could even check other stuff that has nothing to do with that event itself!

Script: set_direction(2) if $game_player.x == 5 and $game_player.y == 8

And for Events

Script: set_direction(8) if $game_map.events[12].x == 3 and $game_map.evets[12].y == 8 and $game_map.events[12].through and region_id == 4 and terrain_tag == 4

There really is not any sort of a limit on what you can do with Scripts!

But lets get REALLY fancy!

Script: move_right unless @x == 12 and not moving?

Script: @move_route_index -= 2 unless @x == 12

That is a simple way of continuing to move until the Event's X is at 12 instead of putting in twelve move left commands!  This is IMPORTANT as it allows for variable movement also.  The important part is to note the @move_route_index -= 2  That makes the Move Route continue to repeat the move_right command until it hits that coordinate.  It is basically a very simple way to do pathfinding.

That stuff is for XP, so if anyone wants to translate that above code for VXA, Im sure it would be appreciated.

Original thread: https://forums.rpgmakerweb.com/threads/change-event-move-route-through-touching-other-events.36129/