Access custom quest fields OR get notified about sub quest completion
Access custom quest fields OR get notified about sub quest completion
Hi, I’m currently working on a project and I’m using your Dialogue System for Unity. I have a question: is it possible to access the custom fields you can define in your quests from C# that would be really helpful. An alternative would be if it was possible for C# scripts to get notified about quests’ AND sub quests’ state changes in a better way because at the moment I see no way to detect which one of a quest’s sub entry quests was completed / failed / etc. when using the quest observing delegate thing of the QuestLog class
Access custom quest fields OR get notified about sub quest completion
Hi,
Yes to both questions. Use DialogueLua.GetQuestField() to access custom fields. You can also set custom Lua observers that will call a C# method when a Lua expression changes, such as:
Quest[myQuest].Entry_1_State == "success"
In the next release, I'll add quest observer support for sub-entries.
DialogueLua: http://www.pixelcrushers.com/dialogue_s ... ripts.html
Lua observers: http://www.pixelcrushers.com/dialogue_s ... aObservers
Yes to both questions. Use DialogueLua.GetQuestField() to access custom fields. You can also set custom Lua observers that will call a C# method when a Lua expression changes, such as:
Quest[myQuest].Entry_1_State == "success"
In the next release, I'll add quest observer support for sub-entries.
DialogueLua: http://www.pixelcrushers.com/dialogue_s ... ripts.html
Lua observers: http://www.pixelcrushers.com/dialogue_s ... aObservers
Access custom quest fields OR get notified about sub quest completion
Oh I see, thanks for your quick reply
Access custom quest fields OR get notified about sub quest completion
Sorry, I just realized that the QuestLog API already lets you add observers for quest entries (subquests). The same method QuestLog.AddQuestStateObserver() is overloaded for this purpose.
For example, if you want to observe a quest state, use:
QuestLog.AddQuestStateObserver("Kill 5 Rats", LuaWatchFrequency.EndOfConversation, myDelegate);
But if you want to observe quest entry (subquest) state #1:
QuestLog.AddQuestStateObserver("Kill 5 Rats", 1, LuaWatchFrequency.EndOfConversation, myDelegate);
For example, if you want to observe a quest state, use:
QuestLog.AddQuestStateObserver("Kill 5 Rats", LuaWatchFrequency.EndOfConversation, myDelegate);
But if you want to observe quest entry (subquest) state #1:
QuestLog.AddQuestStateObserver("Kill 5 Rats", 1, LuaWatchFrequency.EndOfConversation, myDelegate);