Get all Quests

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
JamesTFreaknKirk
Posts: 13
Joined: Mon Jan 16, 2023 9:44 am

Get all Quests

Post 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
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Get all Quests

Post 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");
Post Reply