MZ [Solved] Pushing a cart along a track

I want to push a cart along a track.
But this track has curves and corners in it, so I can't just have it be pushed forward 3 times and call it a day.
I would like to push the cart, lets say, 3 tiles forward, but if the track goes left, the cart follows it.
How would I go about doing this?
Just use the movement route and set is as trail goes?
Just use the movement route and set is as trail goes?
That can work, but only when the cart is in a predetermined location, but I'd like a bit more freedom.

What I'm looking for is when I push the cart 3 tiles forward.. it goes 3 tiles forward.
But if there is a bend in the track.. it follows that. But there won't be a bend or curve in the track each time I push.
Schermafbeelding 2025-05-30 203032.png

On the picture. I can push the cart along the track according to a Movement Route.. sure.
But I want to be able to push the cart 1,2 or 3 tiles forward.
After pushing it forward, I'll have to push it again, and again, until it reaches the end of the track, by having it automatically follow the track as it goes left or right.
Then the Movement Route-method won't work anymore... as far as I know... since that one relies on a fixed origin-location.

Plus I'd like there to be triggers along the way that only get triggered when the cart stops on that location... but that I should be able to do...I hope 🙂

Sorry, I should have been more clear 🙂
you can use a stopper or set an event, so you cannot push forward.
so you can change page (so it can go left only or right).

better way is to use region on the corner, if the event is on region 4.
you can only push left, if 2, only down etc.

there are multiple ways to achieve it, but choose the way you like.
If it always moves 3, you can just make predefined move routes, like save the position in a variable or something. If you can choose to move it different amounts, you could use 'get location info: tile id' event command to check where the rail tile is and make it move in that direction.

EDIT: And yeah you need like conditionals so it doesn't check the tile that's behind it
EDIT2: Yeah or use regions to restrict it, like said above. I just always want reasons to use those odd commands.
I was indeed thinking about using a region tile on the corner.
It seems like that is the way to go

Thanks for the suggestions!
if you want full freedom of movement, one way to do this needs three or for different region numbers.

basically place the region numbers along the track with the number telling a direction.
then have the cart event use get location info to read the region ID, check it with several conditional branches and set different move routes depending on the region.

that will allow the cart to steer along the track no matter how it turns around.
I think I would do this with passability. You can set a variable to three and get the location of the event. Then order the event to move. If it now finds itself on a different tile, decrement it by 1. Otherwise, try moving to the left. If that doesn't work, try the right. Then start the routine over again, until the counter reaches 0.
Hey, @Axgin96 crated a easy solution for you I think 🙂

Thanks @fizzly for the mention!


I’ve created a plugin that allows minecarts (or any other event) to move along a predefined route, drawn using Region ID 7 (which you can change via script if needed).


How it works:​


Just use this in a Script Call:
KartRide.toggle(eventId, [x1, y1], [x2, y2]);
  • eventId: the event ID of the cart. Only one event is needed—it disappears at the starting point and reappears at the destination.
  • [x1, y1]: coordinates of the first endpoint
  • [x2, y2]: coordinates of the second endpoint

You can download the plugin here:
https://axgin96.itch.io/minecart-ride


How to use it:​


  • Draw the route using Region ID 7 between the two points you want the cart to travel.
  • This event is designed so the player can ride the cart along the defined path.

Tips:​

  • Since the cart event is automatically moved and hidden at departure, and then reappears at the destination, I recommend:
    1. Activating a Self Switch when the player interacts with the cart.
    2. Creating a second event page with no image, triggered by that Self Switch.
    3. Once the ride ends, turn off the Self Switch so the cart reappears in the final position.
  • If you have followers enabled, it might be a good idea to temporarily hide them during the ride. Otherwise, they’ll try to follow the player on foot, which can break immersion.



I’m not a pro developer, but I’m working to polish and optimize the plugin as much as I can.
Any feedback or suggestions are always welcome!
Hey, @Axgin96 crated a easy solution for you I think 🙂

Thanks @fizzly for the mention!


I’ve created a plugin that allows minecarts (or any other event) to move along a predefined route, drawn using Region ID 7 (which you can change via script if needed).


How it works:​


Just use this in a Script Call:
KartRide.toggle(eventId, [x1, y1], [x2, y2]);
  • eventId: the event ID of the cart. Only one event is needed—it disappears at the starting point and reappears at the destination.
  • [x1, y1]: coordinates of the first endpoint
  • [x2, y2]: coordinates of the second endpoint

You can download the plugin here:
https://axgin96.itch.io/minecart-ride


How to use it:​


  • Draw the route using Region ID 7 between the two points you want the cart to travel.
  • This event is designed so the player can ride the cart along the defined path.

Tips:​

  • Since the cart event is automatically moved and hiddenat departure, and then reappears at the destination, I recommend:
    1. Activating a Self Switch when the player interacts with the cart.
    2. Creating a second event page with no image, triggered by that Self Switch.
    3. Once the ride ends, turn off the Self Switch so the cart reappears in the final position.
  • If you have followers enabled, it might be a good idea to temporarily hide them during the ride. Otherwise, they’ll try to follow the player on foot, which can break immersion.



I’m not a pro developer, but I’m working to polish and optimize the plugin as much as I can.
Any feedback or suggestions are always welcome!
That is a really nice plugin that I am 100% sure will be useful.
Thank you very much for making it.

For now I already got it working with region IDs and parallel events, but I'll save this one for future reference.
That is a really nice plugin that I am 100% sure will be useful.
Thank you very much for making it.

For now I already got it working with region IDs and parallel events, but I'll save this one for future reference.
Awesome! I'm glad you got your carts working! Before I made the plugin, I was hoping it would be way easier to get them moving haha.
Happy game dev!
This thread is closed due to being marked solved. If you need it reopened, report it to let us know.

The report button can be found at the bottom of your posts and will put your thread directly in our queue to let us know you need assistance. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/solved-pushing-a-cart-along-a-track.178037/