Forum rules - please read before posting.

custom save actionlist overwrites other saves when order by update time is selected

edited June 2020 in Engine development

Hello Chris,

I faced with a problem on the saving part. I don't know if it's a bug or caused by my setup.

So I am using a custom actionlist on saving and disabled save on click

I simplified my custom actionlist for testing and here it is:

https://ibb.co/vQzZ3rV

the problem occurs when I use 'Order save lists by update time' on settings manager

Let's say I already have autosave + 3 saves
when I click on new save, it starts saving on top of 1st slot, then 2nd slot then 3rd slot and then creates a new save slot

when I disable 'order save lists by update time' it works as intended

as I mentioned I cleared my custom actionlist to almost nothing and it still happens. there isn't any other custom scripting going on

note: I am using save game profiles

v.1.71.3

thanks

Comments

  • How many save slots are you displaying in your SavesList menu element, and what's the maximum number of saves you've set at the top of the Settings Manager.

    I'll attempt a recreation, but I'm a little unclear on the behaviour you're facing. Can you share screenshots that show the issue?

  • Hi,

    first of all sorry for opening the topic here I thought it was technical q&a.

    settings manager:
    max number of saves: 50

    saves list:
    max number of slots: 10

    I will prepare a recording for that in the following days.

  • Hey Chris, sent you a recording

    steps:

    1. Save new game (saves to slot 1) working as intended
    2. Save new game (saves to slot 2) working as intended
    3. Save new game (saves to slot 2 on top of save 1 instead of empty slot 3)
    4. Save new game (saves to slot 3) working as intended as the slot 3 is empty
    5. Save new game - saves to slot 2 on top of save 1 instead of empty slot 4
    6. Save new game - saves to slot 4 on top of save 2 instead of empty slot 4
    7. Save new game - saves to slot 2 on top of save 1 instead of empty slot 4
    8. Save new game - saves to slot 4 working as intended

    I have no idea what I am doing wrong.

    I checked the action list. The index slot variable is always true for the empty slot

    But it works perfectly when order save lists by update is disabled

    So somehow ordering the list slot index when saving?

  • Thanks. Please leave this with me for the moment, and I'll let you know when I have more or need more info.

  • Open up SaveSystem.cs, and replace the SaveNewSaveGame function (around line 681) with the following:

    private void SaveNewSaveGame (bool overwriteLabel = true, string newLabel = "")
    {
        if (foundSaveFiles != null && foundSaveFiles.Count > 0)
        {
            int expectedID = -1;
    
            List<SaveFile> foundSaveFilesOrdered = new List<SaveFile>();
            foreach (SaveFile foundSaveFile in foundSaveFiles)
            {
                foundSaveFilesOrdered.Add (new SaveFile (foundSaveFile));
            }
            foundSaveFilesOrdered.Sort (delegate (SaveFile a, SaveFile b) {return a.saveID.CompareTo (b.saveID);});
    
            for (int i=0; i<foundSaveFilesOrdered.Count; i++)
            {
                if (expectedID != -1 && expectedID != foundSaveFilesOrdered[i].saveID)
                {
                    SaveSaveGame (expectedID, overwriteLabel, newLabel);
                    return;
                }
    
                expectedID = foundSaveFilesOrdered[i].saveID + 1;
            }
    
            // Saves present, but no gap
            int newSaveID = (foundSaveFilesOrdered [foundSaveFilesOrdered.Count-1].saveID+1);
            SaveSaveGame (newSaveID, overwriteLabel, newLabel);
        }
        else
        {
            SaveSaveGame (1, overwriteLabel, newLabel);
        }
    }
    

    Does that solve it?

  • sorry for the late reply, I saw it now

    it appears to be working thanks!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.