Auto Play and Skip All buttons

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 22161
Joined: Thu Jul 18, 2013 1:27 pm

Re: Auto Play and Skip All buttons

Post by Tony Li »

Hi,

That doesn't make any sense. You're defining it here:

Code: Select all

public class CustomDialogueSystemTrigger : DialogueSystemTrigger
    {
        public static DialogueSystemTrigger LastInteractedDialogueSystemTrigger = null;
mac
Posts: 81
Joined: Sat Aug 22, 2020 7:54 pm

Re: Auto Play and Skip All buttons

Post by mac »

Well, I'm not sure what to do now, I did everything like you said and the script doesn't want to compile, the sequencer cant find 'LastInteractedSystemTrigger' no matter what.

I also tried adding this to the Custom Dialogue System Trigger for testing:

Code: Select all

public static GameObject TriggerObj;
Inside the sequencer (Awake method):

Code: Select all

CustomDialogueSystemTrigger dialogueTrigger = FindObjectOfType<CustomDialogueSystemTrigger>();

dialogueTrigger.TriggerObj.SetActive(true);
And still could not reference it on the Sequencer. But the error now is different:
error CS0176: Member 'CustomDialogueSystemTrigger.TriggerObj' cannot be accessed with an instance reference; qualify it with a type name instead
Not sure if this helps.
User avatar
Tony Li
Posts: 22161
Joined: Thu Jul 18, 2013 1:27 pm

Re: Auto Play and Skip All buttons

Post by Tony Li »

Hi,

It looks like you just had a typo (which I then copied when I copied your code into my replies).

Here are scripts that I just tested:

Code: Select all

using UnityEngine;

namespace PixelCrushers.DialogueSystem
{
    public class CustomDialogueSystemTrigger : DialogueSystemTrigger
    {
        public static DialogueSystemTrigger LastInteractedDialogueSystemTrigger = null;

        protected override void DoConversationAction(Transform actor)
        {
            Debug.Log("Recording LastInteractedDialogueSystemTrigger = " + this);
            LastInteractedDialogueSystemTrigger = this;
            base.DoConversationAction(actor);
        }
    }
}

Code: Select all

using UnityEngine;

namespace PixelCrushers.DialogueSystem.SequencerCommands
{
    public class SequencerCommandReenableDialogue : SequencerCommand
    {
        public void Awake()
        {
            Debug.Log("Re-enabling: " + CustomDialogueSystemTrigger.LastInteractedDialogueSystemTrigger, CustomDialogueSystemTrigger.LastInteractedDialogueSystemTrigger);
            if (CustomDialogueSystemTrigger.LastInteractedDialogueSystemTrigger != null)
            {
                CustomDialogueSystemTrigger.LastInteractedDialogueSystemTrigger.enabled = true;
            }
            Stop();
        }
    }
}
mac
Posts: 81
Joined: Sat Aug 22, 2020 7:54 pm

Re: Auto Play and Skip All buttons

Post by mac »

Awesome, the compile error is gone, but I noticed the 'DoConversationAction' method never gets called currently (attached a screenshot of what I get on console after the conversation is done and I execute the sequencer command, as you will see, only the sequencer Debug.Log runs), do I have to call the DoConversationAction along where I start the dialogue?

This is currently how I start the dialogue:

Code: Select all

private void OnTriggerStay(Collider other)
    {
        if (other.tag == "Player")
        {
            if (Input.GetKeyDown(KeyCode.F))
            {
                print("PRESSED");
                var conversation = dialogueTrigger.conversation;
                var actor = dialogueTrigger.conversationActor;
                var conversant = dialogueTrigger.conversationConversant;
                DialogueManager.StartConversation(conversation, actor, conversant);
                interactSign.isInteractable = false;

                disableDialogueTrigger();
            }

            if (dialogueTrigger.enabled)
            {
                interactSign.isInteractable = true;
            }
        }
    }
Attachments
Screenshot_1.png
Screenshot_1.png (4.06 KiB) Viewed 1406 times
User avatar
Tony Li
Posts: 22161
Joined: Thu Jul 18, 2013 1:27 pm

Re: Auto Play and Skip All buttons

Post by Tony Li »

Hi,

You're starting a conversation manually by calling DialogueManager.StartConversation(). Do you want to use the Dialogue System Trigger instead? If so, change these line:

Code: Select all

var conversation = dialogueTrigger.conversation;
var actor = dialogueTrigger.conversationActor;
var conversant = dialogueTrigger.conversationConversant;
DialogueManager.StartConversation(conversation, actor, conversant);
to this:

Code: Select all

dialogueTrigger.OnUse();
mac
Posts: 81
Joined: Sat Aug 22, 2020 7:54 pm

Re: Auto Play and Skip All buttons

Post by mac »

Awesome, everything works like inteded now! Thank you again Tony!
User avatar
Tony Li
Posts: 22161
Joined: Thu Jul 18, 2013 1:27 pm

Re: Auto Play and Skip All buttons

Post by Tony Li »

Whew! Glad to help. :-)
mac
Posts: 81
Joined: Sat Aug 22, 2020 7:54 pm

Re: Auto Play and Skip All buttons

Post by mac »

So Tony, I've been playing around with Skip All and Auto Play a bit and they seem clunky:

Both buttons can't be clicked during dialogue when the dialogue starts with a line, I'm only able to click the buttons when a response panel pops up.

Turning Auto Play on breaks focus/unfocus portrait sequences.

I can't see a clear pattern or tell you whats causing those issues but they are pretty self explanatory, I compiled a small example showing those problems, you can download this example and check how they behave for yourself here:

https://drive.google.com/drive/folders/ ... sp=sharing
User avatar
Tony Li
Posts: 22161
Joined: Thu Jul 18, 2013 1:27 pm

Re: Auto Play and Skip All buttons

Post by Tony Li »

Hi,

In that build, neither Auto Play nor Skip All seem to be hooked up correctly. They both appear to behave like the continue button.

Did you hook up Auto Play to ConversationControl.AutoPlay, and Skip All to Conversation.SkipAll?

Take a look at the Visual Novel Starter Framework on the Dialogue System Extras page for an example.
mac
Posts: 81
Joined: Sat Aug 22, 2020 7:54 pm

Re: Auto Play and Skip All buttons

Post by mac »

I have found the reason why Skip All and Auto Play didn't respond properly and acted as the continue button, the problem with focus/unfocus animation breaking are still present, but I will leave that for another time;
I have a small question, how can I reset a dialogue condition? For instance I want to set a dialogue condition back to false when I go back to the game main menu.
Post Reply