Autoplay function question

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
gaku2_sigehiro
Posts: 36
Joined: Sun Jul 14, 2024 2:35 am

Autoplay function question

Post 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.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Autoplay function question

Post 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.
gaku2_sigehiro
Posts: 36
Joined: Sun Jul 14, 2024 2:35 am

Re: Autoplay function question

Post 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.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Autoplay function question

Post by Tony Li »

Hi,

I'm glad you got it working!
Post Reply