Forum rules - please read before posting.

Dialogue Speech Setting

Hi Chris,

I encounter some problems about Dialogue Speech Setting.
I tried different kinds of setting but not really what my expect, would you please advise, thanks a lot.
1. Is there any setting can allow the player click to skip the dialogue until the dialogue speech voice finished.
2. Is there any setting can allow the player click to skip the dialogue until the dialogue text scroll finished.

Thanks a lot.

Comments

  • Sorry, I'm not 100% sure what you mean here. You mean you only want to allow skipping while voice is playing and text is scrolling, but not allow once those have both finished?

    It should be possible to allow for this, but I just need to clarify that's what you're after.

  • edited April 17
    Hi Chris,
    Sorry.
    I mean to allow the player can click to skip dialogue after voice and text scrolling are finished.
    (If player not click, that dialogue will keep forever). Is it possible?
    Or I just simply set a Min. time to show dialogue instead?
    Thanks again.
  • You can check Display subtitles forever until user skips it? to display dialogue until it's skipped, but you can still skip while the voice is playing.

    Do you want to prevent skipping while voice is playing / text is scrolling?

  • Thanks for your advise.
    Yes, I tried different kinds of setting avaliable but can't do it.
    I would like to prevent skipping while voice is playing and/or text is scrolling.
    I know it can simply set the min. time, but some dialogue is too long or too short, it does not have a good effect. Thanks again.
  • OK.

    So long as one speech line plays at a time, you should be able to do this by overriding detection of the "SkipSpeech" input, and prevent the input from being registered during the unwanted time.

    It'll take a quick code modification, though, but I'll make the same addition to the next release officially.

    Open up Speech.cs, and paste the following inside it as new functions:

    public bool IsScrolling ()
    {
        if (CanScroll ())
        {
            return (scrollAmount < 1f);
        }
        return false;
    }
    
    public bool IsPlayingAudio ()
    {
        if (hasAudio && audioSource != null)
        {
            return audioSource.isPlaying;
        }
        return false;
    }
    

    Then, go to your Speech Manager and uncheck Can skip with mouse clicks?. This means that you'll then only be able to skip speech with the "SkipSpeech" input - so you'll have to define this in Unity's Input Manager. Map this input to the "mouse 0" and "mouse 1" buttons to have it respond to left/right mouse clicks.

    Finally, you'll need to override the InputMouseButtonDown delegate. Create a new C# script named SkipSpeechConditionally, and paste in the following:

    using UnityEngine;
    using AC;
    
    public class SkipSpeechConditionally : MonoBehaviour
    {
    
        void Start ()
        {
            KickStarter.playerInput.InputGetButtonDownDelegate = CustomGetButtonDown;
        }
    
        private bool CustomGetButtonDown (string buttonName)
        {
            if (buttonName == "SkipSpeech")
            {
                Speech speech = KickStarter.dialog.GetLatestSpeech ();
                if (speech.IsScrolling () && speech.IsPlayingAudio ())
                {
                    return false;
                }
            }
    
            try
            {
                return Input.GetButtonDown (buttonName);
            }
            catch {}
    
            return false;
        }
    
    }
    

    Then attach this to a new GameObject in your scene. If the "SkipSpeech" input is checked for, this script will ignore it if the latest Speech line is scrolling or playing audio.

    For more on the technique of overriding inputs this way, see the Manual's "Remapping inputs" chapter.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.