Hello everyone, I need to change the controls of MZ, I mean, use the WASD instead of "Up arrow, Left arrow" etc. But I don´t want to buy a plugin or download it, I want to do it for code. Someone help me pls ;(
how do I change the controls in MZ?
RPG Maker MZ SupportNot sure I understand - are you saying you want to make your own plugin rather than download one? You should modify the original code as it will be overwritten if you update your game's js files when a new version of MZ is available.
As Shaz says, it's always a bad idea to directly modify the source code. You should do a quick Google and see how to make a plugin that modifies a function; the function you want to modify is Input.keyMapper, which you can copy from rmmz_core.js.
Note that a plugin, for RPG Maker MV/Z, is literally just another script file (.js) that loads after the core scripts (also .js).
The general format for remapping a keyboard input in RMMV/Z is:
...where:
Note that by default the W key (code 87) is mapped to "pagedown" (Q is "pageup").
The general format for remapping a keyboard input in RMMV/Z is:
JavaScript:
Input.keyMapper[keyCode] = "keyName";
keyCodeis a number (e.g. see https://keycode.info/), andkeyNameis a string used by the game to identify the input.
JavaScript:
Input.keyMapper[87] = "up";
Input.keyMapper[65] = "left";
Input.keyMapper[83] = "down";
Input.keyMapper[68] = "right";
- Copy + paste the code into a text editor (e.g. Notepad).
- File > Save As:
- File Type: All Files
- Filename: whatever.js
- Import that file via the editor: Tools > Plugin Manager.
- Save your project to apply Plugin Manager changes.
- Test!
Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-change-the-controls-in-mz.136305/