I want to make a dynamic quest, where the player has to kill certain number of monsters (the number is not arbitrary, may vary depending on the spawner). I use events to track the number of spawned and killed monsters. Now, I want to feed this info to the quest I generate at runtime. The problem is the quest does not appear as tracked, although it is set as such - I don't even know whether it was generated (where to check this?).
My code looks like this:
Code: Select all
void SetKillQuest()
{
QuestLog.AddQuest (mKillQuestName, mKillQuestDesc);
QuestLog.SetQuestState (mKillQuestName, PixelCrushers.DialogueSystem.QuestState.Active);
QuestLog.SetQuestTracking (mKillQuestName, true);
}
void UpdateKillQuest()
{
mKillQuestDesc = "Kill " + (DialogueLua.GetVariable ("NoEnemiesToKill").AsInt - DialogueLua.GetVariable ("NoEnemiesKilled").AsInt) + " enemies.";
QuestLog.SetQuestDescription (mKillQuestName, QuestState.Active, mKillQuestDesc);
if (DialogueLua.GetVariable("NoEnemiesKilled").AsInt >= DialogueLua.GetVariable("NoEnemiesToKill").AsInt )
QuestLog.SetQuestState (mKillQuestName, PixelCrushers.DialogueSystem.QuestState.Success);
}