Is there a way to change what different keys do when pressed? (Eg, change menu key from X to something else) thanks
Changing what different keys do when pressed
RPG Maker MZ SupportYes there is, and it's pretty simple to do, but it requires coding your own plugin to do it. And when I say "plugin", I mean to change the menu key to "Y" it is literally one line of code.
Alternatively, there's a few plugins out there that do the coding work for you. I never found any that worked well enough for my purposes so I just wrote my own plugin, but you may find what you need out there.
You can find the code that sets up the keyboard and gamepad controls starting on line 5627 of rmmz_core.js.
You can go here to find out the keycodes for whatever keys you want: https://www.toptal.com/developers/keycode
Alternatively, there's a few plugins out there that do the coding work for you. I never found any that worked well enough for my purposes so I just wrote my own plugin, but you may find what you need out there.
You can find the code that sets up the keyboard and gamepad controls starting on line 5627 of rmmz_core.js.
You can go here to find out the keycodes for whatever keys you want: https://www.toptal.com/developers/keycode
Here is an example of how you could change the menu button from 'X' to 'B':
To make the changes permanent, you would paste that code into a new .js file, put it in your plugins folder, and add it to your project through the plugin manager. The numbers 88 and 66 are keycodes. For reference, here is a list of all the default keybinds, and the commands that they bind to.
JavaScript:
// Unbind the X key
delete Input.keyMapper[88];
// Bind escape to the B key
Input.keyMapper[66] = 'escape';
To make the changes permanent, you would paste that code into a new .js file, put it in your plugins folder, and add it to your project through the plugin manager. The numbers 88 and 66 are keycodes. For reference, here is a list of all the default keybinds, and the commands that they bind to.
Code:
Input.keyMapper = {
9: "tab", // tab
13: "ok", // enter
16: "shift", // shift
17: "control", // control
18: "control", // alt
27: "escape", // escape
32: "ok", // space
33: "pageup", // pageup
34: "pagedown", // pagedown
37: "left", // left arrow
38: "up", // up arrow
39: "right", // right arrow
40: "down", // down arrow
45: "escape", // insert
81: "pageup", // Q
87: "pagedown", // W
88: "escape", // X
90: "ok", // Z
96: "escape", // numpad 0
98: "down", // numpad 2
100: "left", // numpad 4
102: "right", // numpad 6
104: "up", // numpad 8
120: "debug" // F9
};
Original thread: https://forums.rpgmakerweb.com/threads/changing-what-different-keys-do-when-pressed.163056/