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
604
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
604
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
604
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
36,738
Reaction score
9,886
First Language
German
Primarily Uses
RMMV
[closed]IgnoreMe[/closed]
 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

I remade/fixed my Elf XP Mack Templates. The Ears are looking better now.
Male Update.pngFemale Update.png
You can check them out, they are in 12 recolours, both Human and Elf Versions!
I'M BACK BABEY!!!
College is hitting me a lil' softer than I expected, so I'm back on MV!
And to kick things off, here's a lil' test of a tileset edit I made today! (Took me, like, 5 hours, considering this was the first time I've EVER used GraphicsGale...)Edit test SUCCESS.PNG

Forum statistics

Threads
124,603
Messages
1,164,685
Members
163,425
Latest member
monmamamon
Top