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
606
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
606
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
606
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
33
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
37,609
Reaction score
10,333
First Language
German
Primarily Uses
RMMV
[closed]IgnoreMe[/closed]
 
Status
Not open for further replies.

Latest Profile Posts

Proud on how this map turned out.

FnmhDLIXgAAOvIC
I just finally fixed a huge problem that wouldn’t let my game load and would crash it.. I thought that I was gonna have to trash the project and start over lol
The feeling when you finally found and killed that one gamebreaker that you could not really grasp before.:kaojoy:
Precious vet moments. Funny how smart animals are. They can tell what is happening especially a trip to the vet.

Rhythm game Super Hexagon. This looks hard as heck.

Forum statistics

Threads
128,322
Messages
1,193,597
Members
168,798
Latest member
Dreafun_LittleAndroidAA72
Top