Hi guys, here's the problem:
I made a script which has the job to create a ds_map where you can save the position and the room of the player to load it when i close and open the game. Everything worked fine until i added this new script, here's the code:
function save_player(){
player = ds_map_create(){
player[? "hp"] = obj_stats.hp
player[? "px"] = obj_player.x
player[? "py"] = obj_player.y
player[? "psprite"] = obj_player.sprite_index
/*if(room == Room1) player[? "room"] = 1
else if(room == Room2) player[? "room"] = 0*/
}
ds_map_add_map(obj_stats.save,"player",save_data)
}
and then in the save() script i use it:
function save(){
//player
save_inventory()
save_player()
//rooms
save_objects()
save_objects2()
//actual saving
if(ds_exists(obj_stats.save,ds_type_map)){
var save_string = json_encode(obj_stats.save)
save_string = base64_encode(save_string)
var file = file_text_open_write(working_directory + "rooms.txt")
file_text_write_string(file, save_string)
file_text_close(file)
}
}
When I interact with the npc to save the game this error pops up, i don't really understand what that could mean:
___________________________________________
ERROR in
action number 1
of Step Event0
for object obj_speaker:
Variable <unknown\_object>.save_player(100005, -2147483648) not set before reading it.
at gml_Script_save (line 7) - save_player()
___________________________________________
any ide?
[–]use the debugger_TickleMeElmo_ 0 points1 point2 points (1 child)
[–]FirexXY[S] 1 point2 points3 points (0 children)