Hi,
Quests have two fields related to tracking:
- Trackable: Specifies tracking is allowed to be turned on or off. If Trackable is false, then this quest cannot be tracked.
- Track: Specifies whether to currently track the quest in the quest tracker HUD. (Trackable must also be true in this case.)
In version 1.6.1.1 and earlier, the QuestLog.SetQuestTracking() method does not set Trackable. It only sets Track. I realized recently that, while there is a method to check the value of Trackable (QuestLog.IsQuestTrackingAvailable), there was no equivalent method to set Trackable. I've already added this in the patch available on the Pixel Crushers customer download site.
If you don't want to import the patch, you can add this line to your code:
Code: Select all
void SetKillQuest()
{
QuestLog.AddQuest (mKillQuestName, mKillQuestDesc);
QuestLog.SetQuestState (mKillQuestName, PixelCrushers.DialogueSystem.QuestState.Active);
DialogueLua.SetQuestField (mKillQuestName, "Trackable", true); //<-- ADD THIS.
QuestLog.SetQuestTracking (mKillQuestName, true);
}
If you have a quest log window, you can open it to see if the quest is listed in the Active quests section. If Trackable is not true, it won't have a Track toggle button.
You can also check the internal values of the quest by using a
Lua Console. For example, if your quest is called "Kill 3 Orcs", enter this in the Console:
I like to put counters in quest entries so they appear in the HUD underneath the main quest header. It's just personal preference. If you'd like to do the same, you can add code like this:
Code: Select all
void SetKillQuest()
{
QuestLog.AddQuest (mKillQuestName, mKillQuestDesc);
QuestLog.SetQuestState (mKillQuestName, PixelCrushers.DialogueSystem.QuestState.Active);
QuestLog.SetQuestTracking (mKillQuestName, true);
// ADD THIS:
DialogueLua.SetVariable("NoEnemiesToKill", 3);
DialogueLua.SetVariable("NoEnemiesKilled", 0);
QuestLog.AddQuestEntry(mKillQuestName, "Kill [lua(Variable['NoEnemiesToKill']-Variable['NoEnemiesKilled'])] enemies.");
QuestLog.SetQuestEntryState(mKillQuestName, 1, QuestState.Active);
}
void UpdateKillQuest()
{
// ADD THIS to tell the quest tracker HUD to update its display:
DialogueManager.SendUpdateTracker();
if (DialogueLua.GetVariable("NoEnemiesKilled").AsInt >= DialogueLua.GetVariable("NoEnemiesToKill").AsInt)
QuestLog.SetQuestState(mKillQuestName, PixelCrushers.DialogueSystem.QuestState.Success);
}