im looking for a way to change a in game variable when someone from the party changes his equipment.
The only way that comes in my mind is doing it with if commands for each piece of weapon/armor in the game.
I consider using weapon/armor notetags but i have to learn and understand that first.
Thats what i got so far:
Code:
Scene_Armor.prototype.onItemOk = function() {
SoundManager.playEquip();
this.actor().changeEquip(this._slotWindow.index(), this._itemWindow.item());
this._slotWindow.activate();
this._slotWindow.refresh();
this._itemWindow.deselect();
this._itemWindow.refresh();
if (this._actor._name == "Devon") {
if (this._actor._equips[2]._itemId == 21) {
var tempvalue = $gameVariables.value(16);
tempvalue = tempvalue + 1;
$gameVariables.setValue(16, tempvalue);
var helmset = true;
};
if (helmset == true) {
if (this._actor._equips[2]._itemId != 21) {
var tempvalue = $gameVariables.value(16);
tempvalue = tempvalue - 1;
$gameVariables.setValue(16, tempvalue);
helmset = false;
};
};
};
this._statusWindow.refresh();
};What we see here is if the actor Devon has equiped the item with the id 21 in the 3rd slot the variable nr. 16 will increase by 1
(equips[2] 3rd slot in the array is used for helms in my game, itemId 21 is a helm named bandana).
The problem here is first that it will take really long time to make that for every weapn/armor in the game and
the boolean helmset changes back to false once the script runned once.
If i would declare a local boolean above the if condition it would work but not correctly since it would always decrease the variable16 by 1 everytime the item with the id 21 isnt weared.
I made a custom scene based on the scene_equip and changed a few things.
I were thinking of using a for loop to go once through the whole arrays (_equips[]) and read the itemIds but that would end up in the same direction i guess.
Anyone gotn idea to making this work correctly. That means if itemId 21 is equiped variable16 increasese by 1 and if it is deequiped once it was equiped it should decrease by 1.
And a few tips in terms of notetags would be awsome as well.
The script im using are:
yanfly core engine
and the onces i made by myself:
custom main menu
custom stat menu
custom equip menu
custom cursor