Quest Tag Dictionary for Quests starting in QuestJournal

Announcements, support questions, and discussion for Quest Machine.
Post Reply
fbit
Posts: 30
Joined: Fri Nov 30, 2018 9:30 am

Quest Tag Dictionary for Quests starting in QuestJournal

Post by fbit »

Hello again!

I tried to start my game with a hand-written quest that has been assigned to the quester's journal in the editor, but QuestTags (like "{QUESTGIVER}") are not replaced. If I hand the quest from the questgiver, this is not an issue.

Do I have to use SaveSystems in order to call ApplyData from QuestJournal.cs?

Code: Select all

public override void ApplyData(string data)
{
base.ApplyData(data);
RepaintUIs();
}

As far as I can tell, this method calls the function AddQuest which will initialize the tagDictionary for the quest.

Code: Select all

/// <summary>
/// Adds a quest to this quest giver's list.
/// </summary>
/// <param name="quest"></param>
public override Quest AddQuest(Quest quest)
{
if (quest == null) return null;
var instance = base.AddQuest(quest);
instance.AssignQuestGiver(myQuestGiverTextInfo);
QuestMachineMessages.RefreshUIs(this);
return instance;
}

Or is it even possible to start a game with a quest that has already been assigned to the quester's journal?

Kind regards,
Franca
User avatar
Tony Li
Posts: 22106
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest Tag Dictionary for Quests starting in QuestJournal

Post by Tony Li »

Hi Franca,

Yes, you can start a game with a quest that's assigned to the player's quest journal. If you have assigned the quest's Quest Giver ID field, then {QUESTGIVERID} will be set.

However, other tags will not be set because that information is typically stored on the quest giver, such as the quest giver's name and text table. To associate this information with the quest, you must call the quest's AssignQuestGiver() method. It accepts a QuestParticipantTextInfo object.

Here's an example:

Code: Select all

var playerJournal = FindObjectOfType<QuestJournal>();
var quest = playerJournal.FindQuest("Some Quest");

// For this example, we assume the quest giver GameObject is named the same as its ID:
var giver = GameObject.Find(quest.questGiverID.value);

quest.AssignQuestGiver(giver.myQuestGiverTextInfo);
fbit
Posts: 30
Joined: Fri Nov 30, 2018 9:30 am

Re: Quest Tag Dictionary for Quests starting in QuestJournal

Post by fbit »

Hi Tony,
Tony Li wrote: Wed Jan 30, 2019 11:28 am However, other tags will not be set because that information is typically stored on the quest giver, such as the quest giver's name and text table. To associate this information with the quest, you must call the quest's AssignQuestGiver() method. It accepts a QuestParticipantTextInfo object.
Alright, thanks for that information!

Kind regards,
Franca
Post Reply