MV Cart Push Event

Okay, help. I'm missing something here. I feel like I'm close but need another pair of eyes. I'm doing a typical cart pushing event in my game. The cart can only be pushed up and down. I want a variable to track it's X/Y position so when the player leaves that map and returns, it then runs a parallel process to move that cart in the last location it was pushed to. However, I leave the map, return, and it's back to the original location despite the fact I pushed it.

CART EVENT:

I have the event set up with the move routes and put the "Control Variables" at the end (one for X, one for Y). I'm under the impression this will store that event's X & Y location globally, correct?

1755580844034.png


PARALLEL PROCESS EVENT:

I then have a parallel process that (I thought) should run and move that event to it's saved X & Y coordinates. I have the X conditional branch and Y set to do nothing if the cart is in it's original location. Else, it moves to the stored location. Or am I not storing the variables correctly? Also, I only have one X conditional branch because you cannot push the cart left or right... it will always be on coordinate 8. Only Y changes.

1755580947087.png


Finally, at the end of the parallel process I have the Cart Loader to stop it from continously checking the coordinates. When you leave the map, I have that switch turned OFF, that way it runs the parallel process 1x again when you re-enter the map.

Thanks for any help here. Or maybe I am doing it completely wrong LOL
For what I can see, your condition is, say backwards.

You state it yourself : "If the cart is in its original position, it does nothing, else it moves to where it should"
Therefor, if the cart goes back to its original position, it won't do anything, since it is at its original position ^^

Rather, I would use a switch when you first activated the event, after that, just place it back to last recorded position using the common event, regardless of if it moved or not.
I think your ELSE branch in your double-IF is not yet correct.

Your "set event location" is ONLY called IF X is true AND Y is not. When X is not true, then your command is already skipped.

I think it should look like this:

Code:
IF x = 8:
  IF y = 16;
    ...
  ELSE
    move event
  END
ELSE
  move event
END
It's a bit uncommon to have a "move event" 2 times, but sometimes it's just this way.
and the next error is with your assumption on how parallel events and switches work.

First, only events on the current map exist. Which means your parallel map event does not exist while the player is on a different map.

Second, switches are permanent until changed again - if you switch off an event, that event will stay off until you change the switch again. leaving and returning to a map will NOT change that.
What you should do in such a case is simply erase the event, then it will be loaded again on reentering the map.
This isn't a place to use a parallel event – you should set it to autorun instead, and put an Erase Event command at the end of the event. That way, it runs once every time you enter the map and then stops. If you do it that way, you can probably even get rid of the if blocks altogether and just move the event to the stored location (though, I guess you'd still have to check that the stored location is valid somehow).
@Solar_Flare actually you're wrong, parallel is much better here than autorun - the erase event would be needed in both cases.

that is because parallels are processed before autoruns - if you use an autorun the player might see the cart in the original position before jumping to the correct position.

and the if-blocks are needed in case the event hadn't been moved at all.
because if the event had not moved then the variobles would be 0,0 and move the cart to the map edge top left.

and no, setting the variables before entering the map to the original problems would have other disadvantages, it's easier to have the conditions on the map itself.
and the if-blocks are needed in case the event hadn't been moved at all.
because if the event had not moved then the variobles would be 0,0 and move the cart to the map edge top left.
I did mention this though.

that is because parallels are processed before autoruns - if you use an autorun the player might see the cart in the original position before jumping to the correct position.
What is the actual chance of this happening? Just how much of a delay would there be if using an autorun for this? In any case, it's only relevant if the cart can ever be visible from the entrance point.
What is the actual chance of this happening?
it is always happening, and the delay is somewhat around 10 frames or so - it's just for a moment, but the cart will be visible in the original position.

you can find hundreds of topics here on the forum where people had problems with that, although it usually was not an event position but a delay in weather effects or in map overlays appearing and so on.
Ah, thank you ALL for this. Yes, I made a few minor tweaks and made those changes. They worked great! And thank you Andar for the reminder. I always forget about Erase Event. So much easier than using a switch. It's now working 🙂

Original thread: https://forums.rpgmakerweb.com/threads/cart-push-event.179650/