Yanfly's Button Common Events: Binding to a gamepad?

Hi there. I'm currently having issues trying to get a common event to activate with a gamepad.
I have a common event where upon pressing a button the current party leader will change. I'm trying to get that to work by pressing the left shoulder button, so I've tried to bind the event to Page Up but nothing seems to work.
Is there any way to do this? I've tried Yanfly's Gamepad Config but that doesn't seem to work either/
I was searching for this as well, but couldn't find a fix so I just edited Yanfly's plugin to include the gamepad. This is an old thread so it might not be relevant to OP anymore, but I decided to reply anyway for people who might find this thread in the future looking for a solution. I would share the script but since Yanfly changed his revenue model (scripts are not free anymore) I don't think I can. So I can describe what I've done.

I only needed movement, plus buttons A and B but you can add all the rest.

First, I added the parameters to the plugin:
Code:
* @param ---Gamepad---
* @default
*
* @param Gamepad A
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0
*
* @param Gamepad B
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0
*
* @param Gamepad Up
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0
*
* @param Gamepad Down
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0
*
* @param Gamepad Left
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0
*
* @param Gamepad Right
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0

Then I added them to the BCE list:
Code:
Yanfly.Param.BCEList = {
      //GAMEPAD
      gamepad_a: Number(Yanfly.Parameters['Gamepad A']),
      gamepad_b: Number(Yanfly.Parameters['Gamepad B']),
      gamepad_up: Number(Yanfly.Parameters['Gamepad Up']),
      gamepad_down: Number(Yanfly.Parameters['Gamepad Down']),
      gamepad_left: Number(Yanfly.Parameters['Gamepad Left']),
      gamepad_right: Number(Yanfly.Parameters['Gamepad Right']),
      // list continues...

Then to the mapper section:
Code:
//=============================================================================
// Input Key Mapper
//=============================================================================

if (Yanfly.Param.BCEList['gamepad_a'] !== 0) Input.gamepadMapper[0] = 'gamepad_a';
if (Yanfly.Param.BCEList['gamepad_b'] !== 0) Input.gamepadMapper[1] = 'gamepad_b';
if (Yanfly.Param.BCEList['gamepad_up'] !== 0) Input.gamepadMapper[12] = 'gamepad_up';
if (Yanfly.Param.BCEList['gamepad_down'] !== 0) Input.gamepadMapper[13] = 'gamepad_down';
if (Yanfly.Param.BCEList['gamepad_left'] !== 0) Input.gamepadMapper[14] = 'gamepad_left';
if (Yanfly.Param.BCEList['gamepad_right'] !== 0) Input.gamepadMapper[15] = 'gamepad_right';

Now for the switching and reverting. This will be a bit more work, but for me, I just use 'Switch All' and 'Revert All' so I skipped checks for specific switching.
Code:
Input._revertButton = function(button) {
    ...
    ...
    } else if (button === 'ALL') {
        this.gamepadMapper[0] = 'ok';
        this.gamepadMapper[1] = 'cancel';
        this.gamepadMapper[12] = 'up';
        this.gamepadMapper[13] = 'down';
        this.gamepadMapper[14] = 'left';
        this.gamepadMapper[15] = 'right';
        ...
        ...
}

Input._switchButton = function(button) {
    ...
    ...
    } else if (button === 'ALL') {
          } else if (button === 'ALL') {
            if (Yanfly.Param.BCEList['gamepad_a'] !== 0) this.gamepadMapper[0] = 'gamepad_a';
            if (Yanfly.Param.BCEList['gamepad_b'] !== 0) this.gamepadMapper[1] = 'gamepad_b';
            if (Yanfly.Param.BCEList['gamepad_up'] !== 0) this.gamepadMapper[12] = 'gamepad_up';
            if (Yanfly.Param.BCEList['gamepad_down'] !== 0) this.gamepadMapper[13] = 'gamepad_down';
            if (Yanfly.Param.BCEList['gamepad_left'] !== 0) this.gamepadMapper[14] = 'gamepad_left';
            if (Yanfly.Param.BCEList['gamepad_right'] !== 0) this.gamepadMapper[15] = 'gamepad_right';



And here we go. It works great (I'm on MV version 1.5.2).
1602842013644.png
I was searching for this as well, but couldn't find a fix so I just edited Yanfly's plugin to include the gamepad. This is an old thread so it might not be relevant to OP anymore, but I decided to reply anyway for people who might find this thread in the future looking for a solution. I would share the script but since Yanfly changed his revenue model (scripts are not free anymore) I don't think I can. So I can describe what I've done.

I only needed movement, plus buttons A and B but you can add all the rest.

First, I added the parameters to the plugin:
Code:
* @param ---Gamepad---
* @default
*
* @param Gamepad A
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0
*
* @param Gamepad B
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0
*
* @param Gamepad Up
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0
*
* @param Gamepad Down
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0
*
* @param Gamepad Left
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0
*
* @param Gamepad Right
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0

Then I added them to the BCE list:
Code:
Yanfly.Param.BCEList = {
      //GAMEPAD
      gamepad_a: Number(Yanfly.Parameters['Gamepad A']),
      gamepad_b: Number(Yanfly.Parameters['Gamepad B']),
      gamepad_up: Number(Yanfly.Parameters['Gamepad Up']),
      gamepad_down: Number(Yanfly.Parameters['Gamepad Down']),
      gamepad_left: Number(Yanfly.Parameters['Gamepad Left']),
      gamepad_right: Number(Yanfly.Parameters['Gamepad Right']),
      // list continues...

Then to the mapper section:
Code:
//=============================================================================
// Input Key Mapper
//=============================================================================

if (Yanfly.Param.BCEList['gamepad_a'] !== 0) Input.gamepadMapper[0] = 'gamepad_a';
if (Yanfly.Param.BCEList['gamepad_b'] !== 0) Input.gamepadMapper[1] = 'gamepad_b';
if (Yanfly.Param.BCEList['gamepad_up'] !== 0) Input.gamepadMapper[12] = 'gamepad_up';
if (Yanfly.Param.BCEList['gamepad_down'] !== 0) Input.gamepadMapper[13] = 'gamepad_down';
if (Yanfly.Param.BCEList['gamepad_left'] !== 0) Input.gamepadMapper[14] = 'gamepad_left';
if (Yanfly.Param.BCEList['gamepad_right'] !== 0) Input.gamepadMapper[15] = 'gamepad_right';

Now for the switching and reverting. This will be a bit more work, but for me, I just use 'Switch All' and 'Revert All' so I skipped checks for specific switching.
Code:
Input._revertButton = function(button) {
    ...
    ...
    } else if (button === 'ALL') {
        this.gamepadMapper[0] = 'ok';
        this.gamepadMapper[1] = 'cancel';
        this.gamepadMapper[12] = 'up';
        this.gamepadMapper[13] = 'down';
        this.gamepadMapper[14] = 'left';
        this.gamepadMapper[15] = 'right';
        ...
        ...
}

Input._switchButton = function(button) {
    ...
    ...
    } else if (button === 'ALL') {
          } else if (button === 'ALL') {
            if (Yanfly.Param.BCEList['gamepad_a'] !== 0) this.gamepadMapper[0] = 'gamepad_a';
            if (Yanfly.Param.BCEList['gamepad_b'] !== 0) this.gamepadMapper[1] = 'gamepad_b';
            if (Yanfly.Param.BCEList['gamepad_up'] !== 0) this.gamepadMapper[12] = 'gamepad_up';
            if (Yanfly.Param.BCEList['gamepad_down'] !== 0) this.gamepadMapper[13] = 'gamepad_down';
            if (Yanfly.Param.BCEList['gamepad_left'] !== 0) this.gamepadMapper[14] = 'gamepad_left';
            if (Yanfly.Param.BCEList['gamepad_right'] !== 0) this.gamepadMapper[15] = 'gamepad_right';



And here we go. It works great (I'm on MV version 1.5.2).
View attachment 164025
OMG You saved me!! I'll never thank you much enough! Now I can finally make my action game!!
I was searching for this as well, but couldn't find a fix so I just edited Yanfly's plugin to include the gamepad. This is an old thread so it might not be relevant to OP anymore, but I decided to reply anyway for people who might find this thread in the future looking for a solution. I would share the script but since Yanfly changed his revenue model (scripts are not free anymore) I don't think I can. So I can describe what I've done.

I only needed movement, plus buttons A and B but you can add all the rest.

First, I added the parameters to the plugin:
Code:
* @param ---Gamepad---
* @default
*
* @param Gamepad A
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0
*
* @param Gamepad B
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0
*
* @param Gamepad Up
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0
*
* @param Gamepad Down
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0
*
* @param Gamepad Left
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0
*
* @param Gamepad Right
* @parent ---Gamepad---
* @type common_event
* @desc The common event to call when this button is pressed.
* Set to 0 if you don't wish for a common event to call.
* @default 0

Then I added them to the BCE list:
Code:
Yanfly.Param.BCEList = {
      //GAMEPAD
      gamepad_a: Number(Yanfly.Parameters['Gamepad A']),
      gamepad_b: Number(Yanfly.Parameters['Gamepad B']),
      gamepad_up: Number(Yanfly.Parameters['Gamepad Up']),
      gamepad_down: Number(Yanfly.Parameters['Gamepad Down']),
      gamepad_left: Number(Yanfly.Parameters['Gamepad Left']),
      gamepad_right: Number(Yanfly.Parameters['Gamepad Right']),
      // list continues...

Then to the mapper section:
Code:
//=============================================================================
// Input Key Mapper
//=============================================================================

if (Yanfly.Param.BCEList['gamepad_a'] !== 0) Input.gamepadMapper[0] = 'gamepad_a';
if (Yanfly.Param.BCEList['gamepad_b'] !== 0) Input.gamepadMapper[1] = 'gamepad_b';
if (Yanfly.Param.BCEList['gamepad_up'] !== 0) Input.gamepadMapper[12] = 'gamepad_up';
if (Yanfly.Param.BCEList['gamepad_down'] !== 0) Input.gamepadMapper[13] = 'gamepad_down';
if (Yanfly.Param.BCEList['gamepad_left'] !== 0) Input.gamepadMapper[14] = 'gamepad_left';
if (Yanfly.Param.BCEList['gamepad_right'] !== 0) Input.gamepadMapper[15] = 'gamepad_right';

Now for the switching and reverting. This will be a bit more work, but for me, I just use 'Switch All' and 'Revert All' so I skipped checks for specific switching.
Code:
Input._revertButton = function(button) {
    ...
    ...
    } else if (button === 'ALL') {
        this.gamepadMapper[0] = 'ok';
        this.gamepadMapper[1] = 'cancel';
        this.gamepadMapper[12] = 'up';
        this.gamepadMapper[13] = 'down';
        this.gamepadMapper[14] = 'left';
        this.gamepadMapper[15] = 'right';
        ...
        ...
}

Input._switchButton = function(button) {
    ...
    ...
    } else if (button === 'ALL') {
          } else if (button === 'ALL') {
            if (Yanfly.Param.BCEList['gamepad_a'] !== 0) this.gamepadMapper[0] = 'gamepad_a';
            if (Yanfly.Param.BCEList['gamepad_b'] !== 0) this.gamepadMapper[1] = 'gamepad_b';
            if (Yanfly.Param.BCEList['gamepad_up'] !== 0) this.gamepadMapper[12] = 'gamepad_up';
            if (Yanfly.Param.BCEList['gamepad_down'] !== 0) this.gamepadMapper[13] = 'gamepad_down';
            if (Yanfly.Param.BCEList['gamepad_left'] !== 0) this.gamepadMapper[14] = 'gamepad_left';
            if (Yanfly.Param.BCEList['gamepad_right'] !== 0) this.gamepadMapper[15] = 'gamepad_right';



And here we go. It works great (I'm on MV version 1.5.2).
View attachment 164025
Where do I put these in the plugin? I'm confused

Original thread: https://forums.rpgmakerweb.com/threads/yanflys-button-common-events-binding-to-a-gamepad.116991/