RPG Maker MZ Tutorial: Simple Key Mapping Plugin & Conditional Branch Example Event
Here is a demo and tutorial of mapping a key using a script in a parallel event, the problem associated with that after reloading a Save file, highlighting a simple Key Mapping plugin that you can create or download from the link below, and a parallel event that will check keys that you designate but will also only allow one key to be active at a time. This is for something like letting the player press the "M" key to open a map, the "I" key to open an inventory, the "C" key to open a character sheet, etc.
Here is a link to where you can find the Javascript key codes for mapping keys. https://www.toptal.com/developers/keycode
Here is a link to the thread on the forum where you can find the plugin for download in one of my last posts: https://forums.rpgmakerweb.com/index.php?threads/questions-about-using-input-keymapper.174276/
In that same thread you can find the alternate option for doing the conditional branch checks using a function that is put into a plugin. I haven't experimented with that option yet. But special thanks to caethyril and bass2yang for all their help!
And here is the text of the plugin if the download doesn't work for you and you need to make your own plugin.
/*:
@target MZ
@plugindesc Add custom keyboard controls.
@author ZombieKidzRule (with help from caethyril)
@url https://forums.rpgmakerweb.com/threads/174276
@help Free to use and/or modify for any project, no credit required.
*/
Input.keyMapper[48] = "0";
Input.keyMapper[49] = "1";
Input.keyMapper[50] = "2";
Input.keyMapper[51] = "3";
Input.keyMapper[52] = "4";
Input.keyMapper[53] = "5";
Input.keyMapper[54] = "6";
Input.keyMapper[55] = "7";
Input.keyMapper[56] = "8";
Input.keyMapper[57] = "9";
Input.keyMapper[65] = "a";
Input.keyMapper[66] = "b";
Input.keyMapper[67] = "c";
Input.keyMapper[68] = "d";
Input.keyMapper[69] = "e";
Input.keyMapper[70] = "f";
Input.keyMapper[71] = "g";
Input.keyMapper[72] = "h";
Input.keyMapper[73] = "i";
Input.keyMapper[74] = "j";
Input.keyMapper[75] = "k";
Input.keyMapper[76] = "l";
Input.keyMapper[77] = "m";
Input.keyMapper[78] = "n";
Input.keyMapper[79] = "o";
Input.keyMapper[80] = "p";
Input.keyMapper[82] = "r";
Input.keyMapper[83] = "s";
Input.keyMapper[84] = "t";
Input.keyMapper[85] = "u";
Input.keyMapper[86] = "v";
Input.keyMapper[89] = "y";
Input.keyMapper[219] = "[";
Input.keyMapper[221] = "]";
I hope this helps people.
Please consider Liking, Subscribing, Getting Notifications, and Leaving Comments.
Thanks!
Other Videos By ZombieKidzRule!
Other Statistics
RPG Maker MZ Statistics For ZombieKidzRule!
ZombieKidzRule! currently has 11,262 views spread across 113 videos for RPG Maker MZ. Roughly a days worth of RPG Maker MZ videos were uploaded to his channel, roughly 30.34% of the content that ZombieKidzRule! has uploaded to YouTube.