Custom Sequencer assistance - speaker name?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
RPGKeith
Posts: 5
Joined: Sat Oct 28, 2023 2:48 pm

Custom Sequencer assistance - speaker name?

Post by RPGKeith »

Hi Tony, I'm trying to write a custom sequencer event that will be used as my games default sequence.

I'm trying to figure out how to get the speakers name out and I'll perform conditional logic outside of the dialogue system in the case of certain actor names, such as (player, narrator, logic) as this is how we plan to organize our dialogue tree's.

Thanks!
RPGKeith
Posts: 5
Joined: Sat Oct 28, 2023 2:48 pm

Re: Custom Sequencer assistance - speaker name?

Post by RPGKeith »

as soon as I ask I find my answer, mysequencername(entrytag)
```
string currentEntrytag = GetParameter(0);
//Parse entrytag for actor name depending on formatting
```



I want my custom sequencer to help me with the timing of dialogue and events in my game.

Is there a way to delay the text from beginning to type without creating an additional dialogue node with delay(.5) for example? At the end of the day my goal is to avoid creating a delay node before most dialogue entries.


``` default custom sequence - figure out if NPC/Player/Narrator is speaking
raise event 1
raise event 2
wait .6 seconds
begin typing dialogue.
+ normal delay({end})
```
-next dialogue entry -
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Custom Sequencer assistance - speaker name?

Post by Tony Li »

Hi,

If you want to delay before all dialogue entries, you can make a subclass of your typewriter effect (UnityUITypewriterEffect or TextMeshProTypewriterEffect) and override the Play() coroutine to delay 0.5 seconds:

Code: Select all

public class MyTypewriterEffect : TextMeshProTypewriterEffect
{
    public virtual IEnumerator Play(int fromIndex)
    {
        yield return new WaitForSeconds(0.5f);
        yield return base.Play(fromIndex);
    }
}
If you only want to delay before some entries, you can make a subclass of StandardUISubtitlePanel. Tick your subtitle panel's Delay Typewriter Until Open checkbox, and override the StartTypingWhenFocused coroutine. For example, you could set it to wait for a duration specified by a static variable, something like:

Code: Select all

public class MySubtitlePanel : StandardUISubtitlePanel
{
    public static float TypewriterDelay = 0;
    
    protected override IEnumerator StartTypingWhenFocused(UITextField subtitleText, string text, int fromIndex)
    {
        if (TypewriterDelay > 0) yield return new WaitForSeconds(TypewriterDelay);
        TypewriterDelay = 0;
        yield return base.StartTypingWhenFocused(subtitleText, text, fromIndex);
    }
}
and use a sequencer command to set the static variable:

Code: Select all

public class SequencerCommandSetTypewriterDelay : SequencerCommand
{
    void Awake()
    {
        MySubtitlePanel.TypewriterDelay = GetParameterAsFloat(0);
        Stop();
    }
}
RPGKeith
Posts: 5
Joined: Sat Oct 28, 2023 2:48 pm

Re: Custom Sequencer assistance - speaker name?

Post by RPGKeith »

Awesome! Thank you so much for the help!!
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Custom Sequencer assistance - speaker name?

Post by Tony Li »

Glad to help!
Post Reply