Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,654
First Language
Czech
Primarily Uses
RMMV
Introduction
This plugin does what it says, blocks movement by input. No mouse movement, no arrow movement, no joypad movement... All it requires is a single switch.
Simply choose a switch through parameters and as long as it's off, the player can move. As long as it's on, the player can't move at all.

Download the plugin here
https://raw.githubusercontent.com/Poryg1/RPG-maker-MV-plugins/master/POR_InputBlock.js

License
This plugin is shared under MIT License. That means:
Free for commercial/non-commercial games
Free to edit
Free to share & repost, but not free to claim as your own work!

Credit would be nice, but is not required.
 

Tsukimi-neko

Tsukimi
Veteran
Joined
Oct 25, 2017
Messages
101
Reaction score
292
First Language
Japanese
Primarily Uses
RMMV
Great plugin!
When creating a small game(with clickable picture) by Parallel Process, I don't want player to move, and this is what I need!
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,908
Reaction score
14,546
First Language
English
Primarily Uses
RMMV
Based on what I saw when I played with this, I expect I wouldn't be able to use $gameTemp.setDestination(x,y) to do pathfinding while the input is blocked? I expect Scene_Map would clear the destination. Can you confirm?
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,654
First Language
Czech
Primarily Uses
RMMV
@Shaz $gameTemp.setDestination(x,y) is not the function that does pathfinding. Therefore it's completely redundant to call that one.

The function that does pathfinding is $gamePlayer.findDirectionTo (goalX, goalY).

You can of course use
Code:
$gameTemp.setDestination(x,y);
$gamePlayer.findDirectionTo ($gameTemp.destinationX(), $gameTemp.destinationY());
if you call these two inside one function, but it's completely useless. Instead it would be better to save these coordinates in a variable or something.
After all,
Code:
$gamePlayer.findDirectionTo ($gameVariables.value(1), $gameVariables.value(2));
might offer you much more flexibility and you can be sure that the $gameTemp will not clear that in next tick.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,908
Reaction score
14,546
First Language
English
Primarily Uses
RMMV
$gameTemp.setDestination(x,y) is what does pathfinding when you click with the mouse.

But yes, I already discovered findDirectionTo. My script is sorted now, with mouse/keyboard and menu access being blocked, but still being able to pathfind for the player.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,654
First Language
Czech
Primarily Uses
RMMV
It doesn't do pathfinding, it only sets the coordinates. Actual pathfinding is always done via $gamePlayer.findDirectionTo.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,654
First Language
Czech
Primarily Uses
RMMV
Just a small update:
I've uploaded a plugin that allows you to choose if you want to disable only the keyboard/gamepad movement, the mouse movement or both. It's called InputBlockerKM.
 

palatkorn

Veteran
Veteran
Joined
Nov 1, 2019
Messages
267
Reaction score
194
First Language
thai
Primarily Uses
RMMV
Hello can you help me
I am a beginner for js
I want to block the operation of two fingers on my phone. I still find a way to Will manage well
I found the link code, but I can't handle it properly. Can you recommend me?
Thanks for the reply

Code:
/**
* @static
* @method _onTouchStart
* @param {TouchEvent} event
* @private
*/
TouchInput._onTouchStart = function(event) {
    for (var i = 0; i < event.changedTouches.length; i++) {
        var touch = event.changedTouches[i];
        var x = Graphics.pageToCanvasX(touch.pageX);
        var y = Graphics.pageToCanvasY(touch.pageY);
        if (Graphics.isInsideCanvas(x, y)) {
            this._screenPressed = true;
            this._pressedTime = 0;
            if (event.touches.length >= 1) {
                this.___onCancel(x, y);
            } else {
                this._onTrigger(x, y);
            }
            event.preventDefault();
        }
    }
    if (window.cordova || window.navigator.standalone) {
        event.preventDefault();
    }
};
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,654
First Language
Czech
Primarily Uses
RMMV
This would be what you're searching for inside of that function.
Code:
if (event.touches.length >= 1) {
                this.___onCancel(x, y);
            }
If you want to deactivate it via switch, it's easy.
Code:
if (event.touches.length >= 1 && !$gameSwitches.value(1)) {
                this.___onCancel(x, y);
            }
 

Latest Threads

Latest Profile Posts

Voting for the second round of the Map Madness Tournament is now live! Vote for your favorite in each matchup! https://forums.rpgmakerweb.com/index.php?forums/map-madness-2021-polls.187/
Just bought the Visustella All Waves bundle... Time to go IN!!
Oh, I was just confirmed I'll be doing small online classes during june - july, on one side I'm nervous and looking forward it, on the other one: I've became the very thing I swore to destroy. :kaodes:
Work starts today at 2pm. I hate jeans, but the dress code says I have to wear them... That's how I discovered I was a plus size. Shopping for my first pair of jeans.
Anyhow, I'll post a new video on TheDazzlingsAreBack as soon as I'm able to.
dEj6ha4.png

WIP :)
Added some cliffs / walls / roofs to the tilesheet and am currently working on roof objects to make them prettier and more variable. And of course, windows and doors that fit to the game's style.
I also adjusted the grass color but i have some issues with my display, so if it looks weird, please let me know :)

Forum statistics

Threads
110,573
Messages
1,054,308
Members
143,685
Latest member
Yatsuzuka_Kou
Top