Page 1 of 1

Autoplay function question

Posted: Sun Jul 14, 2024 3:02 am
by gaku2_sigehiro
Hello.
We are in the process of implementing skip and auto play based on what was previously discussed on the forum.

<Skip through dialogue on keypress (like Renpy)>
https://www.pixelcrushers.com/phpbb/vie ... 400#p40400

I'm having trouble because when I hold down the ctrl button and exit auto play, and then talk to the player again, it automatically enters auto play.
What kind of processing should I add to cancel the auto play state when the conversation ends?
I am a graphic user and am not good at programming. I can make a simple game, so I'm building it while looking at sample scenes.
I would be happy if you could show me a sample.

Re: Autoplay function question

Posted: Sun Jul 14, 2024 9:28 am
by Tony Li
Hi,

Make a new script named something like MyConversationControl containing this:

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;
public class MyConversationControl : ConversationControl
{
    public override void OnConversationEnd(Transform actor)
    {
        base.OnConversationEnd(actor);
        DialogueManager.displaySettings.subtitleSettings.continueButton = DisplaySettings.SubtitleSettings.ContinueButtonMode.Always;
    }
}
This script is called a subclass because it extends the functionality of the original ConversationControl class. When a conversation ends, it turns off auto play.

Then replace your ConversationControl component with this subclass. You can do it in-place so you don't lost inspector assignments. See here.

Re: Autoplay function question

Posted: Mon Jul 15, 2024 1:23 am
by gaku2_sigehiro
Hello.
After rewriting the script you provided, I was able to confirm that the auto play no longer continued to the next conversation.
However, although auto play no longer works, the part where the continue button setting for the dialogue system controller component was set to "Always" changed to "Never" when the conversation ended by holding down the ctrl key.
I was able to fix that part using the script, so there was no problem.
Thank you for teaching me.

Re: Autoplay function question

Posted: Mon Jul 15, 2024 7:36 am
by Tony Li
Hi,

I'm glad you got it working!