Forum rules - please read before posting.

[Feature request] Using speech tokens with text even if not using text scrolling

I liked the idea of not having a seperate "Enigne: Wait" action between two "Dialogue: Play speech" actions to make a character wait a short amount of time before continuing its text by using the "[wait: x]" speech token in-line. And the possibilty of setting the expressions in-line by using "[expression:Name]" is such a great idea and a huge time saver. But it is very sad that theses things only work with scrolling texts. At first I thought this must be a bug but by reading the manual carefully I discovered that this is expected bahaviour. It would be so great to be able to use these systems with non-scrolling text. I know that this only makes sense with using the built-in lip-synching system, because it wouldn't make any difference when only a subtitle is displayed and the character is not using lip-synching.

Regards
Marcus

Comments

  • Tokens should still be processed regardless of scrolling - though they'll be processed instantly in this case. What's your AC version?

    If you're using the latest release, share images of your Speech Manager as well as details of a typical line text and its behaviour vs expected behaviour.

    I should also mention that each speech Action has a Wait time offset (s) slider that can be used to extend the delay once an individual line of speech has finished playing - no need for an Engine: Wait Action even without the use of tokens.

  • Yes, you are right. The text tokens are processed, but it's done instantly. When I do a "[expression: happy]" at the beginning of the line and a "[expression: sad]" at the end of the line, only the "sad" expression is visible for the whole duration of the speech. I understand that this is the expected behaviour, but maybe there would be a way to sync it with the speech animations when the "From Speech Text" method is used. When using this method the text token could be triggered when the speech animation comes to the point in the text instead of the scrolling being at the position where the expression is, because both ways the text is processed on a timing base.
    I'm a bit struggeling to describe this in english right now. Sorry!

  • The handling of facial animation and token-processing are independent - I'm afraid one can't affect the other.

    What you can do, however, is rely on the Speech class's ReplaceDisplayText function. A custom script could remove expression tags from the end of a speech, and then record that tag to be set once that speech ends.

    Try this:

    using UnityEngine;
    using AC;
    
    public class SplitEndExpression : MonoBehaviour
    {
    
        private Speech speech;
        private string expressionOnEnd;
    
        private void OnEnable ()
        {
            EventManager.OnStartSpeech_Alt += OnStartSpeech;
            EventManager.OnStopSpeech_Alt += OnStopSpeech;
        }
    
        private void OnDisable ()
        {
            EventManager.OnStartSpeech_Alt -= OnStartSpeech;
            EventManager.OnStopSpeech_Alt -= OnStopSpeech;
        }
    
        private void OnStartSpeech (Speech speech)
        {
            this.speech = speech;
            expressionOnEnd = string.Empty;
    
            if (speech.GetSpeakingCharacter () && speech.OriginalText.EndsWith ("]"))
            {
                int startIndex = speech.OriginalText.LastIndexOf ("[");
                string newText = speech.OriginalText.Substring (0, startIndex);
                string tagText = speech.OriginalText.Substring (startIndex);
    
                if (tagText.StartsWith ("[expression:"))
                {
                    expressionOnEnd = tagText.Substring ("[expression:".Length);
                    expressionOnEnd = expressionOnEnd.Substring (0, expressionOnEnd.Length - 1);
                    speech.ReplaceDisplayText (newText);
                }
            }
        }
    
        private void OnStopSpeech (Speech speech)
        {
            if (this.speech == speech && !string.IsNullOrEmpty (expressionOnEnd))
            {
                speech.GetSpeakingCharacter ().SetExpression (expressionOnEnd);
            }
        }
    
    }
    
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.