• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Question about possible future saving glitch

Yizzard

Member
So my game saves with ini files storing variables in them. I noticed that sometimes when I create new objects gamemaker will automatically reorder the object numbers of each of my objects and it will mess up previous save files. For example, in my save file it has currentParty0 = 14, telling the game that the party member in the first slot is object number 14 which is currently the character Jeebo. However, if I add a new weapon into the game for example, it sometimes decides to reorganize the numbers and will make the object code for Jeebo 15 and then 14 will be the blank player object which will cause the game to crash since it tries to read variables which aren't in the blank player object because it's supposed to be the Jeebo object. I can manually go into the game save and just change the 14 to a 15 for currentParty0 and will fix this problem, however I will also need to change currentParty1 and 2 and also all of their inventories, etc. to their updated codes which usually is just one more than the previous if I added one new object. This isn't a huge deal now, but I plan on updating my game post-release and I can't have updates corrupting everyone's save files. My guess as to why it's happening is because the weapons are all children of the obj_Weapons object. I assume this would mean that they will have to be shoved up at the beginning of the list of objects since obj_Weapons is up there and the children must be with the parent. I'm not sure if this is true or not but it makes sense to me as most of the times where this problem occurs is when I add a new weapon or a new player character or something. I'm not sure though. Does anyone know a way around this?
 

obscene

Member
Use object_get_name() when saving and asset_get_index() when loading to convert each ID to a string and back again.
 
Top