Loading quests from quest database during runtime
Posted: Mon Mar 14, 2022 9:29 am
Hi Tony,
I have a question regarding loading quests to the journal from the quest database.
I have two quest databases in my scene. Each database contains unique quests.
Depending on the situation in my scene, I would like to load either of the quests from these two databases into my journal.
I already tried the below code, but it doesn't seem to work. I could be wrong somewhere, could you please suggest on a way to resolve this issue?
I have a question regarding loading quests to the journal from the quest database.
I have two quest databases in my scene. Each database contains unique quests.
Depending on the situation in my scene, I would like to load either of the quests from these two databases into my journal.
I already tried the below code, but it doesn't seem to work. I could be wrong somewhere, could you please suggest on a way to resolve this issue?
Code: Select all
public void LoadQuests(QuestDatabase database) {
var journal = QuestMachine.GetQuestJournal();
// clear any existing quests
journal.questList.Clear();
// add quests from the database
foreach (var questAsset in questDatabase.questAssets) {
journal.AddQuest(questAsset);
}
}