New account registration is temporarily disabled.

[2K3] MOVEMENT SYSTEM

Posts

Pages: 1
I am trying to create an event that will stop the PLAYER from moving after moving X amount of tiles for X amount of time. The purpose of this event is so NPCs will only move after the player has moved X amount of tiles. I tried using a parallel process to halt the hero's movement and then when you press the direction keys it would disable the event for enough time to move for X tiles. The problem with this is if your holding the key down it won't work again until you release it, so you have to press the direction key every time you want to move a tile and if you press the key within .5 seconds of releasing it the game will think you never released the key.

Does anyone know a way I might be able to do this while holding down the directional keys?
It sounds like you must allow the parallel process handling the key processing to update at a faster rate. I think you should have an extra parallel process that just looks like this, and this alone:

Key Input Processing (Variable: "Directions")
If "Directions" is equal to 1,2,3, or 4,
>Turn switch ("The Directional Buttons Are Being Pressed") ON
End
Wait 0.0
Wait 0.0
Wait 0.0

This will be a really fast program that will accurately be able to tell whether the directional keys are being pressed at any given time. Then you can do whatever you want with the "The Directional Buttons Are Being Pressed" Switch... but remember to turn that switch OFF whenever you do, so that the program can work again.

Maybe that switch, if you already have it, isn't being turned OFF somewhere quickly enough.
I have two events, both parallel processes.

Event 1
Branch(If Switch ON)
^ Move Event: Hero Wait

Event 2
Key Input
Branch(If Variable 1-4)
^ Switch OFF
^ Wait 3/10 Seconds (Decreasing this will cause the hero not to move/Increasing this will make the player have to wait longer to move again)
^ Switch ON

The problem is that if you hold the directional key Event 2 will not repeat and you will have to release the key and because rpg maker isn't good with key detection if you press the key again too quick it will think it was never released. What I want is to be able to hold the directional key and move a tile, stop 1/10 seconds, and repeat until you release the key.
Try this instead:

Event 1
Branch (if Switch ON)
Move Event: Hero Wait
Move Event: Switch OFF

Event 2
Branch (if "A Waiting Variable" is Greater than 0)
^"A Waiting Variable" Subtract 1
^Branch (if "A Waiting Variable" is Less than or Equal to 0)
^^Switch ON
^
Branch (if Switch OFF)
^Key Input
^Branch (If Variable 1-4)
^^Branch (if "A Waiting Variable" is Less than or Equal to 0)
^^^Set "A Waiting Variable" to 18
^^
^
Wait 0.0

This will check to see if the player is inputting a key more often. The Key Input should be constantly checked. Also notice that Event 1 turns the switch OFF after the Hero Wait command is done executing.

18 "Wait 0.0" commands are equal to 3/10ths of a second.
----------
I also just remembered, that the amount of time the Hero waits can be adjusted by adjusting the Move Frequency of that Move Event command in Event 1. That might be why your window of opportunity was so narrow. Make the Move Frequency shorter and the Hero Wait won't cause the player to wait as long.
This kind of works. The only problem is when you initially press and hold the key the hero will not move for a bit then dart foward and then the event starts to work as intended.

Edit: Thanks to your idea I was able to get it to work. All I needed to do was this:

Branch (if Switch OFF)
^Key Input
^Branch (If Variable 1-4)
^^Branch (if "A Waiting Variable" is Less than or Equal to 0)
^^^Set "A Waiting Variable" to 8
^^^Wait 0.1 sec
^^
^
Wait 0.0

For some reason the Wait 0.1 sec makes a big difference. Thanks so much for your help!
Pages: 1