Crouching

Please help, how can i make crouching mechanic (character slows down when shift is pressed) in MV?
(character slows down when shift is pressed) in MV?
the opposite is already a feature. normally when shift is held down the player character starts dashing and moves faster. if always dash is enabled in the game's settings, then holding shift slows the player down to walking speed, and clicking always dashes regardless.

are you looking to make dashing make the player move slower and rename it to crouching?
JavaScript:
        if (Input.isPressed('shift')) {
            this.setMoveSpeed(3);
        } else {
            this.setMoveSpeed(4);
        }

Or something similar, should do the job.

You could use this as plugin, simply hook into the player update function :

JavaScript:
(function() {
    const _Game_Player_update = Game_Player.prototype.update;

    Game_Player.prototype.update = function(sceneActive) {
        _Game_Player_update.call(this, sceneActive);

        if (Input.isPressed('shift')) {
            this.setMoveSpeed(3);
        } else {
            this.setMoveSpeed(4);
        }
    };
})();


Or you can use a parrallel event (supposedly in a common event) and place this script :

JavaScript:
if (Input.isPressed('shift')) {
    $gamePlayer.setMoveSpeed(3);
} else {
    $gamePlayer.setMoveSpeed(4);
}

Make sure the comon event is triggered and running, or it won't work.


As @Robro33 said though, shift is supposed to be a dash button, so this could cause conflict (haven't tried)
Thank you so much! that worked perfectly.

Original thread: https://forums.rpgmakerweb.com/threads/crouching.174072/