Disable "Up" and "Left" Map Movement

mathmaster74

just...John
Veteran
Joined
Jun 12, 2016
Messages
285
Reaction score
192
First Language
English
Primarily Uses
RMMV
Pretty much just what the title says. I need a short script snippet that forces the player to be unable to use left arrow and up arrow to control main character movement for...well...the duration of the game! :hhappy:
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,547
Reaction score
1,024
First Language
EN
Primarily Uses
RMMV
Try saving this as a .js file and importing as a plugin~
Code:
(function() {

'use strict';

	const FORBID = [4, 8];	// forbidden player movement directions

	let alias = Game_Player.prototype.getInputDirection;
	Game_Player.prototype.getInputDirection = function() {
		let out = alias.call(this);
		if (FORBID.contains(out)) return 0;
		return out;
	};

})();
I.e. "get input direction; if it's forbidden then return 0 (no move); else return direction". RMMV uses numpad directions; 4 = left and 8 = up. :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

The video of a psycho chasing people on the streets with a sword before getting subdued is wild. Apparent screenshots of his Twitter feed before it went private reveal a dangerous delusional mindset. I heard there was a bow person too. The crazies are really coming out of the woodworks.
Stream will be live shortly with some Witcher 3, followed by a session of the Interactive Text Adventure! Feel free to drop by!
Managed to find a way to hang a bed cover over my window. So no more being toasted alive in the afternoon!:kaoswt2:
So, uh, has anyone tried buying any resources from KokoroReflections? Because I've been looking for a 'buy' button on the site for like 10 minutes now and can't find one.
Any also thought it's too cringy to put the word "and you" in your credit as a special thanks?
Cause that's what I thought...

Forum statistics

Threads
97,993
Messages
948,398
Members
129,254
Latest member
Swiftz
Top