Preventing player from walking?

Hello. I want to make an event where the player sits on a chair and is only
able to turn at one place. the only solution i found is to transfer him to a copied map where the nearby tiles are blocked but
it messes up the other events. any way to do that in a one map?
Depending on the event you could always make it an autorun
instead of transfer just turn on a switch. this switch just activates surrounding invisible events that are set to same as character so he cant walk into them until the switch is turned off again
You can run these 2 scripts to disallow and re-enable movement, the player will be rendered inmobile (no input from mouse or arrows will be read) but you can still interact with events that pass by, access menu and other stuff.

To DISABLE movement:

Code:
if($gamePlayer.moveByInputCached === undefined)
    $gamePlayer.moveByInputCached = $gamePlayer.moveByInput;
$gamePlayer.moveByInput = function(){
    return false;
}

To RE-ENABLE movement:
Code:
$gamePlayer.moveByInput = $gamePlayer.moveByInputCached;


The above solution wont let you turn around, if you want the player to be able to turn you would need 4 invisible events (PAGE A: Blank) that with a switch or variable turn into PAGE B: Blank with priority SAME AS CHARACTER, that way you can be able to turn around but not move, turning off the switch or altering the variable would clear these 4 events and let you move freely again.
If you want the player to only be able to turn around, you can make the following Parallel Common Event tied to a Switch, then just turn on the corresponding switch when you want to disable any movement other than turning around:

Code:
If : Button [Down] is being pressed
Set Movement Route : Player (Skip)
  - Turn Down
  - Wait: 8 Frames
End
If : Button [Left] is being pressed
Set Movement Route : Player (Skip)
  - Turn Left
  - Wait: 8 Frames
End
If : Button [Right] is being pressed
Set Movement Route : Player (Skip)
  - Turn Right
  - Wait: 8 Frames
End
If : Button [Up] is being pressed
Set Movement Route : Player (Skip)
  - Turn Up
  - Wait: 8 Frames
End

You will need to turn off Mouse Movement though, as this only works with the keyboard input.
Thanks,i was having the same problem

Original thread: https://forums.rpgmakerweb.com/threads/preventing-player-from-walking.133157/