Movement by input blocker

Discussion in 'JS Plugin Releases (RMMV)' started by Poryg, Jan 28, 2018.

  1. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,770
    Likes Received:
    9,426
    Location:
    Czech Republic
    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.
     
    #1
    Amarok, Guiguimu, Shaz and 1 other person like this.
  2. cji3bp62000

    cji3bp62000 Tsukimi Veteran

    Messages:
    66
    Likes Received:
    175
    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!
     
    #2
  3. Shaz

    Shaz Veteran Veteran

    Messages:
    37,302
    Likes Received:
    11,118
    Location:
    Australia
    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?
     
    #3
  4. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,770
    Likes Received:
    9,426
    Location:
    Czech Republic
    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.
     
    #4
  5. Shaz

    Shaz Veteran Veteran

    Messages:
    37,302
    Likes Received:
    11,118
    Location:
    Australia
    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.
     
    #5
  6. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,770
    Likes Received:
    9,426
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    It doesn't do pathfinding, it only sets the coordinates. Actual pathfinding is always done via $gamePlayer.findDirectionTo.
     
    #6
  7. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,770
    Likes Received:
    9,426
    Location:
    Czech Republic
    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.
     
    #7

Share This Page