Newbie question about saving and loading games

  • #10, by nmvhWednesday, 18. May 2022, 12:18 2 years ago
    BTW, this explains why load and save screens need to be the same actual menu, right?
    With just a condition or value showing which of the two tasks (save or load) is the current one.

    At first, I thought it natural to create two different menus, one for save and one for load.

    Newbie

    38 Posts


  • #11, by nmvhWednesday, 18. May 2022, 13:08 2 years ago
    Sorry but here is another question to arflme:

    I notice that you call an action after loading a game. So this is possible? My assumption would have been that loading a game resets all conditions and values to the ones in the savegame. But maybe the "action call stack" is still being executed even after load of saved game? 

    Newbie

    38 Posts

  • #12, by afrlmeWednesday, 18. May 2022, 13:31 2 years ago
    That's a lot of replies. To be honest I have no clue, I created that template a lot of years ago & I don't have the best of memory & I don't remember why I did this or that. The engine has changed a lot since I created that template - I know it's not the easiest template to understand, especially since I didn't use simple English. Also I didn't even remember adding the bonus content section & stuff like that. I must have been very motivated, or in a very good mood or something when I created that template.

    Did you check out the glenfx tutorials that Esmeralda linked to you? They are really old, but they show you a really simple method of creating a save/load menu. My template on the other hand is really complicated as I included fallbacks (safety nets) to prevent the player from being able to save, delete, or overwrite something by accident. I added those fallbacks because of how the save system works. The only thing that matters in the save/load menu is the save slots you created via the floppy disk tool, the regular object areas you created don't matter & are only used to indicate which save slot the player has selected & also to execute the save slot, however let's say that the player then accidentally clicks on another slot when they go to press the save/confirmation button - the thing is that those save slots are layered on top of everything, which is why you can't generate a confirmation button above the save slots themselves.

    Imperator

    7278 Posts

  • #13, by esmeraldaWednesday, 18. May 2022, 13:45 2 years ago
    The only thing that matters in the save/load menu is the save slots you created via the floppy disk tool, the regular object areas you created don't matter & are only used to indicate which save slot the player has selected & also to execute the save slot, however let's say that the player then accidentally clicks on another slot when they go to press the save/confirmation button - the thing is that those save slots are layered on top of everything, which is why you can't generate a confirmation button above the save slots themselves.
    Well you can store the selected slot number in a variable and feed that number back when executing the save or load when hitting the confirmation button. But that requires scripting.
    (system.selectedSavegame  - luadocs says "readonly" but you can actually assign a value, too)

    And that might answer you question @nicolaj, how the engine knows what slot is selected. The slots (created with the floppy disk symbol) are numbered internally (in the sequence they were created, I guess). When clicking on a slot, the number is stored in systems.selectedSavegame, and on that slot the action is executed.

    Key Killer

    513 Posts

  • #14, by afrlmeWednesday, 18. May 2022, 14:33 2 years ago
    I forgot about the new system stuff for save/load games. My template was created a long time ago & VS has loads of features now that didn't exist back then.

    Imperator

    7278 Posts

  • #15, by nmvhWednesday, 18. May 2022, 15:36 2 years ago
    By now, after reading your new replies and tinkering with the example game by afrlme (and also reading GlenFx), I feel I have a basic understanding of how it works. Looking forward to experiment more to see how I can make it all work.

    Thanks a bunch to all of you!

    Newbie

    38 Posts