Problem with adding new quests

Announcements, support questions, and discussion for Quest Machine.
zebialowicz.s
Posts: 9
Joined: Sun Jul 28, 2024 5:26 am

Re: Problem with adding new quests

Post by zebialowicz.s »

I was able to repro that on fresh project.
I sent the project to you (on support e-mail address) :)
User avatar
Tony Li
Posts: 22871
Joined: Thu Jul 18, 2013 1:27 pm

Re: Problem with adding new quests

Post by Tony Li »

Hi,

Thanks for sending the reproduction project. I don't think there's any bug. Here are two issues:

1. If the save data for the player's QuestJournal has Quest_Old_Questline, Quest Machine must have access to Quest_Old_Questline. In other words, add Quest_Old_Questline to the New Quest Line quest database. (Quest Machine will log an error otherwise to tell you this.)

2. It's a timing issue with your StartupQuestGiver script. When you load a saved game that has Quest_Old_Questline, it happens like this:
  • Save system loads scene.
  • Start methods run. Gives New_Quest_1 to player's QuestJournal.
  • Save system applies data, setting player's QuestJournal to Quest_Old_Questline. (Assuming New Quest Line quest database contains Quest_Old_Questline.)
This means the player's QuestJournal only ends up with Quest_Old_Questline.

To fix this in your StartupQuestGiver script, change the Start() method to:

Code: Select all

public override void Start()
{
    base.Start();
    StartCoroutine(GiveAllCoroutine()); // Wait until save data has been applied.
}

private IEnumerator GiveAllCoroutine()
{
    yield return null; // Assumes Frames To Wait Before Apply Data is 0. If not, wait more frames.
    m_journal = FindFirstObjectByType<QuestJournal>();
    GiveAllQuestsToQuester(m_journal);
}

To recap the steps:

1. Add your old quest(s) to the new quest database so old saved games can access them.

2. Make the Start() method change above.
Post Reply