Page 1 of 1

Quick advice needed: Response Menu appearing too quickly

Posted: Sun Aug 16, 2020 10:12 am
by UKMasters
Hi Tony,

This is a fantastic asset. Thank you for all your hard work in both making the asset and the way you support it. Seeing the level of support and responsiveness on the forums was a key factor in me deciding to purchase Dialogue System, Quest Manager and Love/Hate.

I'm currently looking at UI elements and screen design, and I've run into a problem. I hope you can help me.

Context:
  • I am building a scenario based CYOA game. Players will encounter a number of "standalone" scenarios as they play the game. I am building each scenario as a conversation in Dialogue System.
  • So I have a relatively long "conversation nodes" as they're the text from the "book" of scenarios. I am using the NPC as the narrator.
  • I am using the Templated Conversation UI - because I want previous entries in the current scenario to remain visible to the player.
  • I am using Typewriter effect. I have slowed this down slightly and have added some pauses.
Problem:
The User Choice (response menu) is appearing too quickly before the "NPC part" is finished typing. I can even make selections on the response menu and trigger the next dialogue from the NPC before the first one has finished.

I am relatively new at coding and unity and Dialogue System, so I'm suspecting I've set something incorrectly, but I can't work out what the issue is.

Can you help me shed any light on things?

Thanks
Pete

Re: Quick advice needed: Response Menu appearing too quickly

Posted: Sun Aug 16, 2020 10:30 am
by Tony Li
Hi Pete,

Thanks for using the Dialogue System!

Set the Dialogue Manager's Subtitle Settings > Subtitle Chars Per Second to the same value as your typewriter's Characters Per Second. You may also want to decrease the Min Subtitle Seconds.

p.s. - If your scenarios are very long, instead of the Templated Conversation UI I recommend using a dialogue UI that accumulates text. See the WRPG Template Start Dialogue UI for an example. It accumulates the subtitles (narrator and player) in a single Text element (or TextMesh Pro element) instead of using a separate GameObject for each one.

Re: Quick advice needed: Response Menu appearing too quickly

Posted: Sun Aug 16, 2020 10:53 am
by UKMasters
Thanks Tony,

As I said, fantastic service!

I will have a look at the WRPG UI you mentioned and see how I get on. I may well have quite a few "basic" questions! I hope that's okay. My ideas significantly outweigh my skills at the moment!! Hopefully, they'll be useful for other newbies too!

I have a few questions about how things work before I start, as knowing the answers to these will really help me get going.
  1. I'm presuming that you append the entries to a separate "text object". If so, is there a way to preserve or add formatting? (e.g. different colours for NPC and player). Based on previous experience you might have already thought of this!
  2. Does the single text log persist throughout the entire game? (i.e. across multiple conversations?). I would like it to persist, so that the player can look back at the choices they've made; because earlier choices will impact what happens later on.
  3. Is it possible to add in the title of the Conversation into the Text Log? So that when a separate Scenario (conversation) in my game is started, it will add the Title of the Scenario
  4. Is it possible to add other things into the log (e.g. via scripting or things you've already included in the settings)? For example, when a player's skill level increases, or when they complete a quest, it would be great to include this message in the log (I don't want to write everything to the log, just key things).
  5. I am building a multi-player game. So I need to be able to have up to 4 separate "text logs". Is this possible? Could you help me make this possible? :)
Thanks again for your help, I'm really excited about the possibilities of using what you have created.

Pete

(edited to ask...should I move this to a separate Thread as it's not just about response menu timing?)

Re: Quick advice needed: Response Menu appearing too quickly

Posted: Sun Aug 16, 2020 12:44 pm
by Tony Li
It's great that you asked those questions early. They're all UI-related, so it will be good to get it straightened out before making changes to your UI. No need to start a separate thread.
UKMasters wrote: Sun Aug 16, 2020 10:53 amI'm presuming that you append the entries to a separate "text object". If so, is there a way to preserve or add formatting? (e.g. different colours for NPC and player). Based on previous experience you might have already thought of this!
Formatting uses embedded rich text codes, so they're already included and preserved.
UKMasters wrote: Sun Aug 16, 2020 10:53 amDoes the single text log persist throughout the entire game? (i.e. across multiple conversations?). I would like it to persist, so that the player can look back at the choices they've made; because earlier choices will impact what happens later on.
This isn't built in. But if you don't mind a small dive into coding, you can add it. Here's an example. It uses two of the Dialogue System's special script methods: OnConversationStart and OnConversationLine.

Code: Select all

using PixelCrushers.DialogueSystem;
using UnityEngine;

public class RecordAllText : MonoBehaviour // ADD ME TO THE DIALOGUE MANAGER.
{
    public string allText; // This string accumulates all dialogue shown in the game.

    private StandardUISubtitlePanel GetSubtitlePanel()
    {
        var ui = DialogueManager.dialogueUI as StandardDialogueUI;
        return ui.conversationUIElements.defaultNPCSubtitlePanel;
    }

    void OnConversationStart(Transform actor)
    {
        // Add the conversation title to allText:
        allText += DialogueManager.lastConversationStarted + "\n";
        // Show the accumulated allText in the subtitle panel:
        GetSubtitlePanel().accumulatedText = allText;
    }

    void OnConversationLine(Subtitle subtitle)
    {
        // Add each non-blank line to allText:
        if (!string.IsNullOrEmpty(subtitle.formattedText.text))
        {
            allText += subtitle.formattedText.text + "\n";
        }
    }

    // Use this method to add extra text to the conversation log:
    public void AddSpecialText(string text)
    {
        allText += text;
        GetSubtitlePanel().subtitleText.text += text;
        GetSubtitlePanel().accumulatedText += text;
    }
}
For a more detailed example of these special script messages, examine the script ConversationLogger.cs.

You may also want to tick the Dialogue Manager's Subtitle Settings > Show PC Subtitles During Line and UNtick Skip PC Subtitle After Response Menu.
UKMasters wrote: Sun Aug 16, 2020 10:53 amIs it possible to add in the title of the Conversation into the Text Log? So that when a separate Scenario (conversation) in my game is started, it will add the Title of the Scenario
I included that in the example script above.
UKMasters wrote: Sun Aug 16, 2020 10:53 amIs it possible to add other things into the log (e.g. via scripting or things you've already included in the settings)? For example, when a player's skill level increases, or when they complete a quest, it would be great to include this message in the log (I don't want to write everything to the log, just key things).
Yes. In the example script above, I included an AddSpecialText() method. If you want to add the special text from a dialogue entry's Script field, you can register this method with Lua. (The Tutorials section has a video tutorial on this.)
UKMasters wrote: Sun Aug 16, 2020 10:53 amI am building a multi-player game. So I need to be able to have up to 4 separate "text logs". Is this possible?
Local multiplayer (i.e., on the same screen)? Or online?

Either way, I recommend getting one to work first. The example script above assumes one player because it sits on the Dialogue Manager GameObject.

Assuming local multiplayer, after you get one player to work, set up four dialogue UIs. Set up a GameObject for each player. Add an Override Dialogue UI to each player GameObject, and assign the corresponding dialogue UI. When you start a conversation for a player, make sure to specify the player's GameObject as the Conversation Actor.

Re: Quick advice needed: Response Menu appearing too quickly

Posted: Sun Aug 16, 2020 8:55 pm
by UKMasters
Thanks Tony,

That'll take me a little while to work through. I'll let you know if (when!) I run into any problems! :D

One quick thing...I can't get auto-scroll to work when using TextMeshPro text fields with the typewriter effect. But when I use standard Unity UI text fields, it works. Is there something specific about TMP that I'm missing?

Thanks
Pete

Re: Quick advice needed: Response Menu appearing too quickly

Posted: Sun Aug 16, 2020 9:53 pm
by Tony Li
Hi Pete,

The autoscroll setup for TextMesh Pro (TMP) is a bit simpler than Unity UI Text. You don't need a Sizer Text for TMP. If you have one, it could be causing issues, so please remove it. Just tick the TMP typewriter effect's Auto Scroll Enabled, and assign the scroll rect.

Re: Quick advice needed: Response Menu appearing too quickly

Posted: Sun Aug 16, 2020 10:27 pm
by UKMasters
Thank you.

I've found an alternative way to reveal text which I think looks good (though there might be some performance issues). It fades in each character and avoids the "jump" at the end of the line.

I found it here https://www.gamasutra.com/blogs/MiguelS ... inside.php and the code is here https://gist.github.com/miguelSantirso/ ... 421fc4b736.

Would it be possible to get something like this working with the Dialogue System?

Re: Quick advice needed: Response Menu appearing too quickly

Posted: Mon Aug 17, 2020 9:41 am
by Tony Li
Hi,

I don't think his code handles auto-scrolling.

If you're looking for neat ways to animate the text typewriter, check out Febucci's Text Animator. It works with TextMesh Pro, and it has Dialogue System integration.

Re: Quick advice needed: Response Menu appearing too quickly

Posted: Mon Aug 17, 2020 6:30 pm
by UKMasters
Will do, thanks.