Here is the code which was the most successful:
◆Show Choices:Push, Pull (Window, Right, #1, #2)
:When Push
◆Play SE:Equip2 (90, 60, 0)
◆Set Movement Route:This Event (Skip)
: :◇Move away from Player
◆Set Movement Route:Player (Skip, Wait)
: :◇1 Step Forward
◆
:When Pull
◆Play SE:Equip2 (90, 60, 0)
◆Set Movement Route:Player (Skip)
: :◇1 Step Backward
◆Set Movement Route:This Event (Skip, Wait)
: :◇Through ON
: :◇Move toward Player
: :◇Through OFF
◆
:End
The push method works extremely well and is very smooth, but...
There are two problems with this method:
1. If I "Pull" until I have my back to a wall with the barrel in front of me, I can still "Pull" one more time and the barrel ends up on top of me. It could be part of the gameplay, I guess, but I'd rather it weren't. It feels unnatural and makes puzzles easier to solve.
2. If I "Pull" the barrel, then try to "Push" again, nothing happens. I have to move a little before i can interact with the barrel again. I suspect it is because of the "Through ON" bit.
EDIT: For the first issue, I tried using a conditional branch that asks "did the player's X,Y change?" It didn't work. I wonder if the player's X,Y doesn't fully update after "1 Step Backward". That would explain the second problem I'm having, and why most of my attempted workarounds turned up bunkus.
Making A Pushable and Pullable Barrel
● ARCHIVED · READ-ONLY
-
-
So, first let me tell you what your code does.
If push:
Move the barrel one square away from the player. If it can't move, ignore this movement.
Move the player towards the barrel. If he can't move, ignore this movement.
If pull:
Move the player one square back. If he can't move, ignore this movement.
Move the barrel one square towards the player. Ignore any kind of obstacles that are in the way of the barrel.
If you use Through on, then no wonder the barrel will pass through player if player cannot move.
This works correctly for me and without any bugs.
As for your question... You need to learn to use wait commands. It takes a while before a command fully finishes too, so if you issue a move order and then immediately ask for coords, then it won't work for you, simply because the position hasn't been updated yet. It gets updated once the movement finishes. The reason for it is pretty simple too.Spoiler alert: Solution!
And yes, the Through is the reason why you have to move before the thing can be activated again... Although here I don't know the reason. -
Thanks, Poryg
Unfortunately, the Wait function isn't doing it for me. I tried it up to 120 frames after the player has moved, but the barrel still doesn't move. It acts like it thinks that the player is still standing on that coord, even after the players has stopped moving. I've triple-checked my work to make sure it matches yours, but it still isn't working.
I'm running MV 1.4.0 (all folders have been updated, too). I also have several trusted plugins installed, but all of them were turned off before I tested this. Did this just turn into a technical support issue?
My most recent Code (Just in Case)◆Show Choices:Push, Pull (Window, Right, #1, #2)
:When Push
◆Set Movement Route:This Event (Skip)
: :◇Move away from Player
◆Set Movement Route:Player (Skip, Wait)
: :◇1 Step Forward
◆
:When Pull
◆Set Movement Route:Player (Skip)
: :◇1 Step Backward
◆Wait:5 frames
◆Set Movement Route:This Event (Skip, Wait)
: :◇Move toward Player
◆
:End -
Ah hahahahaha :D
I see now!
You have followers turned on and they are blocking the event! Why didn't I realise it sooner, I have no idea...
But to clarify it, followers have same priority as character, so they will effectively block any events (which can be used in some maps to save you from encounters btw.). The solution is easy, turn off followers in database-system. -
LOL! I never would have found that. That explains why I thought I essentially had a ghost blocking the barrel... it's because I did.
Thank you so very, very much. If I put together a tutorial for what I'm building, I'll be sure the credit you for your help.
EDIT: To anybody troubleshooting this same issue, you should know that my character HAD NO FOLLOWERS. Regardless, having "Show Player Followers" checked under Database-System-Options still causes the barrel to be blocked by your three 'ghost' followers. -
That is because you HAD followers in your party. It's quite a common mistake though.
Because while it may appear to you that they aren't there... They are. If you look at the party, you have three nameless actors in the party.When you want to delete actors, just clearing the slot like this is not enough.
If I want to prove it, if I simply type the names in, they will appear in Database - System - Starting Party. The thing you need to do is delete them from there.
Or there is a second way to remove members from starting party and that is to decrease the Actor database size to 1 by the Change maximum button. But you had there your followers.As you can see, I right clicked my fourth party member. The name is empty, but he is there, because I can delete him.