Access custom quest fields OR get notified about sub quest completion

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
magalter
Posts: 6
Joined: Fri Sep 26, 2014 7:48 am

Access custom quest fields OR get notified about sub quest completion

Post 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
User avatar
Tony Li
Posts: 20775
Joined: Thu Jul 18, 2013 1:27 pm

Access custom quest fields OR get notified about sub quest completion

Post 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
magalter
Posts: 6
Joined: Fri Sep 26, 2014 7:48 am

Access custom quest fields OR get notified about sub quest completion

Post by magalter »

Oh I see, thanks for your quick reply :)
User avatar
Tony Li
Posts: 20775
Joined: Thu Jul 18, 2013 1:27 pm

Access custom quest fields OR get notified about sub quest completion

Post 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);
Post Reply