Announcement

Collapse
No announcement yet.

Save data "erased" upon using open level from a load game function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Save data "erased" upon using open level from a load game function

    Ok so, I've setup a save game load game system. Works fine to save players data, and as long as I load from the level I save on, character will be put back where I saved at. However if I save on level 2, and restart game and now start at level 1, if I load save it just puts player in location on current level. I tried to use open level function and it opens the right map, but other than that rest of saved data doesn't get loaded in. I thought I could do a work around and upon level load using level blueprint using load game function and then assign player data from the save game, but no joy. I've searched and searched and haven't been able to find anything that deals with this problem at least not that I could find. Using 4.18.3.

    Pics show load dialog how I have it now so it opens the level (I removed all the player information since it was getting "erased" or not read anyways).

    #2
    Originally posted by IronHawx View Post
    Ok so, I've setup a save game load game system. Works fine to save players data, and as long as I load from the level I save on, character will be put back where I saved at. However if I save on level 2, and restart game and now start at level 1, if I load save it just puts player in location on current level. I tried to use open level function and it opens the right map, but other than that rest of saved data doesn't get loaded in. I thought I could do a work around and upon level load using level blueprint using load game function and then assign player data from the save game, but no joy. I've searched and searched and haven't been able to find anything that deals with this problem at least not that I could find. Using 4.18.3.

    Pics show load dialog how I have it now so it opens the level (I removed all the player information since it was getting "erased" or not read anyways).
    Hi IronHawkx,

    I think I know what the problem is - You are saving all your player data to disk, but when you load the data you are loading it on a different level than the target level. So for example, you are on your main menu and load your data, then you use Open Level and go to another level and all your player stats are gone.

    Here is one solution:
    • When you first load your data, save it all inside your Game Instance (all player variables should be saved there)
    • Use Open Level to load the correct level
    • Once that level loads, load all Player stats from your Game Instance on Begin Play

    The reason this works is because Game Instance retains data from level to level as long as you are playing the game. All other regular Blueprints only hold data on the current level and once they are unloaded and loaded again everything is reset.

    Hope this helps!
    [WIP] Procedural City Generator | RPG AI
    [MARKETPLACE] Animal Behavior Kit | Space Shooter Template | Procedural Foliage Tool | Procedural Park
    [FREE] Modular Road Tool | Action Platformer Template | Radar BP | Free Birds | Procedural Buildings
    Join our Discord

    Comment


      #3

      So How do we bulk load and bulk save in a game instance all of the game flags and variables (such as a rpg with interactive dialog in it with different events and storylines?)



      Comment


        #4
        CoquiGames thanks you so much, I had a feeling that was what I needed to do but instructor was doing it another way and it was failing. Thank you for giving me the confidence to keep going the route I originally was going in thought process. I now have a functions save and loading system.

        Comment

        Working...
        X