Making A Pushable and Pullable Barrel

Sethorion

Villager
Member
Joined
May 8, 2015
Messages
19
Reaction score
7
First Language
English
Primarily Uses
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.
 
Last edited:

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
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.
Screenshot_66.png
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.
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.
 

Sethorion

Villager
Member
Joined
May 8, 2015
Messages
19
Reaction score
7
First Language
English
Primarily Uses
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?

◆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
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
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.
 

Sethorion

Villager
Member
Joined
May 8, 2015
Messages
19
Reaction score
7
First Language
English
Primarily Uses
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.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
That is because you HAD followers in your party. It's quite a common mistake though.
Screenshot_67.png
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.
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.
Screenshot_68.png
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.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,018
Members
137,563
Latest member
MinyakaAeon
Top