thekats

Villager
Member
Joined
Apr 6, 2022
Messages
8
Reaction score
3
First Language
German
Primarily Uses
RMMZ
Hello all,

I'm looking for a way to temporarily disable a player's ability to move in certain directions or alternatively allow them to move only in certain directions. I've found there's a plugin for MV that does this (made by HimeWorks), but it obviously isn't built to work in MZ.
Specifically, I'd like to lock and unlock/block and allow movement only on X-axis or Y-axis depending on how they player initially engages with an event. So something like "if player is facing down, lock movement to y-axis".
I'm relatively new to scripting, but if someone can give me pointers to anything I may have overlooked that exists there, I should be okay to work that in. Alternatively, if someone knows of a plugins that I didn't find in my google searches, I'm just as happy to use them.

The current state of my event is:
Player is at a distance of 1 from the event
Player direction is event location
[OK] is being pressed to interact
--- player is locked onto axis of direction faced (y for facing up/down; x for facing left/right) ---
Player can move object along with them --- along above-specified axis ---

And then obviously that movement direction lock is lifted when [OK] is released.
:)
 

AmVa

Veteran
Veteran
Joined
Jul 6, 2022
Messages
38
Reaction score
8
First Language
English
Primarily Uses
RMMV
As far as I'm aware, the most efficient way to lock the player into certain actions is by using a loop (as long as the event isn't a parallel process).

Start the loop
wait 5 frames (to give the player time to press a button)
add branches for the actions you're allowing the player to do (if right is pressed, etc.)
add commands for the actions (move right, etc.)
add a way for the player to exit the loop (if escape is pressed, etc.)
break loop

the player will not be able to do anything while in the loop (besides pressing buttons) so you have complete control of what will happen based on the button pressed.
 

thekats

Villager
Member
Joined
Apr 6, 2022
Messages
8
Reaction score
3
First Language
German
Primarily Uses
RMMZ
As far as I'm aware, the most efficient way to lock the player into certain actions is by using a loop (as long as the event isn't a parallel process).

Start the loop
wait 5 frames (to give the player time to press a button)
add branches for the actions you're allowing the player to do (if right is pressed, etc.)
add commands for the actions (move right, etc.)
add a way for the player to exit the loop (if escape is pressed, etc.)
break loop

the player will not be able to do anything while in the loop (besides pressing buttons) so you have complete control of what will happen based on the button pressed.
Hi, thanks for the reply.
I should have mentioned that it is a parallel event. I did just try to set it up the way you suggested, but it produced the same result in terms of movement directions, only it looked less elegant and felt less intuitive (to me). Not to say it's a bad method at all, though! I genuinely hadn't considered that approach, though it seems much more obvious than using scripts.

As may be obvious it's supposed to be a push/pull mechanic as in many other games (eg Legend of Zelda) where the [OK] Button is the grabbing of the movable object. This, I think, only works with a parallel event? It seems like it should be a simple thing, really, but I'm too inexperienced and frequently get trapped in my rigid ways of thinking about processes, heh.
 

ZombieKidzRule

Note to Self: Patience Newbie...Patience.
Veteran
Joined
Jan 9, 2022
Messages
764
Reaction score
845
First Language
English
Primarily Uses
RMMZ
I could be misunderstanding what you want, but here is a link to a tutorial for a very simple push/pull event.

The tutorial has the player choose push or pull each time they click on the event. But this could be modified where you lock in whether the player can push or pull each time they interact with the object that needs to be moved.

If this is way off, maybe if you explain what you want to do differently, then someone can provide a better answer.

There are other tutorials out there also if you search for RPG Maker Pull Pull. Those might be helpful too.

 

AmVa

Veteran
Veteran
Joined
Jul 6, 2022
Messages
38
Reaction score
8
First Language
English
Primarily Uses
RMMV
I should have mentioned that it is a parallel event
why though?

parallel events run simultanously with other things that happen in the game, including the player's input, so it can't be used for this purpose. it has to be either an autorun event or a loop, otherwise the player will be able to move freely...
 

ZombieKidzRule

Note to Self: Patience Newbie...Patience.
Veteran
Joined
Jan 9, 2022
Messages
764
Reaction score
845
First Language
English
Primarily Uses
RMMZ
@AmVa I'm not sure what you are saying is completely true. I use Parallel events that have Loops in them. I also use Parallel events that allow the player to move certain ways for certain amounts of time.

It wouldn't be hard to limit how the player moves in the Parallel event Loop.

When I don't want the player to move at all during a Parallel event, I freeze them in place.

Unless I am misunderstanding your point.
 

Arthran

Veteran
Veteran
Joined
Jun 25, 2021
Messages
860
Reaction score
1,060
First Language
English
Primarily Uses
RMMZ
I've found there's a plugin for MV that does this (made by HimeWorks), but it obviously isn't built to work in MZ.
Did you try it? Not all MV plugins are incompatible with MZ. I haven't looked at it, but it sounds (at least off the top of my very tired head) like the type of thing that has a decent chance of being compatible.
 

thekats

Villager
Member
Joined
Apr 6, 2022
Messages
8
Reaction score
3
First Language
German
Primarily Uses
RMMZ
why though?

parallel events run simultanously with other things that happen in the game, including the player's input, so it can't be used for this purpose. it has to be either an autorun event or a loop, otherwise the player will be able to move freely...
That is simply not true as the basic event itself is working perfectly except for that cosmetic flaw of sideways movement that I don't want. Autorun is something I avoid as much as I can because I feel it takes control away from the player (and in some cases myself as I'm setting up other events, but that's because I'm highle disorganised). Can be a neat feature and I'm sure other people really like it both as players and as developers. I'm myself just more a fan of giving the player as much freedom and intuitive gameplay as the story I'm trying to tell will allow.
I could be misunderstanding what you want, but here is a link to a tutorial for a very simple push/pull event.

The tutorial has the player choose push or pull each time they click on the event. But this could be modified where you lock in whether the player can push or pull each time they interact with the object that needs to be moved.

If this is way off, maybe if you explain what you want to do differently, then someone can provide a better answer.

There are other tutorials out there also if you search for RPG Maker Pull Pull. Those might be helpful too.


Thanks for the attempt, but no, this is not what I want. I am working some puzzles into my project and I don't want to annoy a player so keeping repetitive choice options and button pressing to a minimum is my ideal scenario. Just from experience, if you have 5 objects you need to move into certain positions or regions and every move requires a choice being answered with at the least two button presses is tiresome, I start button mashing and end up accidentally pushing when I meant to pull bc that was the default option (eg video footage "How about if I try to pull it?. Oops, I pushed it, sorry, wrong one.") ^^' it works well for stuff like revealing hidden passages when the object isn't something you expected to move, but for more complex puzzles with multiple entities... not for me.

I don't really know how to explain it differently... I want the player to be able to move these objects in a forward and backward motion, but not in a side-shuffle way (because it looks ridiculous, mostly). From all four directions the player is supposed to be able to approach and interact with the objects in this way, barring obstacles of course. They should be able to move as many tiles as they want and changing between pushing and pulling at will whilst still grabbing the object.
The action/OK button will work like the grabbing itself (Press [OK] -> hold on to object. Release [OK] -> let go of object).This part is working fine.
I have distance and direction specifiers simply to make the parallel event not go off any time the player presses [OK] on this map, like when moving another object or getting loot from a chest. This part is also working fine.
The only thing I'm stuck on right now is prohibiting the sideways-shimmy-shuffle whilst moving the object(s). I could probably set it up to force the player out of the action once they move sideways relative to the direction they're facing, but that feels very ugly to me and would frustrate me as a player.

I hope this explanation works better for you?
Did you try it? Not all MV plugins are incompatible with MZ. I haven't looked at it, but it sounds (at least off the top of my very tired head) like the type of thing that has a decent chance of being compatible.
I did try it and while I can add it to the plugin list, it does not show up as an option in the plugin commands, which is how it is operated. I have another MV plugin that works fine in MZ, so I was hopeful, too, before being disappointed :( If I knew anything about how plugins are made or had the time to learn (I mostly work on this project when procrastinating important things), I'd see if I could replicate the plugin but for MZ.
 

ZombieKidzRule

Note to Self: Patience Newbie...Patience.
Veteran
Joined
Jan 9, 2022
Messages
764
Reaction score
845
First Language
English
Primarily Uses
RMMZ
I could still be misunderstanding, but maybe you could have the Parallel event with the Loop that checks for key presses. You could have one key press that turns a Switch on or off. When On, you are pushing. When Off, you are pulling. No menu choice.

And you could only allow key presses for moving forward and backwards. Not sideways.

In fact, once they pick up the object or grab it or whatever, I would restrict their movement to only those key press options until they release it.

Maybe that won’t work for some reason with how specifically you want it to work. But you could try this to do it without menu choices.

I hope this helps or someone else has a better solution for you.
 

thekats

Villager
Member
Joined
Apr 6, 2022
Messages
8
Reaction score
3
First Language
German
Primarily Uses
RMMZ
I could still be misunderstanding, but maybe you could have the Parallel event with the Loop that checks for key presses. You could have one key press that turns a Switch on or off. When On, you are pushing. When Off, you are pulling. No menu choice.

And you could only allow key presses for moving forward and backwards. Not sideways.

In fact, once they pick up the object or grab it or whatever, I would restrict their movement to only those key press options until they release it.

Maybe that won’t work for some reason with how specifically you want it to work. But you could try this to do it without menu choices.

I hope this helps or someone else has a better solution for you.
I did, indeed, work out a loop that works now. Still has its kinks that I don't quite understand yet why they're happening, but starting a loop before the [OK] button press and just making 4 individual loops for each direction the player may be facing, and inside them only allowing the two relevant direction button presses, was the solution. Don't know why my brain keeps blocking itself from seeing these things, heh.
Now I'll just have to outsource the individual events to one map-wide one to reduce processes and lag, and I should be about set for this puzzle.
Thanks for getting me on the right path!
 

AmVa

Veteran
Veteran
Joined
Jul 6, 2022
Messages
38
Reaction score
8
First Language
English
Primarily Uses
RMMV
@AmVa I'm not sure what you are saying is completely true. I use Parallel events that have Loops in them. I also use Parallel events that allow the player to move certain ways for certain amounts of time.

It wouldn't be hard to limit how the player moves in the Parallel event Loop.

When I don't want the player to move at all during a Parallel event, I freeze them in place.

Just curious, what kind of setup are you using in order to pull this off?

I guess you could in theory have a wait or a movement command on the player every single frame in a parallel loop and it would kinda look like an autorun, but it's a bit clunky from my experience. when playtesting aggressively, the player could get a free movement at some point which is why I'm personally avoiding it.
You don't have to use autorun either, any other trigger with a loop achieves the same goal and there's no risk of any player input getting in the way.

Another issue is that I have common events which are bound to other keys. a parallel loop may overwrite movement, but it can't stop the player from activating these common events.
 

Latest Threads

Latest Profile Posts

swordsman defense :to show not to use.
show.gif
4,4,4.gifloop24.gif4.4.4.end.gif
I bought SALMIAC.:kaoluv: Salmiac is HEAVEN. Black, salty, hypertensive heaven! My dad once ate so much salmiac his doctor tole him to STOP! :biggrin:

Still no spoons tho. :kaophew:
I am supposed to be preparing to teach my students this afternoon and tomorrow morning about Refugees, Asylees, and Fraud/Misrepresentation and all I can think about is how to improve my Turn Order display. :stickytongue:
Try changing POV battle, near and far away like suikoden...
watercave2.jpg

diablofar.jpg

In the end I choose near over shoulder resembles RE4. Tight close window better. The correlation between battleback, monster style and battler should also be observed and merged.
Upgraded my avatar to be cuter.

Forum statistics

Threads
129,705
Messages
1,204,481
Members
170,780
Latest member
Jam1Eye
Top