Page 1 of 1

Access custom quest fields OR get notified about sub quest completion

Posted: Fri Sep 26, 2014 3:55 am
by magalter
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

Posted: Sat Sep 27, 2014 11:23 pm
by Tony Li
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

Access custom quest fields OR get notified about sub quest completion

Posted: Sun Sep 28, 2014 10:28 pm
by magalter
Oh I see, thanks for your quick reply :)

Access custom quest fields OR get notified about sub quest completion

Posted: Fri Oct 10, 2014 2:51 pm
by Tony Li
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);