Hi, I would like to close a conversation via script conditions. I'm wondering what the best way to do that is.
I know that I can make a direct reference to the DialogueSystemController and call StopConversation but I'm wondering if there is a way to reference that without doing some painful FindObjectOfType() call.
I'm trying to recreate the StopConversationIfTooFar script because I can't get that one to work so if I'm missing something there then I might be able to make that work. I put it on my main character and it doesn't close the conversations when you get too far.
Thanks,
Mike
Closing a conversation from a script
Re: Closing a conversation from a script
Hi,
Dialogue System: Starting conversation 'XXX' with actor=AAA and conversant=BBB.
If the StopConversationIfTooFar script is on AAA or BBB, then it will monitor the distance between them.
Similar functionality is built into the Dialogue System Trigger. It assumes that the main character (player) is assigned as the Dialogue System Trigger's Conversation Actor. It monitors the distance between the Conversation Actor and the Dialogue System Trigger.
Use DialogueManager.StopConversation(). It's a static method. You don't need to find any components.EHG Mike Weicker wrote: ↑Mon Jul 22, 2019 6:06 pmHi, I would like to close a conversation via script conditions. I'm wondering what the best way to do that is.
Are the participants assigned as you intend? If you temporarily set the Dialogue Manager's Other Settings > Debug Level to Info, it will log a line like this when starting a conversation:EHG Mike Weicker wrote: ↑Mon Jul 22, 2019 6:06 pmI'm trying to recreate the StopConversationIfTooFar script because I can't get that one to work so if I'm missing something there then I might be able to make that work. I put it on my main character and it doesn't close the conversations when you get too far.
Dialogue System: Starting conversation 'XXX' with actor=AAA and conversant=BBB.
If the StopConversationIfTooFar script is on AAA or BBB, then it will monitor the distance between them.
Similar functionality is built into the Dialogue System Trigger. It assumes that the main character (player) is assigned as the Dialogue System Trigger's Conversation Actor. It monitors the distance between the Conversation Actor and the Dialogue System Trigger.
-
- Posts: 8
- Joined: Mon Jul 22, 2019 6:02 pm
Re: Closing a conversation from a script
Thanks, I was hoping it would be that simple, I did try looking in the docs
Re: Closing a conversation from a script
Happy to help!
-
- Posts: 8
- Joined: Mon Jul 22, 2019 6:02 pm
Re: Closing a conversation from a script
I figured out why I couldn't use that in the first place. We have another script called DialogueManager which was interfering with it but didn't cause an error.
Re: Closing a conversation from a script
Got it. BTW, the Dialogue System's DialogueManager is in the namespace PixelCrushers.DialogueSystem. So if you ever need to disambiguate, you can specify PixelCrushers.DialogueSystem.DialogueManager.