Quest HUD Tracker not tracking

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
thomasstp
Posts: 7
Joined: Fri Dec 12, 2014 7:47 pm

Quest HUD Tracker not tracking

Post by thomasstp »

I am not sure if I am missing anything to get the quest HUD tracking to work.



I made a quest and marked it as Trackable. I've verified the conversation script assigned the quest properly with different conversation nodes based on the State condition.



When breakpointing into the code here:

public void UpdateTracker() {

DestroyInstantiatedItems();

foreach (string quest in QuestLog.GetAllQuests()) {

if (QuestLog.IsQuestActive(quest) && QuestLog.IsQuestTrackingEnabled(quest)) {

InstantiateQuestTrack(quest);

}

}

}





QuestLog.IsQuestTrackingEnabled(quest) is evaluating to FALSE.



I've followed this how-to to add the Unity UI prefab to canvas and component to dialogue manager game object.
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Quest HUD Tracker not tracking

Post by Tony Li »

Is the quest's Track field set to true? When Trackable is true, the player can choose to enable or disable tracking in the quest log window. When Track is true, either set through the quest log window or manually by you at design time or runtime, the quest tracker HUD will actually track the quest. If you set it manually, you need to call UpdateTracker() to update the HUD.
thomasstp
Posts: 7
Joined: Fri Dec 12, 2014 7:47 pm

Quest HUD Tracker not tracking

Post by thomasstp »

I was not wanting a quest log window in the UI at all, just merely a quest or two at a time much like current level's objectives.



Which object does "Track" exist on (i.e. to accomplish: "manually by you at design time or runtime") ?



And does it just need to be flagged once at startup or is it per quest?
thomasstp
Posts: 7
Joined: Fri Dec 12, 2014 7:47 pm

Quest HUD Tracker not tracking

Post by thomasstp »

I'm guessing its per quest and this would call does it:





PixelCrushers.DialogueSystem.QuestLog.SetQuestTracking("quest title", true);





Is there any why to trigger that when the conversation Script section sets the State to "active" ?



What event hooks are there?
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Quest HUD Tracker not tracking

Post by Tony Li »

Internally, QuestLog.SetQuestTracking() sets the value of a field named Track. You can bypass SetQuestTracking() and simply set Track to True at design time. Here's how:



When you write your quest, create a field named Track. Set its type to Boolean and its value to True. If you're using the built-in Dialogue Editor, expand All Fields, and then click the "+" all the way to the right of All Fields. This will add a field at the bottom of the list. Set Name, Value, and Type.



You can also add a Track field to the quest template on the Templates tab. This will automatically add it to any new quests. To apply the template to existing quests, click the Template button in the quest's All Fields section.



If you're using Chat Mapper, add it as a custom asset field in the Item table.



When conversations end, they send the message "UpdateTracker" to the Dialogue Manager GameObject. If you put the Quest Tracker component on the Dialogue Manager, it will automatically update the tracker.



That should take care of it.



You can also manually call UpdateTracker whenever you want:

DialogueManager.Instance.SendMessage("UpdateTracker");

(Or use GetComponent() to get the QuestTracker, but I can't seem to get angle brackets to come through properly with this forum software.)



Since you asked about event hooks, you can also set a Quest State Observer. This will call a C# delegate whenever a quest's state changes.


thomasstp
Posts: 7
Joined: Fri Dec 12, 2014 7:47 pm

Quest HUD Tracker not tracking

Post by thomasstp »

Many thanks!



Design time template field was exactly what I was looking for.
Post Reply