Page 1 of 1
Custom Sequencer assistance - speaker name?
Posted: Sat Oct 28, 2023 3:36 pm
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!
Re: Custom Sequencer assistance - speaker name?
Posted: Sat Oct 28, 2023 3:50 pm
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 -
Re: Custom Sequencer assistance - speaker name?
Posted: Sun Oct 29, 2023 12:13 am
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();
}
}
Re: Custom Sequencer assistance - speaker name?
Posted: Sun Oct 29, 2023 4:56 pm
by RPGKeith
Awesome! Thank you so much for the help!!
Re: Custom Sequencer assistance - speaker name?
Posted: Sun Oct 29, 2023 7:57 pm
by Tony Li
Glad to help!