Override OnConversationStart with MultiLineBarks

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Sapidus3
Posts: 6
Joined: Fri Sep 10, 2021 2:31 pm

Override OnConversationStart with MultiLineBarks

Post by Sapidus3 »

So from other form posts, I figured out how to use the override UI to set up a bark with multiple lines.

However, since it requires setting it as a conversation instead of a bark it is calling OnConversationStart.

I have been disabling/reenabling my player controller using the event system. I saw how to override continue button functionality inside a conversation, but is there anything I can do to disable calling OnConversationStart for certain conversations / conversation triggers?

Or is there an alternate approach you would recommend?

Thanks!
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Override OnConversationStart with MultiLineBarks

Post by Tony Li »

Hi,

Assuming that only NPCs bark, I recommend running the multi-line barks as conversations that don't involve the player. This way the player GameObject won't receive OnConversationStart/OnConversationEnd messages.

Then put the Dialogue System Events component on the player GameObject, and configure OnConversationStart/OnConversationEnd to disable and re-enable the player controller.

Otherwise, if the player must be involved in the bark conversation, you can add a custom field to the conversation that indicates whether the player controller should be disabled or not. In this case, instead of using Dialogue System Eents, add a script to the player that has an OnConversationStart() method. In this method, check the field. Example:

Code: Select all

void OnConversationStart(Transform actor)
{
    var conversation = DialogueManager.masterDatabase.GetConversation(DialogueManager.lastConversationStarted);
    if (conversation.LookupBool("Is Bark Conversation") == false)
    {
        // Your code here to disable the player controller.
    }
}
Sapidus3
Posts: 6
Joined: Fri Sep 10, 2021 2:31 pm

Re: Override OnConversationStart with MultiLineBarks

Post by Sapidus3 »

Putting an event system on the player is a really simple solution. Mentally I just defaulted to it needing to be on the manager.

The custom field approach is also good for me to keep in mind.

Thanks again for the fast response!
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Override OnConversationStart with MultiLineBarks

Post by Tony Li »

Glad to help!
Post Reply