Default RM Code from their core script:
So I added a new object to the baseItems and then added a reference back to the baseItem in that. And voila, object too deep. Even without a direct reference but with a function:
Item_SG.prototype.item = function(){ return this.db[this.item_id]; // this.db = $dataArmors and it does not return a null value, this specific function actually works.}Same problem. Object too Deep crash.
Why does RPG Maker MV not allow me to have a reference back to the parent object of items in the database? Why is this explicitly forbidden?
JsonEx._encode = function(value, depth) { depth = depth || 0; if (++depth >= this.maxDepth) { throw new Error('Object too deep'); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< crash } var type = Object.prototype.toString.call(value); if (type === '[object Object]' || type === '[object Array]') { var constructorName = this._getConstructorName(value); if (constructorName !== 'Object' && constructorName !== 'Array') { value['@'] = constructorName; } for (var key in value) { if (value.hasOwnProperty(key)) { value[key] = this._encode(value[key], depth + 1); } } } depth--; return value;};
Item_SG.prototype.item = function(){ return this.db[this.item_id]; // this.db = $dataArmors and it does not return a null value, this specific function actually works.}Same problem. Object too Deep crash.
Why does RPG Maker MV not allow me to have a reference back to the parent object of items in the database? Why is this explicitly forbidden?