Josef Scroggins
Member
Edit #2: I thought I had this figured out but now the player's coordinates don't change and the camera won't snap onto the player.
//Loading
Original Post:
Hello everyone, I have been stuck on this topic for a while. I have saved all the variable and the players location and room. When I try and load the game it crashes or there isn't an instance of the player. Any help would be wonderful.
//Loading
Code:
CL = objCallList;
if file_exists("Save.helix")
{
ini_open("Save.helix");
var LoadedRoom = ini_read_real("Room","Room",Overworld0);
CL.hp = ini_read_real("Player","HP",20);
CL.maxhp = ini_read_real("Player","MAXHP",20);
CL.xp = ini_read_real("Player","XP",0);
CL.maxxp = ini_read_real("Player","MAXXP",10);
CL.money = ini_read_real("Player","Cash",0);
CL.lvl = ini_read_real("Player","Level",1);
CL.skill = ini_read_real("Player","Skill",0);
CL.cashgainmax = ini_read_real("Luck","CGMX",3);
CL.cashgainmin = ini_read_real("Luck","CGMN",0);
CL.xpgainmax = ini_read_real("Luck","XPGX",5);
CL.xpgainmin = ini_read_real("Luck","XPGN",1);
CL.statsMenu = ini_read_real("Misc","Stat Menu",false);
var PLX = x = ini_read_real("Player","PX",x)
var PLY = y = ini_read_real("Player","PY",y)
ini_close();
if !instance_exists(plrHero0)
{
instance_create_layer(PLX,PLY,"Instances",plrHero0);
instance_create_layer(PLX,PLY,"Instances",objDraw);
instance_create_layer(PLX,PLY,"Instances",objCamera);
with(ev_game_start)
{
plrHero0.x = PLX;
plrHero0.y = PLY;
}
instance_activate_object(plrHero0);
CL.hascontrol = true;
}
room_goto(LoadedRoom);
}
else
{
show_message("There is no available save data!");
}
Original Post:
Hello everyone, I have been stuck on this topic for a while. I have saved all the variable and the players location and room. When I try and load the game it crashes or there isn't an instance of the player. Any help would be wonderful.
Code:
CL = objCallList;
ini_open("Save.helix");
var SavedRoom = room;
ini_write_real("Player","HP",CL.hp);
ini_write_real("Player","MAXHP",CL.maxhp);
ini_write_real("Player","XP",CL.xp);
ini_write_real("Player","MAXXP",CL.maxxp);
ini_write_real("Player","Cash",CL.money);
ini_write_real("Player","Level",CL.lvl);
ini_write_real("Player","Skill",CL.skill);
ini_write_real("Luck","CGMX",CL.cashgainmax);
ini_write_real("Luck","CGMN",CL.cashgainmin);
ini_write_real("Luck","XPGX",CL.xpgainmax);
ini_write_real("Luck","XPGN",CL.xpgainmin);
ini_write_real("Misc","Stat Menu",CL.statsMenu);
ini_write_real("Room","Room#",SavedRoom);
ini_close();
Code:
CL = objCallList;
if file_exists("Save.helix")
{
ini_open("Save.helix");
var LoadedRoom = ini_read_real("Room","Room#",-1);
CL.hp = ini_read_real("Player","HP",20);
CL.maxhp = ini_read_real("Player","MAXHP",20);
CL.xp = ini_read_real("Player","XP",0);
CL.maxxp = ini_read_real("Player","MAXXP",10);
CL.money = ini_read_real("Player","Cash",0);
CL.lvl = ini_read_real("Player","Level",1);
CL.skill = ini_read_real("Player","Skill",0);
CL.cashgainmax = ini_read_real("Luck","CGMX",3);
CL.cashgainmin = ini_read_real("Luck","CGMN",0);
CL.xpgainmax = ini_read_real("Luck","XPGX",5);
CL.xpgainmin = ini_read_real("Luck","XPGN",1);
CL.statsMenu = ini_read_real("Misc","Stat Menu",false);
ini_close();
room_goto(LoadedRoom);
}
else
{
show_message("There is no available save data!");
}
Last edited: