RMMZ Is there a way to remove the existing Input.keyMapper?

Muso

Regular
Regular
Joined
Aug 27, 2022
Messages
34
Reaction score
14
First Language
Korean
Primarily Uses
RMMZ
I'm making a key setting system.
Detects the player's key input and set the code of the input key with a variable.
Input.keyMapper[$gameVariables.value] = 'up';
1.png
It works very well. But there's a problem.
Let me give you an example.

If I set [w] to 'up' and set [↑] to 'up', [↑] is not replaced by 'up' key.
[w], [↑] both become 'up' keys.

Is there a way to remove the existing Input.keyMapper?
 

TheAM-Dol

Randomly Generated User Name
Regular
Joined
Feb 26, 2022
Messages
947
Reaction score
1,646
First Language
English
Primarily Uses
RMMV
You pulled technically modify the RPG_core to alter (or remove) controls...
I am wondering why you don't use something like a keyboard config plugin and a button common event plugin :LZSskeptic:
 

Muso

Regular
Regular
Joined
Aug 27, 2022
Messages
34
Reaction score
14
First Language
Korean
Primarily Uses
RMMZ
You pulled technically modify the RPG_core to alter (or remove) controls...
I am wondering why you don't use something like a keyboard config plugin and a button common event plugin :LZSskeptic:
I already know that the keyMapper part of rmmz_core.js needs to be modified.
What I want is that every time I using a script call(Input.keyMapper[keycode] = 'name'), the keysetting is overwritten.

I am wondering why you don't use something like a keyboard config plugin and a button common event plugin :LZSskeptic: : Because I don't like UI of the keyboard config plugin. And I thought I could make it with event with a little effort.
 
Last edited:

Mac15001900

JavaScript wild sorcerer
Regular
Joined
Aug 7, 2022
Messages
264
Reaction score
336
First Language
English
Primarily Uses
RMMV
So, you'd like to clear all existing keybindings from keymapper? That's fairly simple, a for loop to iterate over existing fields would be enough.
JavaScript:
for (let field in Input.keyMapper) {
    if (!isNaN(field)) Input.keyMapper[field] = undefined;
}
The if statement is not strictly needed in vanilla, but should help if any plugins add their own fields to the keyMapper.

In case you'd just want to clear a single field, e.g. 'ok':
JavaScript:
for (let field in Input.keyMapper) {
    if (Input.keyMapper[field] === 'ok') Input.keyMapper[field] = undefined;
}
 

Muso

Regular
Regular
Joined
Aug 27, 2022
Messages
34
Reaction score
14
First Language
Korean
Primarily Uses
RMMZ
So, you'd like to clear all existing keybindings from keymapper? That's fairly simple, a for loop to iterate over existing fields would be enough.
JavaScript:
for (let field in Input.keyMapper) {
    if (!isNaN(field)) Input.keyMapper[field] = undefined;
}
The if statement is not strictly needed in vanilla, but should help if any plugins add their own fields to the keyMapper.

In case you'd just want to clear a single field, e.g. 'ok':
JavaScript:
for (let field in Input.keyMapper) {
    if (Input.keyMapper[field] === 'ok') Input.keyMapper[field] = undefined;
}
It works very well. Thank you!
 

Latest Threads

Latest Profile Posts

Just completed another cutscene. Huge one for the story. I'm so enthusiastic about where this game is going.
Man, the enemies in the new Sonic Frontiers update are totally roided up. I wanted a little more difficulty myself, but Sonic Team turned the dial a bit too far.

At least the new tracks for roaming Ouranos Island as Amy, Knuckles, and Tails slap hard.
mz_quest_victory_scene.gif


This battle victory screen has been pretty fun to work on. Not only can party members set new personal records for their contributions to the fight, but when they do, the party remarks on the accomplishment!
When you love all your children equally, but the world sees it differently.
popular.png
Found an old, unfinished project of mine, where you fight movie screenplays as an up-and-coming actress.
Turns out I used VX way back when. I may need to remake this in MZ, the premise was kinda hilarious.
1696205441250.png
1696205637522.png

Forum statistics

Threads
134,981
Messages
1,252,589
Members
177,872
Latest member
Ghosteez
Top