RMMV Script to assign a button to a common event

Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
678
Reaction score
590
First Language
English
Primarily Uses
RMMV
Is there a way to assign roles to other key buttons that aren't being used for the game? If so, how? I think it would be neat if I could assign a button not being used to call a Common Event.

Thanks for reading!
 

autodidact

Veteran
Veteran
Joined
Nov 13, 2020
Messages
56
Reaction score
38
First Language
English
Primarily Uses
RMMV
Hi,
I've been delving into RPG MV code and learning what it all does.
So, there may be some side effect I don't yet know about, but you can easily write your own script for this, although Yanflys is no doubt a million times better.
Just put the below in a file under the JS > Plugins folder and give it a ".js" extension.

Note, this is for keyboard, not gamepad buttons.
JavaScript:
(function($){
 
  //Use this site "https://keycode.info/" to find the keycode for the button you want.
  Input.keyMapper[55] = "7";
 
  var Alias_Scene_Map_updateMain = Scene_Map.prototype.updateMain;

  Scene_Map.prototype.updateMain = function() {
    Alias_Scene_Map_updateMain.call(this);
     if (Input.isTriggered('7')) { // where "7" has to appear exactly as it does when you write Input.keyMapper[55] = "7"
      $gameTemp.reserveCommonEvent(1); //where "1" is the Common Event ID
     }
  }
})()

If you don't want a plugin. Just try putting your desired key declaration "Input.keyMapper[55] = '7';" into a event script call and set a switch to true, and then have a common event running in parallel, which runs a check for the conditional script "Input.isTriggered('7')" while the switch is on, and then have the common event call a different common event that does what the button press is supposed to accomplish.

Hm, sounds complicated. Maybe someone else has something easier?
 
Last edited:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,344
Reaction score
15,158
First Language
English
Primarily Uses
RMMV

I've moved this thread to Plugin Requests. Thank you.

 

siguren

Veteran
Veteran
Joined
May 21, 2017
Messages
46
Reaction score
56
First Language
Japanese
Primarily Uses
RMMV
Mano_InputConfig has the ability to call common events from any button.
This plugin is free and versatile, with very few conflicts.
The above thread and plugin distribution URL is for MZ, but this plugin is designed to work with MV as well.
 

Latest Threads

Latest Profile Posts

I might not participate in the Boss Battle contest after all... I have more important things to do, like Wishful Wanda. And of course the Dark Deception spinoff I plan to pitch, Demon Slayer.
Changed my avatar, goodbye Alan Sugar, hello George Carlin (one of my favorite human beings ever)
If you still don't subscribe our Polish channel please consider it :)
1.png
Who wants to see my review of the worst star wars movie? This movie has all the excitement of being on Jury Duty of the most boring case ever about trade negotiations.
A lot to learn to make a game. Can I handle it?

Forum statistics

Threads
115,171
Messages
1,087,803
Members
149,721
Latest member
frankdontrithep61
Top