How to make player run on button press

Hi,

Having some issue with this.

I have set 2 common events (1st is triggered on a parallel on first map)



1)
Conditional Branch if Z is being pressed
Call common event 2
Else
Change speed to 3 (walk)

2)
Conditional Branch if Z is being pressed
Change speed to 4 (run)
Else
Call common event 1


This seems to work fine, until I teleport to a new map and then it stops working. (If Z is being pressed to run, when I enter the new map it is set to constantly run and releasing / pressing Z does nothing, just keeps him fast).

Also, if I then return to the 1st map (where the parallel is), the run and walk work again, but the player can now move on water and through all objects (tileset priority rules still apply though).

Any guidance on what I am doing wrong please?

TIA!

(Edit - Just realised, this isn't a script request - sorry!)

This has been resolved, see answer below!


For anyone looking to add running sprites, just add the change actor graphic above the set move route commands.
please show us a screenshot ofboth the common event and of the event that activates it.
if a common event is activated, it should be for all maps, so that is where you probably made a mmistake.
Screenshot below.

Thanks!
your problem is that the parallel process is a map event, not a common event.

please change the common event "walk" to trigger = parallel process, select a switch for the trigger and then in the map event, turn the switch ON once before switching off the parallel map process.
"call common event" is a command that should NOT be used for this case.

EDIT: Typo where I messed up on/off corrected
Ahh thanks!

So now, it is working where pressing Z runs and releasing walks.
However, there is still the issue that as soon as I enter any different map, it allows the player to walk through all tiles.
any modification to the input scheme should be done by plugin, not eventing.
unless you want to make a very one-use addition for a very specific situation... if not, then anything to do with controls should be added to the Input module.
that's what the module is there for.
Thanks gstv87

​

Sorry if a silly question, but is this applicable to XP?

Edit - Just seen that plugins are the VX / MV version of scripts.
However, there is still the issue that as soon as I enter any different map, it allows the player to walk through all tiles.
that has nothing to do with the common event as nothing in it can change passability.

there are only two possibilities:
either it is a completely different bug that has nothing to do with the common event, or the switch used for triggering the common event has already another use in a script that you forgot to configure, or an event that changes the passability.
that has nothing to do with the common event as nothing in it can change passability.

there are only two possibilities:
either it is a completely different bug that has nothing to do with the common event, or the switch used for triggering the common event has already another use in a script that you forgot to configure, or an event that changes the passability.
Yeah it must have been an event error somewhere because it worked on a new project. Thanks all!

I have updated the original query too as there was a second part I left off (running sprites)

I've moved this thread to XP Support. Thank you.


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-player-run-on-button-press.133927/