I'm in the process of converting my script calls from the Ace version of my game to the MV version. In Ace I had a mouse system that provided player movement and menu access, with a simple script call to disable or enable it. I'm wanting to do the same in MV but I'm not really familiar with the internal working of the touch/keyboard input system.
I'm looking for an easy way to enable/disable all input, and it will affect the mouse/touch/keyboard, with respect to menu access as well as player movement. I know about the Change Menu Access command, but that's only half of what I need.
I'm thinking an easy solution might be to just have an autorun common event that I could enable/disable with a switch, and I think that might handle it all. I'd just have to make sure it's not turned on when there are any other autorun events happening.
Does this sound like it would work? Would I be better of writing a plugin? Can you think of an easier/better way?
Autorun common event is a solution, but that is kind of an overkill. I think I might write a plugin that will disable movement with switch on and disable menu access with another switch on.
I'll build a plugin that will block all movement upon turning a switch. I'll still leave changing menu access to the default RPG maker command though, because there's no point in building something already built.
The shortest solution would be to remove event listeners, but that would disallow all input including enter.
The easiest solution to disable movement by input is to simply edit the moveByInput function inside rpg_objects.
Changing moveByInput would take care of keyboard movement, but would it also disable touch/mouse clicking? I want to stop the player from setting that destination location in Game_Temp, but still be able to set it myself if I want some pathfinding.
Yeah, can't disallow all input, because the player still needs to be able to close message boxes and select choice options.
I'm not against writing a plugin, but was wondering if there was a non-scripting option first.
moveByInput function takes care of all movement, including joypad and mouse. So changing it can take care of everything.
It's true that you can disable input movement via autostart, but I don't like that, because 1. it halts movements of all events and 2. I have a low end computer.
In order to allow event movements it would be necessary to set a parallel process event that continuously sets up wait move routes to override the default ones. But you have to set the wait commands long enough to make sure the execution time will make it till another tick. Which of course only increases in case of lags.
that's interesting - move by input only handled player movement in Ace. That's where I put the code to disable keyboard movement if the mouse was disabled. It didn't affect events.
However, I'll check out that function as a starting point. Thanks 🙂
I'm not seeing where moveByInput halts movement of events.
I think a scripting solution would require changes to Game_Player.getInputDirection and Scene_Map.processMapTouch to stop player movement. But it would also have to include the disabling of menus.
In my Ace mouse script, mouse controls were converted to keyboard controls, so the right-click was handled by default and I just had to change move_by_input. In MV, mouse/touch controls are handled separately so there are more functions that need to be adjusted.
This is why I was leaning towards a non-scripting solution - autorun events already do all the things I'd want a script solution to do. So I would either just use an empty autorun event that does nothing but prevent player movement / menu access, for the times I need it to, or look at everywhere in the scripts that check whether an autorun event is running, and mimic that in a new script to disable input. Seems a bit redundant.
Aaaa, sorry, I mistyped my answer for some reason (either I had deleted that sentence or was typing in two windows at once). It's fixed now 😀
So I had a bit of a hunt around at lunchtime. I think I'll just write a plugin to do it. Should be able to get away with aliasing Scene_Map.updateDestination and Game_Player.getInputDirection - this should disable movement via keyboard and mouse/touch, but still let me use setDestination to do pathfinding for the player.
It's not as difficult as I initially thought it would be - I was expecting to have to go playing in the Input Manager as well.