The first indication is when I go talk to the NPC with the altered conversation he doesn't have the new option for the player to select.
The second thing I noticed can be seen in this screenshot:
You can see in this screenshot that the last link isn't connecting properly (although I checked the Link object at least ten times and the originalConversationID and such are set up correctly. Also the Editor draws the new Entry just fine with the connection arrow between the new one and the previous one).
So, to give this some more information, this is the code I use to add a new node to a conversation:
Code: Select all
List<Field> dialogueEntryFields = new List<Field>();
dialogueEntryFields.Add(new Field("Title", string.Empty, FieldType.Text));
dialogueEntryFields.Add(new Field("Pictures", "[]", FieldType.Files));
dialogueEntryFields.Add(new Field("Description", string.Empty, FieldType.Text));
dialogueEntryFields.Add(new Field("Actor", string.Empty, FieldType.Actor));
dialogueEntryFields.Add(new Field("Conversant", string.Empty, FieldType.Actor));
dialogueEntryFields.Add(new Field("Menu Text", string.Empty, FieldType.Text));
dialogueEntryFields.Add(new Field("Dialogue Text", string.Empty, FieldType.Text));
dialogueEntryFields.Add(new Field("Parenthetical", string.Empty, FieldType.Text));
dialogueEntryFields.Add(new Field("Audio Files", "[]", FieldType.Files));
dialogueEntryFields.Add(new Field("Video File", string.Empty, FieldType.Text));
dialogueEntryFields.Add(new Field("Sequence", string.Empty, FieldType.Text));
public static void AddNewExternalConversation(ref Conversation conversation, string externalConversationTitle, int previousNode, bool isPlayerChoice, string dialogueText, string condition, string script) {
var nodes = conversation.dialogueEntries;
Conversation externalConversation = DialogueManager.DatabaseManager.DefaultDatabase.conversations.Find(x => x.Title == externalConversationTitle);
DialogueEntry newEntry = new DialogueEntry();
newEntry.fields = CreateFields(dialogueEntryFields);
newEntry.conversationID = conversation.id;
newEntry.Title = "Empty";
newEntry.id = nodes.Count;
newEntry.DialogueText = dialogueText;
newEntry.conditionsString = condition;
newEntry.userScript = script;
newEntry.ActorID = isPlayerChoice ? 1 : 2;
newEntry.ConversantID = isPlayerChoice ? 2 : 1;
nodes.Add(newEntry);
nodes[newEntry.id].outgoingLinks.Add(new Link(conversation.id, newEntry.id, externalConversation.id, 1));
nodes[previousNode].outgoingLinks.Add(new Link(conversation.id, previousNode, conversation.id, newEntry.id));
DialogueManager.Instance.ResetDatabase(DatabaseResetOptions.KeepAllLoaded);
}
The weird thing is that this actually works if you run this function in the Start() method of one of the Monobehaviors in the game. It starts failing when you're doing it outside of this method, just somewhere in the game when I need it to change. So, I'm not really sure what is going wrong.
Is there something I should do to generate this link properly that I'm not doing right now? Am I missing some piece of code from the database or something?
Thanks in advance.