FlameRooster
Member
I have a save/load system. Saving/loading works on the same game version but when I try to load a saved file from a previous version of my game, the values being loaded in is different for some reason. I have no idea why.
So, instead of loading your player character for example, it will load an enemy unit instead.
This is how I am saving:
This is how I am loading:
Is there a way to make a save/load system work across all future versions of your game?
So, instead of loading your player character for example, it will load an enemy unit instead.
This is how I am saving:
Code:
var save_data = ds_map_create();
save_data[? "playerName0"] = global.playerName[0];
var save_string = json_encode(save_data);
ds_map_destroy(save_data);
save_string = base64_encode(save_string);
var file = file_text_open_write(working_directory + argument0);
file_text_write_string(file, save_string);
file_text_close(file);
This is how I am loading:
Code:
var file = file_text_open_read(working_directory + argument0);
var save_string = file_text_read_string(file);
file_text_close(file);
save_string = base64_decode(save_string);
var save_data = json_decode(save_string);
if (!is_undefined(ds_map_find_value(save_data, "playerName0"))) {
global.playerName[0] = save_data[? "playerName0"];
}
Last edited: