A
Aaron Walton
Guest
I'm working on my save system, currently trying to implement a three slot system like a lot of retro games use, so when you start a new game, you select slot one, two, or three, and then you can load whichever slot you want. What I have right now is a newGame script, which sends the player to the starting location and has an argument which is a string ("savedgame1.sav"), which a global variable is set to, so that when the saveGame script is called, it saves to that text file. But my game is behaving strangely when I try to do this (it deletes my oPlayer when I try to start a new game in the menu, for some reason, which causes the game to crash). The save/load system worked perfectly before I started trying to implement multiple slots, when I wasn't trying to save a string to a global variable, so I'm wondering if somehow this is what's causing it. Is this even possible to do? If not, what would be a better solution? Here is my oNewGame object and my newGame script:
I suspect I could fix the issue by just having three different loadGame scripts, one for each save slot, which each just loads a particular file, but I'd like to see if I can do it this way before just brute forcing it.
GML:
//This is oNewGame
with oMenu
{
if menu[2] = true
{
other.image_index = 1
if keyboard_check_pressed(vk_enter)
{
newGame("savedgame1.sav");
}
}
else other.image_index = 0;
}
GML:
//This is the newGame script
///@arg saveSlot
SlideTransition(TRANS_MODE.GOTO, global.startRoom,global.startX,global.startY);
global.saveSlot = argument[0];