(SOLVED) Save/load last known Player XY and Scene

FINAL EDIT
Here is the solution with a template: This is one way of saving last known XY and Scene information

I can’t delete this thread but I have solved this. I guess…, enjoy incoherent rambling.

After four days of trying to troubleshoot this on the discord, talking to many people, and having a kind user review my own game (which got some results), I still do not have a functioning save/load system for this specific mechanic. A mechanic most rpgs/games have when saving and reloading a game file.

Here’s what I want.
The player needs to be able to save there xy of the scene (and current scene) and I need it to update their xy in the next scene when transitioning. I have this system in place. However, the issue is saving and reloading the scene.
I created a global string var that saves the scene “name”. I gave each scene a specific name.
What should happen is this global var should save the last known scene name and load it back up upon the “continue” menu which then should send you to the scene and xy of the last known save.

I have two separate screenshots of two different games you can access and look through.
Here are the game with the “scene” save function.
removed link
This is the modified game version that a kind user @floop (on discord) worked with me to “fix” the issue.

Here is the known issues

  1. The game won’t actually save, often, despite clearly pressing space multiple times and it still revert(s) you back to bedroom scene from bathroom when you open and close and in a different xy or to the default xy of the bedroom.

  2. When transitioning between scenes, it will not save the current position of the scene without you pressing space first after entering (that is not how it is intended, it should auto save your XY in the new scene when switching and load you right back to that scene BECAUSE space is used to transition between scenes).
    Amongst other bugs.

  3. I do not personally like using a global var to save player position always, this is my suspicions but I am sure this is contributing to the reason why the player xy is not saving properly, amongst other reasons.

Here is my suspicion(s). I have able to isolate what wasn’t working, which was the scene var never saving period. It resets to the default value given in the game settings not the value given in events upon open/close of the game.
I was able to get some of it working by placing the value of the scene ver underneath “save fille = 0”. Which Is not how it’s suppose to work and it doesn’t always but it’s what gave me semi-decent results sometimes. Like I mention above…

here is all the screenshots with this “save” system:






*Perhaps saving and loading a save file might work here (i have so many doubts of anything working to be honest) but I am literally so tired, i can barely look at this game anymore. 4 days, over 8 hours a day looking at this.

Here is the game without the save/load of the scene.
removed link

Known issues: Obviously, doesn’t save/load scene(s) at all.
What does work: As long as the game is open. It saves player xy perfectly between scenes. It “auto saves” the transition to another scene without having to re-press the space button.
And if I give the global var a default value (in game properties) of one of the scene name(s), it will load back to that scene perfectly. But obviously that is not how it’s suppose to work.

Here are all the screenshots of the no “save” scene game.






*First, I am aware the naming in lower case for the var vs upper case for the actual scene. I fixed this in another save file, it doesn’t do anything of course but I am aware of the poor naming.
Secondly, I do appreciate all the people that tried to help. I am not frustrated at no one except myself. The save/load advance tutorial wasn’t useful here for whatever reason but that could be a just my fault really.
I may just need an example of some one else making this system. I need to see someone else’s code so I can modify to fit the game. I also need this code to actually work, not theorized.
Thirdly, I am more than happy to ditch whatever system I have for a better system. I can care less on maintaining the system format I used, if I need to everything different

Just for clarification, so your player is at 50/50 in the bedroom, and he goes to the bathroom, you want him to be at 50/50 there too? Or to remember that the last time he was in the bathroom he was at 75/75 and put him there? I did try to look at your files but they wouldn’t open for me.
And if I’m understanding, you are using the space to change scenes AND save the position?

I am not sure what percentages mean in your comment here.
It is necessary for space to be both save/scene transition due to it saving xy of the player and it won’t reset the player position to default of the scene.
For the files, anyone with a link should access it. You’d need to download it and unzip it like usual ^^

Like 50x 50 y in bedroom, so when he goes to the bathroom you want him to be at 50x50y or an old spot it remembered last time he was there?

With the system I have in place, it automatically saves the player xy upon space and stores that infor pretty well as in (except that it breaks often in the first game file). In the game file w/o the save “scene” function, it saves perfectly and it isn’t particularly the problem. I have dedicated saves for the xy of each scene so it remembers the previous scene xy and transitions back to it if it needs to… it works just as intended. So I am not really asking for a save player xy help, I am asking for “remembering” scene name help so it can send the player back to the correct scene upon load. But due to those systems working together, that is why I have it written this way.

I have watched the advance save/load and applied that information but listen, it doesn’t work for whatever reason. future me, probably should’ve look at the intermediate one where they mention this scenario in passing I can’t really explain anymore and I recommend just checking out both game files.

I thought to let anyone know I went with a different/alternative save system that doesn’t need to save player xy or scene information for the sake of my sanity. At least for the game I am making, I don’t really need to have this feature in order to make a good experience (although it would help).
*For now, I simply just save dialogue and other misc things and load the player back to the main scene ^^.

Until I am a more knowledgeable developer and have come up with a solution, I will update this post with my findings. I am well aware there are others who know this information but I do not, and I can’t really be spoon fed answers all the time so I won’t bug anyone about it. Feel free to look over the code, recreate it, or tell me I am wrong in every sense of the word. It’s all good with me.

Well I’m glad, no sense holding up the game over something so trivial when you can come back and revamp it later.
I did get to look at your game it’s very cute and I tried to go through it but I have no experience saving via easy save so I couldn’t help. I was almost wondering if you couldn’t use the easy save system for everything except the scene and position and just write those ones out the old fashioned way to be a little easier on you.

1 Like

The easy save extension was very new to me and I was working on this before I had known about it. I did end up adding the extension in it but I did not use it at all. I never touched it outside of having it installed (which I removed in other version(s)) For the other information, like dialogue, that was a cake walk for me to save. If i am correct, the code to write with the extension vs with what I used, wouldn’t change or be any easier. It’s already very simple!

The problem was the scene issue, never really the xy of the player( I did hand write this part) to be honest. I knew how to save the xy. I also hand wrote this (the scene “name”) and that’s where the issue lays lmao. I am really unfamiliar how this would even be saved and I have come to find out that it is definitely not something I could’ve taught myself (and it wasn’t the way I thought it would be) and the videos aren’t a guide to use verbatim.
It is still something I am learning right now as a moderator silver was kind enough to deal with my nonsense for so long and I got some examples to reference from. I will review it later and update the forum with everything I’ve learned and create some templates so no one else gotta deal with this (if they are anything like me anyways ahaha).
But that is when I have the time to xD, I can’t promise this will be solved soon as I have an entire game in active development.

Ok I was probably looking at the older version I will check out the newer one.

I have removed access to the game files for anyone else, I felt that I should simply fix this myself and the screenshots are everything any could need to recreate it as that’s pretty much the entire game (since I stripped everything out). But in all the versions, I never used the extension. I had manually wrote everything by hand.
Also, in the version(s) I had here, I did not have the dialogue saved as that wasn’t the problem and I really wanted to isolate what was the problem.

I had two versions where it had the broken “scene” save and the one without the “scene” save. The second one was for anyone who wanted to make a “scene” save system or just change whatever they want.

I hope this makes sense. Text is pretty hard to translate what I mean.

Alright, if anyone scrolled far enough. Here is a couple of reasons why this didn’t work.

  1. Don’t add load storage “name of storage” from memory. This is not useful for actively updating save systems. It appears it’s best used for showing non-updating score/data information.

  2. Personal opinion, don’t use scene vars for xy here if you have so many scenes that store xy. Put them in a separate structure (that’s within a larger structure) with the name of scene and two number vars, x and y.
    This will keep saving/loading simple as all you need to do is save/load the one big structure var that keep all vars (even other structures).

  3. Probably the reason why “scene” was not saved was because this was not actually saved/loaded.

  4. For now, keep the save/load inside the scenes rather than as an external event. You can review the template above for what I mean.
    Beginning of scene will have the load portion and the save portion could be keybinded or autosaved after x period of time.

  5. Minor nitpick, the saving/loading here was messy and overly complex. You really just need to save/load one large structure var and not all these separate scene/vars.

  6. Minor nitpick part 2, keep naming conventions the same. You will mess up at some point when writing them and this could cause unnecessary headaches.

Anyways, I deeply apologize to anyone I have inconvenienced with this issue. It was more simple now to me after I spent more time on it. Truthfully, everyone’s advice was useful and I can’t thank all of these people enough for their help, even if it didn’t solve the issue. I hope the template helps anyone else!