Disable Input During Movement

I have come across a game-breaking issue, and I am desperately seeking a kind soul who would possibly know what to do and be willing to do it for me.


The issue begins with Yanfly's Button Common Events.  (https://github.com/Archeia/YEARepo/blob/master/Field/Button_Common_Events.rb)


I have six common events set to buttons. Q opens an inventory screen (displays pictures and choices), W opens a map screen (displays pictures and choices), X opens an equip screen (pictures and choices again), and A, S, and D, can have equipment set to them. Equipment works similar to Zelda 1. You can put down a bomb, or fire a bow, or use a magic wand to burn certain trees with fire or freeze water. I don't think the contents of the common events are the problem here though.


What I've found is that events on the map that can be activated on touch can be skipped using the button common events. If you step toward the tile that the touch event is on, and press a common event button during the walking animation, when you land on the event, it'll do the common event linked to the button, but not the touch event.


Alternatively, I tried having the touch events be parallel processes that trigger when your map X and Y matches the events map X and Y, but that caused some even weirder problems that I couldn't even begin to understand, so I don't think it's a viable solution.


Now, the built in menu doesn't do this. If you try to get into the menu while moving to a touch event tile, nothing happens before, nothing happens after, and the touch event will activate when you stop moving. Ideally, I would like to have the common event buttons work the same way as the built in menu. I'm assuming it's just disabling the input while the player is moving, but I don't know much about how the inner workings of the program do their thing.


I don't know if this is as easy as copying and pasting code that already exists, or if it's a little deeper than that, but if someone had an idea of how to make this work, I would be very grateful. Without a fix, it's essentially forcing me into scrapping a lot of the work I put in, replacing my custom mechanics for boring "Want to try doing this? Yes/No" sort of stuff, and that's really lame after I got so excited about making things work the way I imagined them to work.


Please. I'll beg if you want me to.
By default each event can only have 1 type of trigger. You will need a script to enable it to be triggered both ways. And on top of that, you will need to set up a conditional branch to check if the player is on the event or beside it to make it trigger 2 different commands.


Give this script a try, it's normally made for trap events but can be use in your case here as well:
Sorry, the parallel process thing might have been misleading. That was just a solution I thought of for the problem that didn't work.


Here's an example of the problem with pictures.

Spoiler
yfwqxum.png

The player is the green haired girl. When she moves one tile up from here, it triggers this next picture.

Spoiler
tVBd0nl.png

This is done with a touch event below the player, of course.


Now, this is what the item currently set to the A button does.

Spoiler
06vhsfL.png

It shoots that blue fireball looking thing in front of you. Most of the items work the same way. However, if you push the A button in the position in this next picture;

Spoiler
WB9MDFN.png

Then this happens.

Spoiler
zzuHH2f.png

And the event that's supposed to trigger the characters turning, text showing up, is skipped.


The goal here is to disable the inputs during the movement frames, or to somehow have that event underneath trigger after the common event is complete.
Try to change this method:

Spoiler
def update_button_common_events
for key in YEA::BUTTON_EVENT::COMMON_EVENT
next unless Input.trigger?(key[0])
next if key[1] <= 0
$game_temp.reserve_common_event(key[1])
end
end

To this one:

Spoiler
def update_button_common_events
return if $game_map.interpreter.running? || $game_player.moving?
for key in YEA::BUTTON_EVENT::COMMON_EVENT
next unless Input.trigger?(key[0])
next if key[1] <= 0
$game_temp.reserve_common_event(key[1])
end
end

In that button common event script.


This should disable these button events when another non-parallel event is already running or when the player is moving.
I had a feeling it was something simple like that. Thank you so very, very much.
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/disable-input-during-movement.58065/