Hi,
I've been playing around with Dialogue System for Unity for the past few days and been going through the documentation and forums, and I've just got a few questions.
First, I'm working on a game with lots of persistent characters and lots of short conversations. I want some conversations to be repeatable and some to be unique, the player can only see that conversation once. However, I'd rather not hand-create a Variable for every non-repeatable conversation if possible. Is there a way to easily track if a player has seen a conversation before without using SimStatus?
Also, each NPC will have many different conversations (based on day, objectives completed etc), so I was thinking of running through a list of conversations, each with its own condition, and playing the first conversation that works. Does this seem like a good idea, or do you think there's a better way to do this? Is there a way to extend the LuaCondition wizard so that my designer can easily enter conditions as well?
Thank you so much, I'm very much enjoying this dialogue system
Checking to see if player has seen a conversation today
-
- Posts: 2
- Joined: Tue Jan 21, 2020 4:19 pm
Re: Checking to see if player has seen a conversation today
Hi,
Thanks for using the Dialogue System!
However, you can add a custom field to conversations to mark whether it's repeatable or not, since you don't need to save the value of this field in saved games. In the Dialogue Editor's Templates section, expand the Conversations template. Click the "+" to add a new field. Set the title to "Repeatable" and the type to Boolean. When you create a repeatable conversation, click on empty canvas space to inspect the conversation's properties. In the Inspector, expand All Fields and change Repeatable to True.
Add a script to your Dialogue Manager with a few special methods such as:
BTW, remember that you can include forward slashes in conversation titles to group them into submenus. Designers often group conversations by geographic area, or by NPC, or both.
You can also reuse conversations for multiple NPCs. (See: Character GameObject Assignments)
Thanks for using the Dialogue System!
Unless you need to track the status of every single node, SimStatus is probably overkill. You can add variables at runtime. I recommend variables over custom fields in conversations because variables are always included in saved games. You can include conversation fields in saved games, too, but it's all-or-nothing, and there's usually no reason to increase saved game sizes by including all conversation fields.uncommonpotential wrote: ↑Tue Jan 21, 2020 4:34 pmFirst, I'm working on a game with lots of persistent characters and lots of short conversations. I want some conversations to be repeatable and some to be unique, the player can only see that conversation once. However, I'd rather not hand-create a Variable for every non-repeatable conversation if possible. Is there a way to easily track if a player has seen a conversation before without using SimStatus?
However, you can add a custom field to conversations to mark whether it's repeatable or not, since you don't need to save the value of this field in saved games. In the Dialogue Editor's Templates section, expand the Conversations template. Click the "+" to add a new field. Set the title to "Repeatable" and the type to Boolean. When you create a repeatable conversation, click on empty canvas space to inspect the conversation's properties. In the Inspector, expand All Fields and change Repeatable to True.
Add a script to your Dialogue Manager with a few special methods such as:
Code: Select all
using PixelCrushers.DialogueSystem;
...
// Return true if a conversation is repeatable; false if not:
public bool IsConversationRepeatable(string title)
{
return DialogueManager.masterDatabase.GetConversation(title).LookupBool("Repeatable");
}
// When a conversation starts, set a variable to record that it's been played:
void OnConversationStart(Transform actor)
{
DialogueLua.SetVariable("PlayedConversation." + DialogueManager.lastConversationStarted, true);
}
// Return true if the conversation is repeatable or has NOT been played yet:
public bool IsConversationAvailable(string title)
{
return IsConversationRepeatable(title) || DialogueLua.GetVariable("PlayedConversation." + DialogueManager.lastConversationStarted).asBool == false;
}
Yes, that's fine. You can check DialogueManager.ConversationHasValidEntry(title) to see if the Conditions are true on any of the nodes linked from <START>.uncommonpotential wrote: ↑Tue Jan 21, 2020 4:34 pmAlso, each NPC will have many different conversations (based on day, objectives completed etc), so I was thinking of running through a list of conversations, each with its own condition, and playing the first conversation that works. Does this seem like a good idea, or do you think there's a better way to do this?
BTW, remember that you can include forward slashes in conversation titles to group them into submenus. Designers often group conversations by geographic area, or by NPC, or both.
You can also reuse conversations for multiple NPCs. (See: Character GameObject Assignments)
Yes. You can register your own C# methods as Lua functions. (See: Registering Functions) Then create a Custom Lua Function Info asset by right-clicking in the Project view and selecting Create → Pixel Crushers → Dialogue System → Custom Lua Function Info. To make your function appear in the "..." dropdowns for the Conditions field, add an entry for your function to the Condition Functions section.uncommonpotential wrote: ↑Tue Jan 21, 2020 4:34 pmIs there a way to extend the LuaCondition wizard so that my designer can easily enter conditions as well?
-
- Posts: 2
- Joined: Tue Jan 21, 2020 4:19 pm
Re: Checking to see if player has seen a conversation today
Awesome, thank you! Those sound like good solutions, I'm gonna try them out
Re: Checking to see if player has seen a conversation today
Sounds good. If you have any questions about implementing it, just let me know.