Page 1 of 1

Problem with dialogue disappearing after starting new conversation

Posted: Tue Nov 21, 2017 6:59 am
by astroimpossible
Hi, I'm having a bit of a problem with dialogue closing after starting a new conversation. To explain the situation: I have a dialogue with an NPC, which ends with a blank dialogue node that runs some script. The script waits a few seconds before setting a new .conversation in the ConversationTrigger, then firing its OnUse (for the same NPC). This is basically so I can have the NPC having a natural pause after finishing a conversation, before starting up a new one.

The problem is, when the new conversation starts, the NPC text vanishes almost immediately: if it has no continue button it'll close on the first line; if it has a continue button, it'll display fine, but the next line without a continue button (e.g. leading to a player response) will disappear. I assume this is something to do with the manager thinking the conversation is still closing?

A workaround I've been using so far is having "SetContinueMode(false)" on the final empty dialogue node in the first conversation, then having the first node in the second conversation use "SetContinueMode(original)". This works fine (the dialogue now doesn't close early), but has the disadvantage that if the second conversation is ever initiated by a different NPC (e.g. by a conversation that doesn't have the SetContinueMode(false) at the end), it results in another unwanted effect, where there's now a continue button before every player response, rather than using the "NotBeforeResponse" option as it should. Again, I can work around this, but I've found it getting ever more complex, and have a feeling there's a much easier solution I'm missing!

Hopefully that explanation makes sense. It's quite a niche issue, so not easy to explain! But any help would be appreciated.

Re: Problem with dialogue disappearing after starting new conversation

Posted: Tue Nov 21, 2017 10:15 am
by Tony Li
Hi,

I'm sure we can come up with a simpler solution without having to fiddle with SetContinueMode.

Could it be an issue with the typewriter effect? To test this, please temporarily remove the typewriter effect from your NPC Subtitle Line. If the problem goes away, please update to version 1.7.7 when it's available. It's being released this week with a timing fix for the typewriter effect.

If that's not the issue, would you please tell me how you're running your script? Is it a Lua script in the blank dialogue node's Script field? Or a C#/UnityScript script method?

Re: Problem with dialogue disappearing after starting new conversation

Posted: Tue Nov 21, 2017 10:51 am
by astroimpossible
Hi Tony, thanks for the response.

I turned off the typewriter effect, but still got the same result (the text appears for a split second, then vanishes). The script is a C# method, fired using a SendMessage in the Sequence field of the node. I've also tried using StartConversation in the method with the same result.

It's also worth noting that having the dialogue end on an empty node that links directly to the second conversation, without any script involved, results in the second conversation not starting at all (or perhaps closing immediately?). I'm guessing in this case the first conversation is closing before the link to the second conversation is followed, but it might be related to the problem I'm having.

Re: Problem with dialogue disappearing after starting new conversation

Posted: Tue Nov 21, 2017 1:26 pm
by Tony Li
Okay, I'm glad we could eliminate the typewriter effect as a suspect.
astroimpossible wrote: Tue Nov 21, 2017 10:51 amIt's also worth noting that having the dialogue end on an empty node that links directly to the second conversation, without any script involved, results in the second conversation not starting at all (or perhaps closing immediately?).
In this scenario, did you link the empty node to the <START> node of the second conversation using a cross-conversation link? If this is the case, then the conversation should continue into the second conversation as if it were all the same conversation. If, however, the <START> node has Conditions that aren't currently true, then the conversation would stop there.

Please feel free to send me an example scene/project. I'll be happy to take a look.

Or, if you prefer, describe what you'd like to happen, and I'll put together a small example scene.

Re: Problem with dialogue disappearing after starting new conversation

Posted: Wed Nov 22, 2017 6:58 am
by astroimpossible
On creating an example project to show the problem, I may have stumbled upon a solution. I set up a dialogue that leads to a second conversation in 3 ways: a direct link to the START of the next; a script that set the trigger to the second conversation then triggered the OnUse; a script that did the same but with a delay. All three used an empty NPC dialogue node, and all three resulted in the second conversation never opening/displaying.

This is slightly different from the results I get in my main project when using the scripts, as in that case the second conversation does open, but the NPC text disappears when it gets to the first node without a continue button. But I'm guessing it derives from the same issue anyway, which is presumably due to use of the empty dialogue nodes.

On to the possible solution! When trying a StartConversation instead of the OnUse in the script, I got an error message saying it couldn't open as dialogue was already open. So I added a StopConversation to the script (before the OnUse), and presto, the second conversation starts fine. Again, I'm presuming this is due to the empty node at the end of the dialogue, with the dialogue not stopping properly due to it. Not sure if this is intended behaviour or not.

I tried the same solution quickly in my main project, and at first test it seems to work (hooray!). I'm not sure if it may prove problematic when I have multiple conversations open at once - e.g. whether the StopConversation ends all open dialogues or not - but for now this seems much better than all the SetContinueMode fiddling :)

I'll send you the test project just in case you wanted to look.

Re: Problem with dialogue disappearing after starting new conversation

Posted: Wed Nov 22, 2017 11:58 am
by Tony Li
Thanks for sending the project. I'll take a look and get back to you today.

The direct link to the START of the next conversation would be the cleanest solution. I suspect you just need to set the empty nodes' Sequence fields. For example, to immediately touch and bypass the second START node, set its Sequence to:
  • Sequence: Continue()
If you want to delay by 2 seconds to simulate a pause:
  • Sequence: Continue()@2
When I have an opportunity to look at the project, I'll see if I can recommend a Sequence like the ones above.

Otherwise, it's possible to stop a specific conversation when running multiple simultaneous conversations. It's not pretty, but it's supported. DialogueManager.Instance.ActiveConversations contains a list of active conversation records. You can search this list for the record whose ConversationModel.FirstState.subtitle.dialogueEntry.,conversationID matches the ID of the conversation you want to stop. Then call that record's ConversationController.Close():

Code: Select all

DialogueManager.Instance.ActiveConversations[x].ConversationController.Close();

Re: Problem with dialogue disappearing after starting new conversation

Posted: Thu Nov 23, 2017 10:13 am
by Tony Li
Posting a quick summary for other readers:

In conversation 1, I set the last node's Sequence to "Continue()@2" to pause 2 seconds. Then I linked it to the first actual node in conversation 2, instead of <START>.

In the upcoming version 1.7.7, the "Link To:" dropdown has been improved so you can actually select Another Conversation -> <START> properly. But it generally works just as well to link to the first node. If you need to branch immediately based on conditions, you can make this first node a "group" node by ticking Is Group. Then it will evaluate its children and run one of its child nodes instead.