Getting Node ID through code
Getting Node ID through code
Hi I was wondering how you get a conversation nodes id through C# code. I need to be able to access these to work in my audio. Also, is there a way to enter a conversation and jump right to a specific node and skip the ones above it?
Re: Getting Node ID through code
Hi,
The conversation ID is 12, and the dialogue entry ID is 34.
You can get to any dialogue entry through DialogueManager.MasterDatabase. But I'm guessing you want the current line's IDs. The current dialogue entry is DialogueManager.CurrentConversationState.subtitle.dialogueEntry. So use this:
If you're making a subclass of your dialogue UI class, such as UnityUIDialogueUI, the ShowSubtitle() method also gives you a reference to the subtitle.
You might also find entrytags helpful for your audio. In code, you can use DialogueManager.MasterDatabase.GetEntrytag().
Personally, I don't like working with IDs directly. They're fine, they're stable and reliable, but I feel like the logic is more transparent if I put it inside the dialogue tree's Conditions and Script fields instead. For example, in the Feature Demo, Private Hart's conversation jumps to different sections of the dialogue tree by using Conditions on all the dialogue entries that link from the START entry.
Every conversation has a conversation ID, and every dialogue entry in the conversation has a dialogue entry ID. If you set the Dialogue Manager's Debug Level to Info, you'll see lines like this:EWalk13 wrote:Hi I was wondering how you get a conversation nodes id through C# code. I need to be able to access these to work in my audio.
Code: Select all
Dialogue System: Add Link (Player): ID=12:34 'Hello, world.'
You can get to any dialogue entry through DialogueManager.MasterDatabase. But I'm guessing you want the current line's IDs. The current dialogue entry is DialogueManager.CurrentConversationState.subtitle.dialogueEntry. So use this:
Code: Select all
var dialogueEntry = DialogueManager.CurrentConversationState.subtitle.dialogueEntry;
int conversationID = dialogueEntry.conversationID; //<-- This is the conversation ID.
int dialogueEntryID = dialogueEntry.id; //<-- This is the dialogue entry ID.
You might also find entrytags helpful for your audio. In code, you can use DialogueManager.MasterDatabase.GetEntrytag().
Pass the dialogue entry ID to DialogueManager.StartConversation():EWalk13 wrote:Also, is there a way to enter a conversation and jump right to a specific node and skip the ones above it?
Code: Select all
DialogueManager.StartConversation("Title", actor, conversant, dialogueEntryID);
Re: Getting Node ID through code
Thanks! This is just the information I needed!