Error while trying to save in-game

Hi everyone,


 I had a problem while trying to use the in-game save system cause it game me the error  "Error: Object too deep" . I found out the problem was about circular reference in my code so I installed this plugin http://forums.rpgmakerweb.com/index.php?/topic/60150-circular-references-in-serialization/


which should get rid of the problem but instead it gives me this new one:


"Implement me. Unknow stdin file type!"


Any idea how to solve it?


save error.png


also I don't know what  are the 2 warnings about either, they appear only when I try to save
Looks like your game is trying to save a video file inside te save file. Weird, very weird.


What plugins are you using?
These are the plugins that don't give me error and I dind't make:

  • DeveloperConsole
  • ScreenResolution
  • OrangeAntiLag
  • OrangeCircularJson
  • ET_mapKey
  • MVCommons
  • OrangeCustomEvents
  • OrangeCustomEventCreator

After that i have a few plugins of mine which few of them give me this error upon turing them on. Strange thing is, i dont' have video files 😛


The plugin i made contains mostly changes of the functions of rpg_scenes, rpg_ogjects etc. and a few new classes like a pathfinder one.


The thing is i don't know where to start troubleshooting my problem or what to look for either 😛


I can pass you my plugin files for you to look in if you want but they are a bit messy because many parts are in development


EDIT: I've restricted the possible bug origin to only one plugin file, I'm looking now for what may cause the problem (still no idea what should i be looking for though XD)
Moved to plugin support.
I can pass you my plugin files for you to look in if you want but they are a bit messy because many parts are in development


EDIT: I've restricted the possible bug origin to only one plugin file, I'm looking now for what may cause the problem (still no idea what should i be looking for though XD)



Let me see if I can find anything.
Thank you!  🙂


This is the file that upon switching it off prevent the error from happening.


There are some calls to functions found somewhere else so if you need to see them tell me, I don't know if this file causes the error because call the real failing code.


View attachment GameClasses_upgrade.js


EDIT: I found the function that gives me the error


// add a pointer for the sprites to the character
Sprite_Character.prototype.setCharacter = function(character) {
this._character = character;
this._character._sprite = this;
};


I dunno why would gime e error since the plugin should get rid of circular reference bugs .-.


this is the original method found in rpg_sprites.js

Code:
Sprite_Character.prototype.setCharacter = function(character) {
    this._character = character;
};
The plugin got rid of the circular reference error, the problem here was that it tried to save the sprite itself inside the save file. Inside the sprite object, you have a lot of stuff, something in there can't be converted into json and it gave you that error.
Ok.. any idea how I could solve this?
Do you need that _sprite attribute? You're not using it anywhere on that file.
Not really (for now), it only was nice to have a reference in the character object for debugging purposes,  I guess i can circumvent this problem buy creating a method that returns the corresponding sprite instead of storing the pointer. But if you ahve a better idea I've my ears open
Not really (for now), it only was nice to have a reference in the character object for debugging purposes but I think i can circumvent this problem buy creating a method that returns the corresponding sprite instead of storing the pointer. But if you ahve a better idea I've my ears open



A method to find the sprite should work:


Game_CharacterBase.prototype.findSprite = function() {
if (!(SceneManager._scene instanceof Scene_Map)) return undefined;

var result;
var character = this;

SceneManager._scene._spriteset._characterSprites.forEach(function(sprite){
if (sprite._character == character) {
result = sprite;
}
});

return result;
};


(I didn't test it)
It does work thank you very much 🙂


UPDATE: I though that probably I'll need to use the reference of the sprites a lot in the future so i tried to put the sprites pointers in an array and pass the characters the index of their sprite in the array


Sprite_Character.prototype.setCharacter = function(character) {
this._character = character;
characterSprites_index.push(this);
this._character._spriteId = characterSprites_index.length - 1;
};

var characterSprites_index = [];

Game_CharacterBase.prototype.sprite = function() {
return characterSprites_index[this._spriteId];
};


I does seem to work now i think i just need to clear the array on every map load

Original thread: https://forums.rpgmakerweb.com/threads/error-while-trying-to-save-in-game.60915/