Start Conversation by ID

Announcements, support questions, and discussion for the Dialogue System.
zippo227
Posts: 8
Joined: Thu May 03, 2018 6:44 pm

Start Conversation by ID

Post by zippo227 »

I'm new to Dialogue System for Unity. I'm building an online multiplayer game and plan to create multiple conversations for some actors in order to keep the conversations nice and tidy. When my user clicks on / interacts with an NPC, I need to know what conversation to show. I've been searching through the documentation and came across this.
To reduce the amount of data to transmit and store, you can record ID numbers rather than quest/variable name strings.
In order to do that though, I have to run the code below. Is there an option for StartConversation that takes the id instead of the title? Is there any downside or gotcha to using the id instead of the title? I'm not familiar with Lua, so maybe this is just the way we are supposed to do it.

Code: Select all

string conversation = DialogueLua.GetConversationField(1, nameof(Conversation.Title)).AsString;
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Start Conversation by ID

Post by Tony Li »

Hi,

Welcome to the Dialogue System! There's no need to deal with Lua for this. And for the purpose you describe, I don't think you need to worry about IDs, either. The conversation titles will almost certainly be local to the client.

I prefer to keep my logic in one place. Since conversation nodes are already making decisions on where to branch, I'll usually create a primary starting conversation for each NPC. The NPC's Conversation Trigger (or Dialogue System Trigger) will always start this conversation. This conversation will contain cross-conversation links to the NPC's real conversations. By setting Conditions fields, you can specify which link to follow based on the current game state.

To add a cross-conversation link, inspect the originating link. In the Inspector's Link To: dropdown, select "Another Conversation".

BTW, take advantage of using "/" in conversation titles. This will group them in submenus in the Dialogue Editor menu and in dropdowns in the Inspector. For example:
  • Banquo/_Start
  • Banquo/Haunting
  • Banquo/Soliloquy
  • Weird Sisters/_Start
  • Weird Sisters/Cauldron
  • Weird Sisters/Macbeth
  • Weird Sisters/Woods
So I don't leave your original question unanswered, to get a conversation's ID from its title:

Code: Select all

var id = DialogueManager.MasterDatabase.GetConversation("title").id;
To get a conversation's title from its ID:

Code: Select all

var title = DialogueManager.MasterDatabase.GetConversation(id).Title;
zippo227
Posts: 8
Joined: Thu May 03, 2018 6:44 pm

Re: Start Conversation by ID

Post by zippo227 »

That MasterDatabase code is exactly what I was hoping to find. Thank you! I'm happy to start using this system and really looking forward to finding out all it has to offer. The conversation links are also going to be immensely helpful.

I'm trying to build a conversation system similar to ESO or WOW, so I think I have a lot of challenges ahead and will need to use this forum more.

You know how sometimes you have more than one conversation offered to you at a time by an NPC, and some of them are grayed out to represent that you've already read them? Is it possible to do that too with the conversation links setup you mentioned?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Start Conversation by ID

Post by Tony Li »

Absolutely. Inspect the Dialogue Manager, tick Include SimStatus, and set Input Settings > Em Tag For Old Responses to an emphasis tag number:

Image

Then open your dialogue database in the Dialogue Editor window to the Database tab, and set the appearance of that emphasis tag:

Image

You can read more about emphasis tags on the Markup Tags page.

You can read more about SimStatus (but you probably don't need to) on the SimStatus page.

And if you want a little inspiration, a two-man team recently released their WOW-style MMO, Tale of Toast, that uses the Dialogue System. You can see a short clip of it in action here:

zippo227
Posts: 8
Joined: Thu May 03, 2018 6:44 pm

Re: Start Conversation by ID

Post by zippo227 »

Awesome! I'm already really excited by the level of support I'm seeing. Thank you. I'm glad to see that they were able to do it. Gives me inspiration to make mine!
zippo227
Posts: 8
Joined: Thu May 03, 2018 6:44 pm

Re: Start Conversation by ID

Post by zippo227 »

Tony Li wrote: Thu May 03, 2018 8:05 pm I prefer to keep my logic in one place. Since conversation nodes are already making decisions on where to branch, I'll usually create a primary starting conversation for each NPC. The NPC's Conversation Trigger (or Dialogue System Trigger) will always start this conversation. This conversation will contain cross-conversation links to the NPC's real conversations. By setting Conditions fields, you can specify which link to follow based on the current game state.

To add a cross-conversation link, inspect the originating link. In the Inspector's Link To: dropdown, select "Another Conversation".
I've been working on this. What I want to do is link to another conversation's Start node. The problem is that I'm then presented with a blank dilagoue. i.e as a user, I have to click a blank response to get the conversation to go forth.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Start Conversation by ID

Post by Tony Li »

This will happen if your Dialogue Manager's Always Force Response Menu is ticked and the <START> node is assigned to the player.

You can reassign the start node to an NPC, or you can create a group node as the first child of the <START> node and link to the group node. To create a group node, tick the node's Group checkbox. The node will then be treated as a pass-through. The Dialogue System will check its Conditions but otherwise won't stop on it to display dialogue text or use it as a menu choice.
zippo227
Posts: 8
Joined: Thu May 03, 2018 6:44 pm

Re: Start Conversation by ID

Post by zippo227 »

Oh I see. I will try the group node.
zippo227
Posts: 8
Joined: Thu May 03, 2018 6:44 pm

Re: Start Conversation by ID

Post by zippo227 »

OK that worked. Am I doing it wrong by having the NPC be the conversant in my conversations?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Start Conversation by ID

Post by Tony Li »

No, it's normal to have the NPC be the conversant. This is just an edge case where you're cross-linking to the <START> node and the Dialogue Manager's Always Force Response Menu is ticked.
Post Reply