Yes. But I may be misunderstanding what you need. I'm going to assume that you don't need separate states "success" and "done". I'll describe how to do what you described without scripting first. Then I'll describe how to do the same thing with scripting.
Define a quest in the
Quests section of your dialogue database.
Let's say you use a conversation to turn in the quest. In the dialogue entry node, use the
Script field's "..." dropdown wizard to select the quest and the "success" state. This will set the quest to "success" when the node plays.
Add two
Dialogue System Triggers to the door.
Set the first trigger's
Condition to require that the quest state is "active". (I'm assuming in this example that the quest can either be active or successful.) Add, say, a bark action that barks "Door is locked."
Set the second trigger's
Condition to require that the quest state is "success". Add some actions to open the door, or load a new scene, or whatever. (The door in the Dialogue System's demo uses an action to switch between DemoScene1 and DemoScene2.)
---
To set a quest state in code, use
QuestLog.
SetQuestState():
Code: Select all
using PixelCrushers.DialogueSystem;
...
QuestLog.SetQuestState("Some Quest", QuestState.Success);
To check the current quest state, use QuestLog.
GetQuestState():
Code: Select all
if (QuestLog.GetQuestState("Some Quest") == QuestState.Success) {
// open door.
} else {
// show message that door is still locked.
}
---
Now if you really do need separate "done" and "success" states, technically you can do that. The Dialogue System treats the string "success" and "done" both as successfully-completed quest states.
To set a quest state using a string:
Code: Select all
QuestLog.SetQuestState("Some Quest", "success");
// or
QuestLog.SetQuestState("Some Quest", "done");
To check it, use CurrentQuestState() instead of GetQuestState(). (CurrentQuestState returns the string value.)
Code: Select all
if (QuestLog.CurrentQuestState("Some Quest") == "done") {
// open door.
}