Hey there,

I'm having issues loading my quest status on starting a new game. I'm calling ORK.SaveGame.Save(0) and then trying to restore the data with ORK.SaveGame.Load(0) or ORK.SaveGame.LoadFile(0) but it's not updating the quest data properly, it looks like a blank slate when I call questHandler.HasQuests(). The questHandler var is set to ORK.Game.Quests after loading.

I can see the file gets created and I've tried calling quest.SaveGame() on the quest objects when marking them complete (before calling ORK.SaveGame.Save(0)) but it just doesn't seem to be cooperating. Any idea where I'm going wrong?

The other thing is that I've unticked 'Show Question' in both the Save and Load Question Dialogue options in the menu settings but they are still displaying (and the menu appears to be empty too...).
  • Save and Load are the correct functions to call - are the quests restored when you load a save game the regular way (e.g. via start menu)?

    Might be a timing issue, e.g. loading save data before new game would naturally clear any of that data.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Ah, that's probably it. I have the ORK Game Starter in my main menu, then in the main game scene I just have a custom QuestManager object that sets a field to ORK.Game.Quests, I'm then just doing questEngine = ORK.Game.Quests; in Start().

    My quest handling logic is all scripted calls to questEngine.HasQuests() and questEngine.GetQuests(), etc... I tried saving quest and task data in a custom save file today and re-adding the quests on loading with ORK.Game.Quests.AddQuest() but my code's just causing mayhem now trying to add quests and mark tasks complete. :)
  • Let me know if you need any more help with that - but should be fine if you load the data after new game was called :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited May 2023
    Hey, so it looks a bit healthier now, I can load the data but interestingly my task completion code no longer works... This is what I'm doing in my task completion manager:
            var player = ORK.Game.ActiveGroup.Leader;
    print(player.GetName() + " is pleased!");

    var tasks = QuestManager.core.GetQuestTasks(activeQuest);

    if(!tasks[taskNumber].IsFinished() && !QuestManager.core.IsQuestComplete(activeQuest))
    {
    tasks[taskNumber].SetFinished(player, false, false, true, true);
    StartCoroutine(QuestManager.core.DisplayStatusMessage("Task", "Complete"));
    }
    It crashes with a null ref on player. Do I need to do something with ORK.Game.ActiveGroup on save/load?
    Post edited by Astirian on
  • If that's the ORK player, make sure a player is added to the player group first.
    Keep in mind that loading a save game will load all saved data, not just the quests.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks so much, that's fixed it up nicely! I only have one niggling issue remaining though, tasks[taskNumber].SetFinished(player, false, false, true, true)
    This usually works but I can't figure out this one problem, where I have these two active quests (quests 4 and 5) with multiple tasks... When the game loads up, my code picks up the first task completion on quest 5 but it fails to set it as finished, which usually works. I've even delayed the task completion trigger using a coroutine which waits for 7 seconds before attempting to call SetFinished(). The quest itself shows up as active.

    I've also tried calling IsFinished() on the task right afterwards and also in a separate coroutine (that waits for 3 seconds after setting it to finished) but it still comes back false.

    The really interesting bit is if I comment out the trigger for quest 5's first task completion and instead finish the first task of quest 4, it behaves as expected and marks quest 4's task as finished.

    Any idea what I could be doing wrong?
  • Make sure to get the task after loading/starting new game, otherwise you most likely have an old task reference that's no longer used in the running game.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited May 2023
    Yeah, I thought that could be a possibility, I've put in a 6 second delay after the scene loads before trying to complete the task though, and I'm able to retrieve the task name just before calling SetFinished on it... But it still won't do it.

    Funny thing is, it's also stopping the first task of quest 5 from being completable. It's like it locks up something in the back-end.

    Maybe I'll wipe the save and try again.
    Post edited by Astirian on
  • All good, the save must have been corrupted with my tinkering, I cleared the saves and I've done another playthrough. It's now behaving as expected. :)
Sign In or Register to comment.