Forum rules - please read before posting.

Load Saved game

edited November 2014 in Technical Q&A
With the new version (btw great improvements there!) I get an error if I use the default method to load the game.

I use (as in the manual):
SaveSystem.LoadGame (15);

And I get this error:
CS1501: No overload for method `LoadGame' takes `1' arguments

I get the same error with the SaveGame command.

How can I solve this?

Comments

  • edited November 2014
    I think the issue is in the LoadGame and SaveGame methods in the SaveSystem.cs.

    They want more variables:
    public static void SaveGame (int elementSlot, int saveID, bool useSaveID)
    and
    public static bool LoadGame (int elementSlot, int saveID, bool useSaveID)

    I tried to create a method to override the SaveSystem.LoadGame and save using just the slot parameter.

    It seems to be working for loading.

    Still I have the issue to save new games, getting an exception.

    The save method with just the slot is the following:

    public static void SaveGame (int elementSlot)
    {
    if (GameObject.FindWithTag (Tags.persistentEngine) && GameObject.FindWithTag (Tags.persistentEngine).GetComponent <SaveSystem>())
    {
    SaveSystem saveSystem = GameObject.FindWithTag (Tags.persistentEngine).GetComponent <SaveSystem>();
    int saveID = saveSystem.foundSaveFiles[elementSlot].ID;
    saveSystem.SaveSaveGame (saveID);
    }
    }
  • The functions were updated to allow for non-sequential save files, where 1 and 3 might exist, but not 2.

    elementSlot relates to the order in the SaveList menu element an existing file is placed.  saveID is the file number.  Setting useSaveID to true will override the elementSlot, so try this:

    SaveSystem.SaveGame (0, 15, true);

    I'll see if I can add the simpler functions back in as alternatives for 1.41.
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.