Page 1 of 1

Get all Quests

Posted: Mon Jan 23, 2023 3:20 pm
by JamesTFreaknKirk
Hello! :D

I've got a question regarding the QuestLog.GetAllQuests(),

context: I've got a day/night cycle in my game, and at the beginning of every new day, I'd like my time manager to cycle through all quests in the dialogue system, check if its in the group "repeatable", and then if those quests are not currently active, set them to unassigned, so the NPC can ask for them again essentially,

but looking at the definition of the function, this function returns only active quests? so if they're unassigned or completed
these won't show up on the Get all quests method? is there another way I could get all quests?

Code: Select all

    private void resetRepeatableMissions() {

        List<string> alllQuests = new List<string>();
        alllQuests.AddRange( QuestLog.GetAllQuests());


        for (int i = 0; i < alllQuests.Count; i++)
        {
            print(alllQuests[i]);
        }


    }
I've tested a bit of code for debugging purposes, where I print the results of this function, and I get nothing (maybe I'm not referencing the right quest log? how would I ensure I'm referencing the correct quest log?)

Thanks so much again for your help

Re: Get all Quests

Posted: Mon Jan 23, 2023 4:06 pm
by Tony Li
Hi,

QuestLog.GetAllQuests() has multiple variations.
  • QuestLog.GetAllQuests() without any parameters returns a list of all active quests, sorted by Name.
  • QuestLog.GetAllQuests(quest-state-mask) returns a list of quests of the specified state(s), sorted by Name.
  • QuestLog.GetAllQuests(quest-state-mask, sortByName) lets you specify whether to sort by Name.
  • QuestLog.GetAllQuests(quest-state-mask, sortByName, group) only returns quests within a specified group.
Example:

Code: Select all

string[] quests = QuestLog.GetAllQuests(QuestState.Success | QuestState.Failure | QuestState.Abandoned, true, "repeatable");