MV How do you permanently disable player movement?

I'm making a point and click game and don't want the player to be able to use wasd or the arrow keys to move. Is there anyway to do this without a event always being called?
it would depend on how your "point and click" works.
The simplest solution would be to simply keep the party empty and invisible sprites, and then ignore all movement command as nothing would show on the screen.

second option is to keep the game with all functions on a single autorun checking input.

third option would be a plugin to disable party movement.

and a few other possibilities
I want the point and click to act like Your Turn to Die. When you click something and event occurs. Notice how there are no characters. I want it to be like that.
1612988190539.png
Plugins would be neat but in the meantime, I'll just use invisible boxes and an invisible player. Thanks!
When you click something and event occurs.
I didn't ask what the player is supposed to see, I asked how you technically do the point and click, how you make the engine react to that.
because in default, the click becomes a movement command to the player and does nothing on its own. So if you stop the player from moving, the click stops working.
I think you should be able to do what you want using one of these:

You could also block regular player movement by giving them an empty, repeating move route (To cancel the route replace it with an empty, non repeating one). In case your map is bigger than one screen.

(Might be unneccessary when using the plugin though)
Double-post notice: @TheNamesMr101

Moderator note: Moving to Plugin Requests
Locking the player's movement is actually surprisingly simple...

JavaScript:
$gamePlayer._locked = true;

And of course if you wish to unlock them...

JavaScript:
$gamePlayer._locked = false;

...just run either from a script command.
Locking the player's movement is actually surprisingly simple...

JavaScript:
$gamePlayer._locked = true;

And of course if you wish to unlock them...

JavaScript:
$gamePlayer._locked = false;

...just run either from a script command.
So I tried this in a new project and I wasn't able to get it to lock the player's movement...
JavaScript:
$gamePlayer._locked = true;
Where did you put it? What error message did you get? We can't really help if you don't tell us the details.

My guess is that you put it in the wrong place. Put it in a script call event command at the time you want to lock or unlock movement.
Oh I see, it's a functionality added in MZ. Apologies, you can add it to MV by opening rpg_objects.js and editing Game_Player.prototype.initMembers to....

JavaScript:
Game_Player.prototype.initMembers = function() {
    Game_Character.prototype.initMembers.call(this);
    this._vehicleType = 'walk';
    this._vehicleGettingOn = false;
    this._vehicleGettingOff = false;
    this._dashing = false;
    this._needsMapReload = false;
    this._transferring = false;
    this._newMapId = 0;
    this._newX = 0;
    this._newY = 0;
    this._newDirection = 0;
    this._fadeType = 0;
    this._followers = new Game_Followers();
    this._encounterCount = 0;
    this._locked = false;
};

this._locked = false; is actually the only added line, and Game_Player.prototype.canMove to....

JavaScript:
Game_Player.prototype.canMove = function() {
    if ($gameMap.isEventRunning() || $gameMessage.isBusy()) {
        return false;
    }
    if (this.isMoveRouteForcing() || this.areFollowersGathering()) {
        return false;
    }
    if (this._vehicleGettingOn || this._vehicleGettingOff) {
        return false;
    }
    if (this.isInVehicle() && !this.vehicle().canMove()) {
        return false;
    }
    if (this._locked){
        return false;
    }
    return true;
};

...all that's added is...
JavaScript:
if (this._locked){

        return false;

    }

    return true;

You can of course just save it as a plugin as well if you don't wish to edit your main files.

Afterwards...
$gamePlayer._locked = true;

...will block movement. And $gamePlayer._locked = false will unlock them. As it defaults to false, you'll never notice if you don't lock them initially.
Where did you put it? What error message did you get? We can't really help if you don't tell us the details.

My guess is that you put it in the wrong place. Put it in a script call event command at the time you want to lock or unlock movement.
Yeah, I should have been more specific. I tried it with a press to activate event script call in a brand new project with no plugins, just to make sure it wasn't something another plugin was overriding.

I was able to find an alternate solution in the form of these scripts:
Spoiler: Disable move by all input
JavaScript:
// disable move by all input
if($gamePlayer.moveByInputCached === undefined)
$gamePlayer.moveByInputCached = $gamePlayer.moveByInput;
$gamePlayer.moveByInput = function(){
return false;
}

Spoiler: Enable move by all input
JavaScript:
// enable move by all input
$gamePlayer.moveByInput = $gamePlayer.moveByInputCached;

Oh I see, it's a functionality added in MZ. Apologies, ...
Ah, thank you! I will add this right now. I figured I was missing something.

-EDIT- 12:57am
@ImaginaryVillain I used the recommended edits in a new plugin file and while it did lock the player's movement, it also kept the player from being able to interact with the event that they were locked next to. I had to revert back to the scripts I found earlier.
Keep in mind that the state of your functions is application wide, so when you lock the characters movement like this it will remain locked after the player returns to the title screen and loads a different savefile. (Edit: My bad, I misread $gamePlayer as Game_Player.prototype)

The lock will also default to plugin settings when you restart the application.
I'm also not sure if you are able to save the game at all while $gamePlayer holds the cached function.
Edit: You seem to be able to save, but the function is lost when you reload.

Generally I'd assume it's recommended to replace functions after the fact as it might make troubleshooting more difficult (admittedly probably not in this case), and you could mimic this behaviour without swapping the function by adding an additional condition to it (see ImaginaryVillains solution).

(Not saying how one has to make their game work here of course. It might just work out after all.)


Edit: Didn't account for the player interacting with events while not being able to move. However, in this case you could add the condition to the "moveByInput" function rather than "canMove" for this effect:
Code:
var moveByInputCached = Game_Player.prototype.moveByInput;
Game_Player.prototype.moveByInput = function() {
    if (!this._locked) {
        moveByInputCached.call(this);
    }
};
Keep in mind that the state of your functions is application wide, so when you lock the characters movement like this it will remain locked after the player returns to the title screen and loads a different savefile.
The lock will also default to plugin settings when you restart the application.
I'm also not sure if you are able to save the game at all while $gamePlayer holds the cached function.
Edit: You seem to be able to save, but the function is lost when you reload.

Generally I'd assume it's recommended to replace functions after the fact as it might make troubleshooting more difficult (admittedly probably not in this case), and you could mimic this behaviour without swapping the function by adding an additional condition to it (see ImaginaryVillains solution).

(Not saying how one has to make their game work here of course. It might just work out after all.)


Edit: Didn't account for the player interacting with events while not being able to move. However, in this case you could add the condition to the "moveByInput" function rather than "canMove" for this effect:
Code:
var moveByInputCached = Game_Player.prototype.moveByInput;
Game_Player.prototype.moveByInput = function() {
    if (!this._locked) {
        moveByInputCached.call(this);
    }
};
Thank you for the clarification about the persistence of functions, it's not something I had considered. I still have a lot to learn about using javascript, and even more about how to use if for MV.

It looks like your solution works perfectly! The player can still interact with the event, neither saving and reloading nor closing the application and restarting frees the player to move again. Thank you for your help.

There are a few things I don't understand, what is the 'var moveByInputCached' doing exactly? I understand that it is checking the value of $gamePlayer._locked, but I don't understand just exactly what the code is doing after that...

Is the moveByInputCached variable considered an alias of the moveByInput function?

If moveByInputCached is an alias, does the 'this' keyword here point back to the Game_Character object or Game_Player?

I guess what I don't at all understand is what moveByInputCached.call(this); is doing...
I have messed up in the post above, for some reason I read $gamePlayer in your script as Game_Player.prototype ... Sorry.
Still the game won't save/restore your function changes through the save file system.

Is the moveByInputCached variable considered an alias of the moveByInput function?
Yes.

The "this" keyword in a function always refers to the object that you called the function on. (So if you called $gamePlayer.moveByInput() then "this" would refer to $gamePlayer throuout that function call. If you used new Game_Player().moveByInput() then "this" would refer to the new player object etc.)

If you assign a function to a prototype, then all objects created from that class get access to a personal version of the function (in this case $gamePlayer is usually the only Game_Player object).

Because "moveByInputCached" is not part of Game_Player's prototype, $gamePlayer.moveByInputCached() would not work. You could call moveByInputCached() on its own, but that would leave the "this" parameter within that function undefined. All
moveByInputCached.call(this) does is calling the function with a specified "this" parameter (here the same "this" as in the current function).


That said I'm not sure what the best way is to create an alias in Javascript.
Another option would be to use the prototype:
Code:
Game_Player.prototype.moveByInputCached = Game_Player.prototype.moveByInput;
Game_Player.prototype.moveByInput = function() {
    if (!this._locked) {
        this.moveByInputCached();
    }
}
But I have hardly ever seen someone using this style, so I'm not sure if I should recommend it in case there is a reason for that... 😀
If you assign a function to a prototype, then all objects created from that class get access to a personal version of the function (in this case $gamePlayer is usually the only Game_Player object).
Okay, that makes sense.


All
moveByInputCached.call(this) does is calling the function with a specified "this" parameter (here the same "this" as in the current function).
So line by line of the script call I found earlier:

Spoiler: Disable Move
JavaScript:
if($gamePlayer.moveByInputCached === undefined)
//This checks if the value is undefined


$gamePlayer.moveByInputCached = $gamePlayer.moveByInput;
//If it is undefined, it sets to the current value of $gamePlayer.moveByInput which is 'true'


$gamePlayer.moveByInput = function(){
return false;
}
// This sets moveByInput to false, stopping player movement

Then the other script call:
Spoiler: Enable move
JavaScript:
$gamePlayer.moveByInput = $gamePlayer.moveByInputCached;
//This resets the value of moveByInput to the cached value

Original thread: https://forums.rpgmakerweb.com/threads/how-do-you-permanently-disable-player-movement.133265/