Temporarily Disable WASD/Arrow Movement

Pretty much, how would it be possible? I've been testing using a handful of plugins but they all disable mouse input too.. And I just need mouse input but not keyboard input during specifics parts.
Assuming that you only want to disable keyboard/gamepad movement, but you still want to allow the player to use the keyboard/gamepad for UI input, then this should work:
JavaScript:
/*:
* @plugindesc Disable keyboard movement
* @author Arthran
*
* @help
*
* ------------------------------------------------------------------------
* Information
* ------------------------------------------------------------------------
* This plugin disables keyboard movement for the player, allowing only
* touch input to move, when a specified switch is ON.
*
* ------------------------------------------------------------------------
* Terms of Use
* ------------------------------------------------------------------------
* Free for use in commercial and non-commercial projects.
* Edits and redistribution are allowed.
* Credit is not required.
*/

(() => {
    const switchId = 8; // Change this to the ID of the switch you want to use

    const _Game_Player_getInputDirection = Game_Player.prototype.getInputDirection;
    Game_Player.prototype.getInputDirection = function() {
        if ($gameSwitches.value(switchId)) {
            return 0;
        } else {
            return _Game_Player_getInputDirection.call(this);
        }
    };
})();

Just make sure to edit the switchId from 8 to whatever switch you want to use, and don't include leading 0s.
Assuming that you only want to disable keyboard/gamepad movement, but you still want to allow the player to use the keyboard/gamepad for UI input, then this should work:
JavaScript:
/*:
* @plugindesc Disable keyboard movement
* @author Arthran
*
* @help
*
* ------------------------------------------------------------------------
* Information
* ------------------------------------------------------------------------
* This plugin disables keyboard movement for the player, allowing only
* touch input to move, when a specified switch is ON.
*
* ------------------------------------------------------------------------
* Terms of Use
* ------------------------------------------------------------------------
* Free for use in commercial and non-commercial projects.
* Edits and redistribution are allowed.
* Credit is not required.
*/

(() => {
    const switchId = 8; // Change this to the ID of the switch you want to use

    const _Game_Player_getInputDirection = Game_Player.prototype.getInputDirection;
    Game_Player.prototype.getInputDirection = function() {
        if ($gameSwitches.value(switchId)) {
            return 0;
        } else {
            return _Game_Player_getInputDirection.call(this);
        }
    };
})();

Just make sure to edit the switchId from 8 to whatever switch you want to use, and don't include leading 0s.
thank you so much!! this works perfectly!!

Original thread: https://forums.rpgmakerweb.com/threads/temporarily-disable-wasd-arrow-movement.169533/