Disable Player Keyboard Movement

Discussion in 'RPG Maker MV' started by UNphiltered_khaos, Jan 29, 2019.

  1. UNphiltered_khaos

    UNphiltered_khaos Game Dev. Artist. Veteran

    Messages:
    1,730
    Likes Received:
    638
    Location:
    Montucky
    First Language:
    Americanese
    Primarily Uses:
    N/A
    As the title suggests, I am trying to discover a method to disable the use of a keyboard for player movement, while the mouse functions as normal. I thought there would be something like VX Ace where you can get in under the hood and just cut the lines to keyboard movement. Any help would be greatly appreciated! Thanks.
     
    Last edited: Jan 30, 2019
    #1
  2. Poryg

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

    Messages:
    3,779
    Likes Received:
    9,451
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    I have made a small plugin that blocks input movement based on a switch turned on. Check my signature for mv small plugins.
     
    #2
  3. UNphiltered_khaos

    UNphiltered_khaos Game Dev. Artist. Veteran

    Messages:
    1,730
    Likes Received:
    638
    Location:
    Montucky
    First Language:
    Americanese
    Primarily Uses:
    N/A
    Right on! I haven't tested it yet, just looking it over. I am curious though, will this allow the mouse input for movement? I want to disable the movement of the character via keyboard, but I want the mouse to still function as normal.
     
    #3
  4. Poryg

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

    Messages:
    3,779
    Likes Received:
    9,451
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    Uploaded a new file, InputBlockKM. This will allow you to choose between mouse and keyboard or both depending on which switches are active.
     
    #4
  5. Aesica

    Aesica undefined Veteran

    Messages:
    717
    Likes Received:
    671
    Location:
    SW5GMW 4xVHk
    First Language:
    English
    Primarily Uses:
    RMMV
    Is this meant to be a temporary thing (disable keyboard input while the player clicks some things) or permanent (no keyboard allowed ever)?

    If it's the latter, be careful. It's generally not a good idea to give your players fewer options for interacting with your game. A few months ago, I played an RMMV game where the controller input was broken (either intentionally disabled or broken due to a bug) and almost refunded the game on that alone.

    So yeah, just my 2 cents.
     
    #5
  6. UNphiltered_khaos

    UNphiltered_khaos Game Dev. Artist. Veteran

    Messages:
    1,730
    Likes Received:
    638
    Location:
    Montucky
    First Language:
    Americanese
    Primarily Uses:
    N/A
    So, to use this plugin, do I just use a switch event to turn on Switch 1 for disabling keyboard? I tried that and it didn't do anything. I tried switch 1 and 2 and both keyboard and mouse continue to function. Do I need to use a plugin command? Thanks!
     
    #6
  7. Poryg

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

    Messages:
    3,779
    Likes Received:
    9,451
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    You just need to turn on switch 1 to disable keyboard and switch 2 to disable mouse. Fro the looks there may be some plugins in your project that already use these two switches. If you turn them on, are they still on? (you can find out easily if you press f9 in game). If they're off, that means some other plugin is using these switches and you should choose different switches (this is why there are the two plugin parameters, to allow you to use different switches).
    There's also a second option, the plugin may be compatible with certain input modifying plugins if you have any.
     
    #7
  8. UNphiltered_khaos

    UNphiltered_khaos Game Dev. Artist. Veteran

    Messages:
    1,730
    Likes Received:
    638
    Location:
    Montucky
    First Language:
    Americanese
    Primarily Uses:
    N/A
    Maybe it's my MV... (or MV in general).
    It just does NOT work for me. I have 1 plugin, it's turned on, and the switch is on, and no matter what.... I can still walk around with the keyboard...ACK!
    And wait, MV supports controllers by default? gotta disable that, too... Lol.
     
    #8
  9. Poryg

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

    Messages:
    3,779
    Likes Received:
    9,451
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    My MV version is 1.6.1. Yours? And does it work on a fresh project with no plugins? Because it works on my end without issues, a fresh project with no plugins.
    If it works on a fresh project with no plugins, then there are two questions:
    1. What's the version of the game's mv engine? (header in rpg_core.js)
    2. What plugins do you use?
     
    Last edited: Feb 1, 2019
    #9
  10. UNphiltered_khaos

    UNphiltered_khaos Game Dev. Artist. Veteran

    Messages:
    1,730
    Likes Received:
    638
    Location:
    Montucky
    First Language:
    Americanese
    Primarily Uses:
    N/A
    my version is 1.6.1, I think Steam keeps it up to date for me.
    I am setting up a new project, and I am going to try it without doing ANYTHING to the game. In my original file I had 0 plugins running, but i was going to add TDDP Mouse Input, I think? It wasn't in the project, though, and my parallax maps were all sporked up as well.

    Tested with a brand new project: Nothing. I must be doing something wrong, because when I run my game, it does NOT disable the keyboard or the mouse. I tried with a default new project, then I tried after removing the 2 default plugins. NOTHING. It does not run on my system and I am getting really fed up with this garbage engine.

    Why can't Ace export to mobile and web?
     
    #10
  11. Poryg

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

    Messages:
    3,779
    Likes Received:
    9,451
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    I'll take a look once I get home. Because this is super weird.
     
    #11
  12. ozubon

    ozubon Villager Member

    Messages:
    21
    Likes Received:
    12
    First Language:
    English
    Primarily Uses:
    RMMV
    You can absolutely. Turn off automatic updates to begin with. Open up rpg_core.js, find Input.keyMapper and cut out the inputs you want disabled.
     
    #12
  13. UNphiltered_khaos

    UNphiltered_khaos Game Dev. Artist. Veteran

    Messages:
    1,730
    Likes Received:
    638
    Location:
    Montucky
    First Language:
    Americanese
    Primarily Uses:
    N/A
    Turn off automatic updates on Steam for MV? Or did I miss a step when I edited rpg_core.js?
    I tried removing just the directional keys from the keyboard and retain other functions of the keyboard. I don't need keyboard function, but some of the buttons could have been nice to work with. All the same, it didn't work and the keys still worked. So I deleted the whole line for each of the keys and it won't start. It says "this.clear is not a valid function" or something similar.

    Bleh.

    Thanks for your help, everybody. I do appreciate your trying.
     
    #13
  14. Poryg

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

    Messages:
    3,779
    Likes Received:
    9,451
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    I have uploaded a project on my google drive. I guarantee everything works properly on my computer.


    Just extract it, open it in RM and playtest it. If it still doesn't work, then that's gonna be super weird. But nothing I can do with it.
    Because I can guarantee it works all fine on my end.
    Btw. gamepad is handled the same as keyboard, so if keyboard is disabled, gamepad is also disabled.
     
    #14
  15. UNphiltered_khaos

    UNphiltered_khaos Game Dev. Artist. Veteran

    Messages:
    1,730
    Likes Received:
    638
    Location:
    Montucky
    First Language:
    Americanese
    Primarily Uses:
    N/A
    I will test this out, because I was genuinely getting angry at my potato for not functioning correctly. (God forbid I EVER acknlowledge user error...)

    Update: This project works FINE for me.
    And it bothers me... I was using Autorun events to turn on the switches, and while the debugger would show the switches on, the keyboard still functioned. If I set one of these events to autorun, it still works fine...

    "The User is never at fault." That's my new mantra, lol.
     
    Last edited: Feb 4, 2019
    #15
  16. Poryg

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

    Messages:
    3,779
    Likes Received:
    9,451
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    Hmm, can I get a buggy demo project from you? I can try to figure out where the problem lies.
     
    #16

Share This Page