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
55
Reaction score
37
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,326
Reaction score
15,155
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 Posts

Latest Profile Posts

Happy Friday, y'all! I just got home from work and am sitting down with a nice cider, and I'm ready to chill and enjoy myself. Not sure if I'm gonna dive into any of my game-related projects or not tonight.... we'll see how I feel after unwinding for a bit I guess!
Just found out that mint tea made from chocolate mint tastes a bit like hot cocoa with candy cane stirred in. As I'm allergic to chocolate this makes me very happy.
It's special day for me tomorrow so time to vanish for 24 hours lol.
So Deltarune Chapter 2 is supposed to release today... if it's out already, has anyone played it? And I can't because I have a stinking Mac and not a Windows PC.

Forum statistics

Threads
115,140
Messages
1,087,554
Members
149,650
Latest member
devdezzy
Top