Quests outside of conversations

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Enki
Posts: 1
Joined: Fri Jan 09, 2015 2:43 pm

Quests outside of conversations

Post by Enki »

So one of my game modes could really benefit from quests, but without any dialogues other than some alerts.



DialogueManager.AddLuaObserver("Variable['Credits']", LuaWatchFrequency.EveryDialogueEntry, OnCreditsChanged);



is mentioned in the docs, as well as possibly



QuestLog.AddQuestStateObserver("Kill 5 Rats", LuaWatchFrequency.EveryDialogueEntry, OnQuestStateChanged);



Neither of which are recognized as valid methods. I also see a component pictured, ConditionalObserver, but again, it doesn't appear to be present. Am I missing something?
User avatar
Tony Li
Posts: 22098
Joined: Thu Jul 18, 2013 1:27 pm

Quests outside of conversations

Post by Tony Li »

To use Dialogue System methods, make sure to include the PixelCrushers.DialogueSystem namespace:

using PixelCrushers.DialogueSystem;



public class MyClass : MonoBehaviour {



void Start() {

DialogueManager.AddLuaObserver(

"Variable['Credits']",

LuaWatchFrequency.EveryDialogueEntry,

OnCreditsChanged);

}



void OnCreditsChanged(LuaWatchItem luaWatchItem, Lua.Result newValue) {

Debug.Log("Number of credits changed to: " + newValue.AsInt);

}

}

You mentioned that these scene(s) will not use conversations. In this case, don't set the frequency to EveryDialogueEntry. Since you won't run conversations, you won't run any dialogue entries, so the observers will never trigger. Instead, set it to EveryUpdate or -- better yet -- use ConditionObserver.



ConditionObserver is new in v1.4.2, which is on the Pixel Crushers customer download site but not yet on the Asset Store. If you'd like to download it, please email your Asset Store invoice number to tony (at) pixelcrushers.com. ConditionObserver lets you set a more reasonable update interval, such as once every second, and also perform most if not all activity without having to write any scripts.


Post Reply