MV Lock player movement while holding down mouse button? (not autorun)

Hello all!

I would like for my player's movement to lock specifically when the player is holding down the mouse button.

However, the player should still be allowed to use skills and otherwise input commands while this is happening. It's just the movement that I'd like to be locked (hence why I don't really see autorun being a good solution here).

Any ideas would be greatly appreciated! Thank you for your time!
What do you mean by "lock movement"? That the player cannot move? That movement is automatic but only in one direction? That the player continues to move and follow the mouse as long as the button is held?

How is the player going to use skills or input commands if they are already holding down the mouse button? Using skills or inputting commands requires them to click the mouse button, doesn't it? How can they click a button that is already being held down?
What do you mean by "lock movement"? That the player cannot move? That movement is automatic but only in one direction? That the player continues to move and follow the mouse as long as the button is held?

How is the player going to use skills or input commands if they are already holding down the mouse button? Using skills or inputting commands requires them to click the mouse button, doesn't it? How can they click a button that is already being held down?

Apologies for being too vague. I mean that the player should be stuck in place, unable to move in any direction. In my game, the player can do things such as teleporting or attacking with the z and x keys since it's an ABS game.

So I'd still like him to be able to use those kinds of skills while his movement is locked (as in he could still, say, heal himself or use another attack while being unable to move).

I guess you could also approach it as the arrow keys/WASD get disabled while the mouse button is held down? (But I don't know how to do that either).

Thank you for the response and sorry again for not being clear
Moderator note: I have moved this to Plugin Requests

Try saving the following into your plugins folder - call the file DisableMove.js or something like that - name doesn't really matter. I have not tested this, so it might not work properly.

Code:
var _noMove_GamePlayer_canMove = Game_Player.prototype.canMove;
Game_Player.prototype.canMove = function() {
  return _noMove_GamePlayer_canMove.call(this) && !TouchInput.isPressed();
}
Moderator note: I have moved this to Plugin Requests

Try saving the following into your plugins folder - call the file DisableMove.js or something like that - name doesn't really matter. I have not tested this, so it might not work properly.

Code:
var _noMove_GamePlayer_canMove = Game_Player.prototype.canMove;
Game_Player.prototype.canMove = function() {
  return _noMove_GamePlayer_canMove.call(this) && !TouchInput.isPressed();
}

It works perfectly! I don't know what to say; I didn't expect you to just up and write a script for me!
I really appreciate you taking the time to help me out like this.
It was easy/quick 🙂 Glad it works.

Thread closed

Original thread: https://forums.rpgmakerweb.com/threads/lock-player-movement-while-holding-down-mouse-button-not-autorun.132563/