Disable mouse movement, leave it working with pictures and menus

Hey, I need some help.
I'm making a clicker game. Then I disable mouse movement with plugins, I can't click on my pictures.
I use yep_pictureCommonEvents.
How did you disable mouse movement?

This should do it:

Code:
Game_Temp.prototype.setDestination = function(x, y) {
};
I use galvs pixel movement plugin which disables clicking. I figured out a work-around my bug, place another clickable image under the clicker event, so instead of accidentally clicking on the map during the clicker game and bugging movement, now a player clicks on a picture with a empty common event, but as far as I tested, your script works just fine and a less messy solution. Thank you!
another clickable image is quite a good solution. I actually used that approach myself when I was making a hidden object game way back when (not in RM).
Too bad, even with your scrip bug still persist. Then the event ends, sometimes a player just starts to walk in one direction without stopping and user input won't work. Interestingly enough, pressing in the same direction a character is walking will brake autonomous movement. It's annoying.

These are direct causes of that. Removing them removes the problem, but I want to disable movement during an event.

at the start of clicker event

// disable move by 4 directions

var pe = {37:false,38:false,39:false,40:false,65:false,87:false,68:false,83:false,16:false};

for(i in pe) Input.keyMapper = pe;


And most likely this code below is the cause of trouble
at the end of clicker event

// enable move by 4 directions

var pe = {37:"left",38:"up",39:"right",40:"down",65:"left",87:"up",68:"right",83:"down",16:"shift"};

for(i in pe) Input.keyMapper = pe;


YEP_StopMapMovement plugin would work just fine, but it disables mouse clicking.

//=============================================================================
// Yanfly Engine Plugins - Stop Map Movement
// YEP_StopMapMovement.js
//=============================================================================

var Imported = Imported || {};
Imported.YEP_StopMapMovement = true;

var Yanfly = Yanfly || {};
Yanfly.Stop = Yanfly.Stop || {};
Yanfly.Stop.version = 1.02

//=============================================================================
/*:
* @plugindesc v1.02 A utility plugin to stop events from automatically
* moving by themselves all across your map.
* @author Yanfly Engine Plugins
*
* @param Stop During Events
* @type boolean
* @on YES
* @off NO
* @desc Stop automatic movement during events?
* NO - false YES - true
* @default true
*
* @param Stop During Message
* @type boolean
* @on YES
* @off NO
* @desc Stop automatic movement during message displaying?
* NO - false YES - true
* @default true
*
* @help
* ============================================================================
* Introduction
* ============================================================================
*
* A feature that was removed from RPG Maker 2000 and RPG Maker 2003 was the
* Stop Event Movement event. This event prevented events from automatically
* moving by themselves, so they don't intrude on cutscenes, catch up to the
* player during messages, etc.
*
* This plugin recreates that feature in the form of a plugin command for you
* to use with RPG Maker MV!
*
* ============================================================================
* Plugin Commands
* ============================================================================
*
* You can use the following plugin commands to produce the following effects:
*
* Plugin Command
*
* StopEventMovement
* Stops events from automatically moving by themselves. You can still move
* events through movement routes set by your active event.
*
* AllowEventMovement
* Allows events to move automatically by themselves again. If you have any
* of the plugin parameters disabling events from moving during either events
* or messages, this will not bypass it.
*
* StopPlayerMovement
* Stops player from being able to move via input. You can still move the
* player through movement routes set by your active event.
*
* AllowPlayerMovement
* Allows player to move again via input.
*
* ============================================================================
* Changelog
* ============================================================================
*
* Version 1.02:
* - Updated for RPG Maker MV version 1.5.0.
*
* Version 1.01:
* - Optimized updating performance to reduce lag on maps with many events.
*
* Version 1.00:
* - Finished Plugin!
*/
//=============================================================================

//=============================================================================
// Parameter Variables
//=============================================================================

Yanfly.Parameters = PluginManager.parameters('YEP_StopMapMovement');
Yanfly.Param = Yanfly.Param || {};

Yanfly.Param.StopEvent = eval(String(Yanfly.Parameters['Stop During Events']));
Yanfly.Param.StopMsg = eval(String(Yanfly.Parameters['Stop During Message']));

//=============================================================================
// Game_Temp
//=============================================================================

Game_Temp.prototype.stopMapEventMovement = function() {
this._stopMapEvents = true;
};

Game_Temp.prototype.stopMapPlayerMovement = function() {
this._stopMapPlayer = true;
};

Game_Temp.prototype.allowMapEventMovement = function() {
this._stopMapEvents = false;
};

Game_Temp.prototype.allowMapPlayerMovement = function() {
this._stopMapPlayer = false;
};

Game_Temp.prototype.isStopMapEventMovement = function() {
return this._stopMapEvents;
};

Game_Temp.prototype.isStopMapPlayerMovement = function() {
return this._stopMapPlayer;
};

//=============================================================================
// Game_Player
//=============================================================================

Yanfly.Stop.Game_Player_canMove = Game_Player.prototype.canMove;
Game_Player.prototype.canMove = function() {
if ($gameTemp.isStopMapPlayerMovement()) return false;
return Yanfly.Stop.Game_Player_canMove.call(this);
};

//=============================================================================
// Game_Event
//=============================================================================

Yanfly.Stop.Game_Event_updateSelfMovement =
Game_Event.prototype.updateSelfMovement;
Game_Event.prototype.updateSelfMovement = function() {
if (this.preventSelfMovement()) return;
Yanfly.Stop.Game_Event_updateSelfMovement.call(this);
};

Game_Event.prototype.preventSelfMovement = function() {
if (this._moveType === 0) return true;
if ($gameTemp.isStopMapEventMovement()) return true;
if (Yanfly.Param.StopMsg && $gameMessage.isBusy()) return true;
if (Yanfly.Param.StopEvent && $gameMap.isEventRunQuick()) return true;
return false;
};

//=============================================================================
// Game_Map
//=============================================================================

Game_Map.prototype.isEventRunQuick = function() {
return this._interpreter.isRunning() || this.isAnyEventStartingQuick();
};

Game_Map.prototype.isAnyEventStartingQuick = function() {
var max = this._events.length;
for (var i = 0; i < max; ++i) {
var ev = this._events;
if (ev && ev.isStarting()) return true;
}
return false;
};

//=============================================================================
// Game_Interpreter
//=============================================================================

Yanfly.Stop.Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
Yanfly.Stop.Game_Interpreter_pluginCommand.call(this, command, args)
if (command === 'StopEventMovement') $gameTemp.stopMapEventMovement();
if (command === 'AllowEventMovement') $gameTemp.allowMapEventMovement();
if (command === 'StopPlayerMovement') $gameTemp.stopMapPlayerMovement();
if (command === 'AllowPlayerMovement') $gameTemp.allowMapPlayerMovement();
};

//=============================================================================
// End of File
//=============================================================================

P.S I just found a solution. I made tiles impassible and enabled directional fix to turn off turning. That's all I needed. 🙂 Thanks a guy who wrote this plugin
https://rpgmaker.net/content/engines/rmmv/utilities/ShallNotPass.js
That doesn't sound like a related issue.

If a character is just walking in one direction, it sounds like you've set a movement route on them, with Repeat. Forcing them to move will break the movement route. Look at your events.
I tested on a blank event, only with that script. Parallel process,
// disable move by 4 directions

var pe = {37:false,38:false,39:false,40:false,65:false,87:false,68:false,83:false,16:false};

for(i in pe) Input.keyMapper = pe;


wait 120

// enable move by 4 directions

var pe = {37:"left",38:"up",39:"right",40:"down",65:"left",87:"up",68:"right",83:"down",16:"shift"};

for(i in pe) Input.keyMapper = pe;

and the bug occurs.

The same thing happens on a new project, zero plugins.

ZLpxOVC.png


If you move while event runs, your input/movement most likely be stuck and you lose control over your character. It's like a movement key stuck then keyboard keys are disabled/enabled by a script and the only way to unstuck is to press same direction key a character is walking. But mouse pathfinding works just fine without that bug.
I'm not sure what the purpose is of your script call. I think Input.keyMapper = pe is a bit sus - check and make sure the script call is right.

Is that related to the original question for this thread? It doesn't seem that it is, so might be better off in its own thread in the support forum.
My real event looks different. More like

Disable keyboard
Show picture
Click on picture #1 = run common event, show picture #2
Click on picture #2 = run common event, show picture #1, if score = 100
Delete picture #1+#2, enable keyboard
...and the problem with movement starts.

It's just there's no logic for that to happen. I think it has to do something with the mouse. Whatever the reason, I managed to work around it. So the thread can be closed.

Original thread: https://forums.rpgmakerweb.com/threads/disable-mouse-movement-leave-it-working-with-pictures-and-menus.95931/