OK, I got it to work. As I suspected, Yanfly's ButtonCommonEvents was the culprit. The plugin assigns the buttons in several different places under different conditions.
If anyone is using Yanfly's plugin, this is what you need to do:
1. Comment out the unwanted keys in rpg_core.js.
JavaScript:
Input.keyMapper = {
9: 'tab', // tab
13: 'ok', // enter
16: 'shift', // shift
17: 'control', // control
18: 'control', // alt
27: 'escape', // escape
32: 'ok', // space
33: 'pageup', // pageup
34: 'pagedown', // pagedown
37: 'left', // left arrow
38: 'up', // up arrow
39: 'right', // right arrow
40: 'down', // down arrow
45: 'escape', // insert
81: 'pageup', // Q
87: 'pagedown', // W
// 88: 'escape', // X // <--------------- HERE
// 90: 'ok', // Z // <--------------- HERE
96: 'escape', // numpad 0
98: 'down', // numpad 2
100: 'left', // numpad 4
102: 'right', // numpad 6
104: 'up', // numpad 8
120: 'debug' // F9
};
2. Open the Button Common Events plugin and look for more assignments of the keys. Comment out those as well:
This part of the plugin restores the keys original functions (instead of common events). I commented out X and Z in this part.
JavaScript:
Input._revertButton = function(button) {
if (button === 'OK') {
this.keyMapper[13] = 'ok';
this.keyMapper[32] = 'ok';
// this.keyMapper[90] = 'ok';
} else if (button === 'CANCEL') {
this.keyMapper[45] = 'escape';
// this.keyMapper[88] = 'escape';
this.keyMapper[96] = 'escape';
} else if (button === 'DASH') {
this.keyMapper[16] = 'shift';
} else if (button === 'PAGEUP') {
this.keyMapper[33] = 'pageup';
this.keyMapper[81] = 'pageup';
} else if (button === 'PAGEDOWN') {
this.keyMapper[34] = 'pagedown';
this.keyMapper[87] = 'pagedown';
} else if (button === 'LEFT') {
this.keyMapper[37] = 'left';
this.keyMapper[100] = 'left';
} else if (button === 'UP') {
this.keyMapper[38] = 'up';
this.keyMapper[104] = 'up';
} else if (button === 'RIGHT') {
this.keyMapper[39] = 'right';
this.keyMapper[102] = 'right';
} else if (button === 'DOWN') {
this.keyMapper[40] = 'down';
this.keyMapper[98] = 'down';
} else if (button === 'ALL') {
this.keyMapper[13] = 'ok';
this.keyMapper[32] = 'ok';
// this.keyMapper[90] = 'ok'; // <--------------- HERE
this.keyMapper[45] = 'escape';
// this.keyMapper[88] = 'escape'; // <--------------- HERE
this.keyMapper[96] = 'escape';
this.keyMapper[16] = 'shift';
this.keyMapper[33] = 'pageup';
this.keyMapper[81] = 'pageup';
this.keyMapper[34] = 'pagedown';
this.keyMapper[87] = 'pagedown';
this.keyMapper[37] = 'left';
this.keyMapper[100] = 'left';
this.keyMapper[38] = 'up';
this.keyMapper[104] = 'up';
this.keyMapper[39] = 'right';
this.keyMapper[102] = 'right';
this.keyMapper[40] = 'down';
this.keyMapper[98] = 'down';
}
}
This part switches on the common events feature - meaning, when you press a key, a common event will fire. I commented out the keys here as well:
JavaScript:
Input._switchButton = function(button) {
if (button === 'OK') {
if (Yanfly.Param.BCEList['enter'] !== 0) this.keyMapper[13] = 'enter';
if (Yanfly.Param.BCEList['space'] !== 0) this.keyMapper[32] = 'space';
if (Yanfly.Param.BCEList['z'] !== 0) this.keyMapper[90] = 'z';
} else if (button === 'CANCEL') {
if (Yanfly.Param.BCEList['ins'] !== 0) this.keyMapper[45] = 'ins';
if (Yanfly.Param.BCEList['x'] !== 0) this.keyMapper[88] = 'x';
if (Yanfly.Param.BCEList['num0'] !== 0) this.keyMapper[96] = 'num0';
} else if (button === 'DASH') {
if (Yanfly.Param.BCEList['keyShift'] !== 0) this.keyMapper[16] = 'keyShift';
} else if (button === 'PAGEUP') {
if (Yanfly.Param.BCEList['pageUp'] !== 0) this.keyMapper[33] = 'pageUp';
if (Yanfly.Param.BCEList['q'] !== 0) this.keyMapper[81] = 'q';
} else if (button === 'PAGEDOWN') {
if (Yanfly.Param.BCEList['pageDown'] !== 0) this.keyMapper[34] = 'pageDown';
if (Yanfly.Param.BCEList['w'] !== 0) this.keyMapper[87] = 'w';
} else if (button === 'LEFT') {
if (Yanfly.Param.BCEList['dirLeft'] !== 0) this.keyMapper[37] = 'dirLeft';
if (Yanfly.Param.BCEList['num4'] !== 0) this.keyMapper[100] = 'num4';
} else if (button === 'UP') {
if (Yanfly.Param.BCEList['dirUp'] !== 0) this.keyMapper[38] = 'dirUp';
if (Yanfly.Param.BCEList['num8'] !== 0) this.keyMapper[104] = 'num8';
} else if (button === 'RIGHT') {
if (Yanfly.Param.BCEList['dirRight'] !== 0) this.keyMapper[39] = 'dirRight';
if (Yanfly.Param.BCEList['num6'] !== 0) this.keyMapper[102] = 'num6';
} else if (button === 'DOWN') {
if (Yanfly.Param.BCEList['dirDown'] !== 0) this.keyMapper[40] = 'dirDown';
if (Yanfly.Param.BCEList['num2'] !== 0) this.keyMapper[98] = 'num2';
} else if (button === 'ALL') {
if (Yanfly.Param.BCEList['enter'] !== 0) this.keyMapper[13] = 'enter';
if (Yanfly.Param.BCEList['space'] !== 0) this.keyMapper[32] = 'space';
// if (Yanfly.Param.BCEList['z'] !== 0) this.keyMapper[90] = 'z'; // <--------------- HERE
if (Yanfly.Param.BCEList['ins'] !== 0) this.keyMapper[45] = 'ins';
// if (Yanfly.Param.BCEList['x'] !== 0) this.keyMapper[88] = 'x'; // <--------------- HERE
if (Yanfly.Param.BCEList['num0'] !== 0) this.keyMapper[96] = 'num0';
if (Yanfly.Param.BCEList['keyShift'] !== 0) this.keyMapper[16] = 'keyShift';
if (Yanfly.Param.BCEList['pageUp'] !== 0) this.keyMapper[33] = 'pageUp';
if (Yanfly.Param.BCEList['q'] !== 0) this.keyMapper[81] = 'q';
if (Yanfly.Param.BCEList['pageDown'] !== 0) this.keyMapper[34] = 'pageDown';
if (Yanfly.Param.BCEList['w'] !== 0) this.keyMapper[87] = 'w';
if (Yanfly.Param.BCEList['dirLeft'] !== 0) this.keyMapper[37] = 'dirLeft';
if (Yanfly.Param.BCEList['num4'] !== 0) this.keyMapper[100] = 'num4';
if (Yanfly.Param.BCEList['dirUp'] !== 0) this.keyMapper[38] = 'dirUp';
if (Yanfly.Param.BCEList['num8'] !== 0) this.keyMapper[104] = 'num8';
if (Yanfly.Param.BCEList['dirRight'] !== 0) this.keyMapper[39] = 'dirRight';
if (Yanfly.Param.BCEList['num6'] !== 0) this.keyMapper[102] = 'num6';
if (Yanfly.Param.BCEList['dirDown'] !== 0) this.keyMapper[40] = 'dirDown';
if (Yanfly.Param.BCEList['num2'] !== 0) this.keyMapper[98] = 'num2';
}
};
There's a pretty hefty part of the plugin called Input Key Mapper. I found that if I commend out the keys in the Revert and Switch parts of the plugin, I didn't need to alter anything else, so you can leave that part alone even though it has key bindings:
JavaScript:
//=============================================================================
// Input Key Mapper
//=============================================================================
// [No changes needed]
And, at long last, we have X and Z disabled.
Thank you, ct_bolt, for your help - you were right, but unfortunately another plugin was also altering key bindings, so there was more to be done.
P.S,
This issue came to light during a beta test of my game. I thought I disabled Z/X years ago when I first started the project. It didn't even occur to me they might still be functioning, but a beta tester used them, which broke some features. This saved me from embarrassment when I actually release the game! Conclusion of this story is: test your games, watch real people play, it is really important.