Well it's hard for me to explain specifically. Currently I am going step by step of the Item Core's functions and figuring them out, so far it doesn't look like they actually conflict with the equip slots... which is good, so the issue I was having must be in the party inventory (the independent items).
My functions allow for saving and retrieving switches and variables after they've been initialized. So.. for examples then:
Code:
Game_System.prototype.obvSetVariable = function(object, variableId, value) {
if (variableId > 0 && variableId <= LordV.OBV.maxVariables) {
if (typeof value === 'number') {
value = Math.floor(value);
}
object.variables[variableId] = value;
}
};
Retrieving the value:
Code:
Game_System.prototype.obvVariableValue = function(object, variableId) {
return object.variables[variableId] || 0;
};
Then I of course made 3 arrays (items | weapons | armors) for the party inventory and alias'd the DataManager methods to save/retrieve the contents for persisting through save files. Here are a couple functions I use for the containers:
Code:
Game_Party.prototype.saveItemData = function(item) {
var storage = this.getItemDataStorage(item);
if (item && !storage[item.id]) {
storage[item.id] = { switches: [], variables: [] };
}
};
Game_Party.prototype.getItemDataStorage = function(item) {
if (!item) return [];
if (DataManager.isItem(item)) return this._itemData;
if (DataManager.isWeapon(item)) return this._weaponData;
if (DataManager.isArmor(item)) return this._armorData;
return [];
};
Now the problem comes into play with the independent items. If I try to get the item data, setting or getting the switch or variable it gives me the error pointing to that item being null. Example: Actor gets a {Sword} (in party inventory) and I save Switch 1 to true on it:
Code:
var actor = $gameParty.leader();
var item = $gameParty.weapons()[0]; // sword ID - 1
var storage = $gameParty.getItemDataStorage(item)[item.id];
if (storage) {
$gameSystem.obvSetVariable(storage, 1, true);
}
I have confirmed that the "storage" exists (because on gainItem, it initializes the switches and variables arrays through saveItemData() above). I don't get this error when I have YEP_ItemCore turned off, so I'm trying to locate the exact problem so I can either alias or overwrite it.
My theory: The independent item just creates a copy into the inventory and thus my own containers (_.itemData | ._weaponData | ._armorData) arent' getting any actual data?