Status
Not open for further replies.

XGuarden

Veteran
Veteran
Joined
May 10, 2016
Messages
448
Reaction score
17
First Language
French
Primarily Uses
I look for a way to block player movement.
I just want to have control when he can move or not in mycinematic.
For be able at start of cinematic to disable his movement and enable them back at the end.

Please not, these event cannot be run in autorun for various reason.
I really need a way to block and unblock player in a line of code.


Thanks.
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
875
Reaction score
599
First Language
English
Primarily Uses
RMMV
Call these by event script. EDIT #2: forgot to add number pad keys too, not just arrow keys
JavaScript:
// disable move by 4 directions
var pe = {37:false,38:false,39:false,40:false,98:false,100:false,102:false,104:false};
for(i in pe) Input.keyMapper[i] = pe[i];
and re-enable with this
JavaScript:
// enable move by 4 directions
var pe = {37:"left",38:"up",39:"right",40:"down",98:'down',100:'left',102:'right',104:'up'};
for(i in pe) Input.keyMapper[i] = pe[i];

interestingly enough, you can get creative with this script to reverse the direction for some kind of funky magic spell, and use the same enable function to go back
JavaScript:
// reverse by 4 directions (this is cruelty)
var pe = {37:"right",38:"down",39:"left",40:"up",98: 'up',100:'right',102:'left',104:'down'};
for(i in pe) Input.keyMapper[i] = pe[i];
 
Last edited:

XGuarden

Veteran
Veteran
Joined
May 10, 2016
Messages
448
Reaction score
17
First Language
French
Primarily Uses
Call these by event script. EDIT #2: forgot to add number pad keys too, not just arrow keys
JavaScript:
// disable move by 4 directions
var pe = {37:false,38:false,39:false,40:false,98:false,100:false,102:false,104:false};
for(i in pe) Input.keyMapper[i] = pe[i];
and re-enable with this
JavaScript:
// enable move by 4 directions
var pe = {37:"left",38:"up",39:"right",40:"down",98:'down',100:'left',102:'right',104:'up'};
for(i in pe) Input.keyMapper[i] = pe[i];

interestingly enough, you can get creative with this script to reverse the direction for some kind of funky magic spell, and use the same enable function to go back
JavaScript:
// reverse by 4 directions (this is cruelty)
var pe = {37:"right",38:"down",39:"left",40:"up",98: 'up',100:'right',102:'left',104:'down'};
for(i in pe) Input.keyMapper[i] = pe[i];
If I understand, you actually blocking keyboard button. But what if player use mouse or hud with arrow?
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
875
Reaction score
599
First Language
English
Primarily Uses
RMMV
Doh! I didn't think of that.

Try these to disable click move.
// disable move by click
if(Game_Character.prototype.findDirectionToCached === undefined)
Game_Character.prototype.findDirectionToCached = Game_Character.prototype.findDirectionTo;
Game_Character.prototype.findDirectionTo = function(){
return false;
}

and to re-enable
// enable move by click
Game_Character.prototype.findDirectionTo = Game_Character.prototype.findDirectionToCached;


EDIT: RPG Maker MV has HID support too? Hold on a second. I'm dumb.
 
Last edited:

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
875
Reaction score
599
First Language
English
Primarily Uses
RMMV
Ignore those other two ideas. This will cancel all three possible inputs' movement at once.
PHP:
// disable move by all input
if($gamePlayer.moveByInputCached === undefined)
    $gamePlayer.moveByInputCached = $gamePlayer.moveByInput;
$gamePlayer.moveByInput = function(){
    return false;
}
and to enable
PHP:
// enable move by all input
$gamePlayer.moveByInput = $gamePlayer.moveByInputCached;
 
Last edited:

XGuarden

Veteran
Veteran
Joined
May 10, 2016
Messages
448
Reaction score
17
First Language
French
Primarily Uses
Ignore those other two ideas. This will cancel all three possible inputs' movement at once.
PHP:
// disable move by all input
if($gamePlayer.moveByInputCached === undefined)
    $gamePlayer.moveByInputCached = $gamePlayer.moveByInput;
$gamePlayer.moveByInput = function(){
    return false;
}
and to enable
PHP:
// enable move by all input
$gamePlayer.moveByInput = $gamePlayer.moveByInputCached;
Thanks, that perfect. Any way to mark you for best answer? I did't find the button with the new forum updat.
By the way, if I disable in some part of the game the mouse move, if I put a cute scene with these setting, that will reanable it?
 

doranikofu

Veteran
Veteran
Joined
Oct 4, 2015
Messages
113
Reaction score
32
First Language
Chinese
Primarily Uses
have you looked at YEP_stopmapmovement plugin?
 

XGuarden

Veteran
Veteran
Joined
May 10, 2016
Messages
448
Reaction score
17
First Language
French
Primarily Uses
have you looked at YEP_stopmapmovement plugin?
In the past yes, but I did't remember why I did't use it. I think it's something with compatibility issue with other plugging.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,307
Reaction score
8,750
First Language
German
Primarily Uses
RMMV
[closed]IgnoreMe[/closed]
 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

So here we go again with my programming. Currently I don't know what to program, so I am just doing things to see what I can make. Currently just photoshop though :/ Join in if you wish to see the stream. Very exclusive, mostly just 1-2 people watching.
I'm feeling rough today, a bit too many last night I'd say. Still have no choice to work on Corpse Mansion. That and I got. bunch of sales last night. I was like wtf this morning? Next payout is gonna be nice at least.
I'm just so close to replacing LUK with a different stat, maybe DEX but we'll see.
Slapped together a title screen and working on some dungeon clutter + portraits for Dubhghaill and Einar. Usual CW for minor body horror wrt Einar
QVLJIgD.png

OaPcYUy.png

r55FiUJ.png

EIgO94y.png
cT1V4nb.png

Forum statistics

Threads
117,151
Messages
1,104,991
Members
153,232
Latest member
duy140502
Top