Thanks for this ... I've done some testing and isolated the problem. If that means this post needs to be moved to plugin support that's fine but I don't think that is necessary here, I think this can be solved with script calls -- still need help though
I'm using a very simple but fantastic Gilgamar plugin called "EquipCE" which calls a common event when an item is equipped or unequipped -- this functionality is essential to my project, since certain switches need to be turned on or off when certain equipment is worn or wielded.
All of the armors and weapons that have any kind of CE triggered upon equip/remove exit out of the menu once equipped. Here is the text of the plugin:
/*=============================================================================
* Gilgamar - Equip Common Event
* By Gilgamar
* G_EquipCE.js
* Version: 1.02
* Free for commercial and non commercial use.
*=============================================================================*/
var Imported = Imported || {};
Imported.G_EquipCE = true;
var EquipCE = {};
/*:
* @plugindesc v1.02 Enable equipment common events.
* @author Gilgamar
*
* @help
* ============================================================================
* Introduction
* ============================================================================
* Enables weapon and armor equip/remove common events via notetags. Ex:
*
* <EquipCE Event: 1 onequip>
* <EquipCE Event: 2 onremove>
*
* The precedling lines will run common event ID 001 on equip and common event
* ID 002 on remove for the weapon or armor tagged.
*
* The event does not run until menu is closed. If the item is equipped or
* removed multiple times before closing the menu only the last event will run.
*
* ============================================================================
* Changelog
* ============================================================================
* Version 1.02:
* - Added SceneManager.goto(Scene_Map) after common event so the event will
* run immediately on equip/remove
*
* Version 1.01:
* - Moved event check into Game_Actor.changeEquip() so it works on optimize
*
* Version 1.00:
* - Enables weapon and armor equip/remove common events via notetags
*/
//=============================================================================
// Notetags
//=============================================================================
EquipCE.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
if (!EquipCE.DataManager_isDatabaseLoaded.call(this)) return false;
DataManager.processEQUIPCENotetags1($dataWeapons);
DataManager.processEQUIPCENotetags1($dataArmors);
return true;
};
DataManager.processEQUIPCENotetags1 = function(group) {
// Check if function called more than once
if (DataManager.processEQUIPCENotetags1.calledTimes++ > 1) return;
var note1 = /<(?:EQUIPCE EVENT):[ ](\d+)[ ](ONEQUIP)>/i;
var note2 = /<(?:EQUIPCE EVENT):[ ](\d+)[ ](ONREMOVE)>/i;
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
// console.log(notedata)
obj.commonEvents = [];
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(note1)) {
obj.commonEvents.push({
eventId: parseInt(RegExp.$1),
occurs: 'onequip'
});
} else if (line.match(note2)) {
obj.commonEvents.push({
eventId: parseInt(RegExp.$1),
occurs: 'onremove'
});
}
}
}
// console.log(group)
};
DataManager.processEQUIPCENotetags1.calledTimes = 0;
//=============================================================================
// EquipCE Functions
//=============================================================================
EquipCE.changeEquip = function(item, occurs) {
if (!item) return;
for (var i = 0; i < item.commonEvents.length; i++){
var commonEvent = item.commonEvents[i];
if (commonEvent.occurs === occurs) {
// console.log(commonEvent)
$gameTemp.reserveCommonEvent(commonEvent.eventId);
SceneManager.goto(Scene_Map);
}
}
}
EquipCE.onEquip = function(item) {this.changeEquip(item, 'onequip')}
EquipCE.onRemove = function(item) {this.changeEquip(item, 'onremove')}
//=============================================================================
// RPG Maker Overrides
//=============================================================================
EquipCE.Game_Actor_changeEquip = Game_Actor.prototype.changeEquip;
Game_Actor.prototype.changeEquip = function(slotId, item) {
var oldItem = this.equips()[slotId];
var newItem = item;
EquipCE.Game_Actor_changeEquip.call(this, slotId, item);
if (this.equips()[slotId] === newItem) {
// Change equip succeeded or same item equipped
EquipCE.onEquip(newItem); // Check equip events
EquipCE.onRemove(oldItem); // Check remove events
}
};
// Game_Actor.prototype.changeEquip = function(slotId, item) {
// if (this.tradeItemWithParty(item, this.equips()[slotId]) &&
// (!item || this.equipSlots()[slotId] === item.etypeId)) {
// this._equips[slotId].setObject(item);
// this.refresh();
// }
// };
Is there a simple script call that I can stick in the CE that is triggered that would reopen the equip menu? If not, I'll go to Gilgamar, but I have to think there's just a very simple solution here ...
EDIT: I have tentatively solved the issue by including these calls in each equip/remove common event:
$gameParty._menuActorId = 1 [in my case, the actor in question];
SceneManager.push(Scene_Equip);
This works, but there's definitely a stutter since the plugin seems to close out the menu before the CE's call it back into being. It's workablebut a bit messy, so if anyone has any thoughts on how to integrate this into the plugin to make this buttery smooth that'd be super swell!
Thanks
@Eliaquim as always

