Just make it so if it's null, it skips the default function, then create your own function to handle that exception. Basically this was what I did.
This is how I handle this.
VictorEngine.DualWield.performAttack = Game_Actor.prototype.performAttack;
Game_Actor.prototype.performAttack = function() {
var weapons = this.equips();
if (this._dualWieldSpriteIndex === 2 || (!weapons[0] && DataManager.isWeapon(weapons[1]))) {
var index = this._dualWieldSpriteIndex - 1;
this.performDualWieldAttack(index);
} else {
VictorEngine.DualWield.performAttack.call(this)
}
};
Game_Actor.prototype.performDualWieldAttack = function(index) {
var weapons = this.equips();
var wtypeId = weapons[index] ? weapons[index].wtypeId : 0;
var attackMotion = $dataSystem.attackMotions[wtypeId];
if (attackMotion) {
if (attackMotion.type === 0) {
this.requestMotion('thrust');
} else if (attackMotion.type === 1) {
this.requestMotion('swing');
} else if (attackMotion.type === 2) {
this.requestMotion('missile');
}
this.startWeaponAnimation(attackMotion.weaponImageId);
}
};
Game_Actor.prototype.performAttack = function() {
var weapons = this.equips();
if (this._dualWieldSpriteIndex === 2 || (!weapons[0] && DataManager.isWeapon(weapons[1]))) {
var index = this._dualWieldSpriteIndex - 1;
this.performDualWieldAttack(index);
} else {
VictorEngine.DualWield.performAttack.call(this)
}
};
Game_Actor.prototype.performDualWieldAttack = function(index) {
var weapons = this.equips();
var wtypeId = weapons[index] ? weapons[index].wtypeId : 0;
var attackMotion = $dataSystem.attackMotions[wtypeId];
if (attackMotion) {
if (attackMotion.type === 0) {
this.requestMotion('thrust');
} else if (attackMotion.type === 1) {
this.requestMotion('swing');
} else if (attackMotion.type === 2) {
this.requestMotion('missile');
}
this.startWeaponAnimation(attackMotion.weaponImageId);
}
};
The only think you need to make the motion is the wtypeId, and the wtypeId = 0 is the one for the bare handed motion.
I made a condition to check if the action is a second attack or an unarmed attack while dual wielding. If either of them is ok, it calls my own 'performAttack' function.
