How to end a conversation via script
How to end a conversation via script
Hey,
First of all I want to congratulate you guys on the product, its amazing.
Now my problem is;
I have an open NPC dialogue panel (so its not a finished conversation) and I would like to end it via script. I've looked around through the code and I've only managed to hide it using
PixelCrushers.DialogueSystem.DialogueManager.instance.DialogueUI.Close();
but that does not update the status of the conversation and when I am trying to trigger it again I get the warning "Another conversation is already active..." of course . Sorry if this was already answered but I could not find a similar post.
First of all I want to congratulate you guys on the product, its amazing.
Now my problem is;
I have an open NPC dialogue panel (so its not a finished conversation) and I would like to end it via script. I've looked around through the code and I've only managed to hide it using
PixelCrushers.DialogueSystem.DialogueManager.instance.DialogueUI.Close();
but that does not update the status of the conversation and when I am trying to trigger it again I get the warning "Another conversation is already active..." of course . Sorry if this was already answered but I could not find a similar post.
Re: How to end a conversation via script
Hi,
Use DialogueManager.StopConversation(). (Most of the main Dialogue System functionality can be accessed through the DialogueManager class.)
Use DialogueManager.StopConversation(). (Most of the main Dialogue System functionality can be accessed through the DialogueManager class.)
Re: How to end a conversation via script
Works like a charm, thanks for the info
Re: How to end a conversation via script
Glad to help!
Re: How to end a conversation via script
Sorry to hijack this thread, but it's a similar question.
I want to use LoadLevel(x) from a conversation node. It gives me an error saying that there is already a conversation going on.
Both scenes have conversation triggered on OnStart(). How do you end the first conversation? I tried allowing multiple conversations but it's a mess, I just want to end the first one.
Thanks!
Update: I removed the sequence command LoadLevel(x) from my conversation nodes. Then added Dialogue System Trigger component on my NPC gameobject to trigger "On Conversation End" and play the LoadLevel sequence command there.
It's working fine, but using LoadLevel directly from a conversation node looks way better, specially when loading a different scene can be used in a middle of a conversation (depending on the user selection).
Maybe i'm doing something wrong?
I want to use LoadLevel(x) from a conversation node. It gives me an error saying that there is already a conversation going on.
Both scenes have conversation triggered on OnStart(). How do you end the first conversation? I tried allowing multiple conversations but it's a mess, I just want to end the first one.
Thanks!
Update: I removed the sequence command LoadLevel(x) from my conversation nodes. Then added Dialogue System Trigger component on my NPC gameobject to trigger "On Conversation End" and play the LoadLevel sequence command there.
It's working fine, but using LoadLevel directly from a conversation node looks way better, specially when loading a different scene can be used in a middle of a conversation (depending on the user selection).
Maybe i'm doing something wrong?
Last edited by undecode on Mon May 04, 2020 3:02 pm, edited 1 time in total.
Re: How to end a conversation via script
Hi,
You'll want to end the conversation in the first scene, then change scenes, then allow the conversation in the second scene to start when the scene starts.
To do this, don't use the LoadLevel() sequencer command in the first conversation. Instead, add a Dialogue System Trigger to the conversation's actor or conversant. Set it to OnConversationEnd. Select Add Action > Play Sequence, and put the LoadLevel() sequencer command there.
You'll want to end the conversation in the first scene, then change scenes, then allow the conversation in the second scene to start when the scene starts.
To do this, don't use the LoadLevel() sequencer command in the first conversation. Instead, add a Dialogue System Trigger to the conversation's actor or conversant. Set it to OnConversationEnd. Select Add Action > Play Sequence, and put the LoadLevel() sequencer command there.
Re: How to end a conversation via script
Hi Tony.
Haha exactly what I tried to do right after I posted my question, nice timing.
Please check the update part, this looks good but what if I want to change to a different scene during the middle of a conversation? I don't need to save the progress from the first conversation, but would like the possibility to change to a nother scene from any conversation node.
Thanks!
Haha exactly what I tried to do right after I posted my question, nice timing.
Please check the update part, this looks good but what if I want to change to a different scene during the middle of a conversation? I don't need to save the progress from the first conversation, but would like the possibility to change to a nother scene from any conversation node.
Thanks!
Re: How to end a conversation via script
It's fine to change scenes in the middle of a conversation. There are some visual novel style games that run a single conversation throughout the entire game, but change scenes multiple times during that conversation.
Just be aware that if a Dialogue System Trigger in the new scene is set to OnStart, it won't start unless the Dialogue Manager's Allow Simultaneous Conversations checkbox is ticked.
Just be aware that if a Dialogue System Trigger in the new scene is set to OnStart, it won't start unless the Dialogue Manager's Allow Simultaneous Conversations checkbox is ticked.
Re: How to end a conversation via script
I'm having issues trying to use LoadLevel directly from a conversation node. Even using allowing multiple conversations, sometimes the 2nd conversation is played inmediately (like 10 nodes in less than 1 second, no continue button), sometimes it gets stuck in the second node and other times I get the "another conversation is active" error.
It is probably possible to do it so, but I think i'll stick to changing scenes only at the end of a conversation. After giving it some thought, a scene change should be a conversation end (one conversation branch could be shorter, other more detailed).
So for now i'm setting a variable (CurrentChapter) and changing it in the previous node than the End one. And NPC has triggers checking a condition for this variable and playing sequence accordingly.
It is probably possible to do it so, but I think i'll stick to changing scenes only at the end of a conversation. After giving it some thought, a scene change should be a conversation end (one conversation branch could be shorter, other more detailed).
So for now i'm setting a variable (CurrentChapter) and changing it in the previous node than the End one. And NPC has triggers checking a condition for this variable and playing sequence accordingly.
Re: How to end a conversation via script
Sounds good. That's a good way to handle it because it partitions the responsibility:
Conversation 1 // scene change // Conversation 2
If you ever get back into a situation where you need to change scenes in the middle of a conversation and it's causing an issue, let me know. It's totally supported in the Dialogue System, so it's just a matter of identifying what's going on in your setup.
Conversation 1 // scene change // Conversation 2
If you ever get back into a situation where you need to change scenes in the middle of a conversation and it's causing an issue, let me know. It's totally supported in the Dialogue System, so it's just a matter of identifying what's going on in your setup.