Search Unity

[RELEASED] Dialogue System for Unity - easy conversations, quests, and more!

Discussion in 'Assets and Asset Store' started by TonyLi, Oct 12, 2013.

  1. Sajid_farooq

    Sajid_farooq

    Joined:
    May 23, 2012
    Posts:
    229
    This is a VERY welcome feature. I had to do the manual entry-condition on each node, which was very tiring!
     
    TonyLi likes this.
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    Version 2.0.5 is on track to be released next week, so keep an eye out here on the thread for it.
     
  3. Gor-Sky

    Gor-Sky

    Joined:
    Jan 28, 2018
    Posts:
    187
    @TonyLi
    Thank you for your fast help :) !
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    Happy to help!
     
  5. Sajid_farooq

    Sajid_farooq

    Joined:
    May 23, 2012
    Posts:
    229
    Im wondering if the "return to calling node" feature we discussed a couple of pages back is on the horizon at all? Would be very useful for some of my current work.
     
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    Hi @Sajid_farooq - Version 2.0.5 should have two optional Lua functions: one that records the current node, and another that returns to the recorded node. I think that should handle your "sub-dialogues" request.
     
  7. Sajid_farooq

    Sajid_farooq

    Joined:
    May 23, 2012
    Posts:
    229
    Very nice!
     
  8. Shinzironine

    Shinzironine

    Joined:
    Nov 30, 2013
    Posts:
    32
    So, we've been using the Dialogue System for quite a while now and we're starting to have quite a bit of conversations. What are the best practices to organize\group these conversations. Is the external editor the best way?

    Also, I wanted to ask for an advice regarding the scripting with Dialogue System. So I have the code that starts the conversation, then checks for presence of the conversant in the scene (on OnConversationStart event). If the conversant the absent, my code then proceeds to instantiate the conversant (he has a DialogueActor component attached). The conversation has to start on the same frame, but the conversant model does not have the conversant info of any kind yet. I assume that happens because DialogueActor did not yet have a chance to initialize itself. So my code that follows afterwards finds null in the
    Code (CSharp):
    1. DialogueManager.conversationModel.ConversantInfo.transform
    I resolve this issue by manually assigning all the needed data after the conversant instantiation. But is there a better way? I tried calling
    Code (CSharp):
    1. CharacterInfo.RegisterActorTransform(actor, transform);
    The info is still absent though, transform in particular.

    The other thing that I found, was the absence of actor data on the same frame, for example I am calling
    Code (CSharp):
    1. DialogueLua.SetActorField("Actor", "Display Name", GetDisplayName());
    "Actor" is the conversant in question. The Dialogue still does not see the new display name on the same frame. Once again, if I do this manually, everything is fine.
    Code (CSharp):
    1. DialogueManager.conversationModel.ConversantInfo.transform = someObject.transform;
    2. DialogueManager.conversationModel.ConversantInfo.Name = someObject.GetDisplayName();
    So am I missing something? Or maybe there is a way to force update the data? Thanks.
     
    Last edited: Oct 9, 2018
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    Hi @Shinzironine - It's up to your preference. If you use the built-in editor, add forward slashes ( / ) to your conversation titles to group them into submenus. A popular grouping I've seen is Location / NPC / Conversation, such as:
    • Olympus/Zeus/Proclamation
    • Olympus/Zeus/Flirting
    • Olympus/Hera/Argument
    • etc.

    That's correct. DialogueActor registers itself in OnEnable, which hasn't run yet in your example. Can you start the conversation at the end of the frame? If you run your code in a coroutine, you can use yield return new WaitForEndOfFrame(); before calling DialogueManager.StartConversation.
     
    Shinzironine likes this.
  10. Shinzironine

    Shinzironine

    Joined:
    Nov 30, 2013
    Posts:
    32
    Oh man, did not know about this feature. It is perfect! Thank you.

    As for the wait of frame, I think in my case the only option is explicit actor initialization, because I instantiate the Actor only after the conversation has started. For example I have an empty level, and then I choose a random conversation. Only then I need a conversant, since it can be basically anyone that exists in conversation.
     
    Last edited: Oct 9, 2018
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    I think you may be right. Unless perhaps you can identify the conversant before starting the conversation. You can get the conversation data ahead of time using DialogueManager.masterDatabase.GetConversation(). The Conversation has ActorID and ConversantID fields, as does each DialogueEntry (Conversation.dialogueEntries[]). You can get the actor data by passing the ActorID or ConversantID to DialogueManager.masterDatabase.GetActor(). If that would work in your case, you can instantiate your conversant and then call DialogueManager.StartConversation() at the end of the frame.
     
    Shinzironine likes this.
  12. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    637
    Tony: were you able to get the rest of the cut scene tutorials done?
     
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    Hi @SickaGamer - Tutorials 3 (messages) and 4 (entrytags) are in this post. All tutorials are in the Dialogue System for Unity 2.x Tutorials playlist. One last tutorial is still in the works. It will cover interactive sequencers such as Cinema Director, and how to write custom sequencer commands.
     
    SickaGamer likes this.
  14. Candescence

    Candescence

    Joined:
    Aug 26, 2014
    Posts:
    105
    So, basically, I'm using real-time dialogue and I've got a general idea of how to make it work, but I'm not sure how to go about implementing it:
    • There is a 'core' conversation active most of the time, allowing the player to pick a variety of topics and sub-topics, with certain sub-topics only being available when they haven't been chosen yet.
    • If the player is in the middle of a 'core conversation' and a conversation trigger is hit, the core conversation immediately halts and moves onto the new one, but remembers which line from the core conversation was halted.
    • When the conversation ends, it immediately triggers a conversation with multiple variations on "anyway, as I was saying..." with the speaker depending on whose line had been interrupted previously, and then goes back to the core conversation, right back to the line that was originally interrupted.
    The idea is basically a more interactive version of how Telltale handled the dialogue for the Poker Night At The Inventory games.

    Step 1 is one thing, but steps 2 and 3 are the big ones, considering there's no in-built system for being able to resume a previous conversation at a specific point in it, and the "on conversation end" trigger isn't very good for controlling which conversations to trigger with a setup like this.

    Also, I've found that setting the Response Timeout doesn't work correctly when set to 0 regardless of whether it's set in the editor or as a sequence - rather than disable timeout entirely, it just acts as if the timeout value is zero, and just times out immediately.

    As well, "allowSimultaneousConversations" isn't exposed in the editor for some reason.
     
    Last edited: Oct 11, 2018
  15. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    89
    hopeful and TonyLi like this.
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    Hi,
    To resume a conversation at a specific point, call DialogueManager.StartConversation("title", actor, conversant, entryID).

    The entire process that you described isn't built-in, but you can do it with a little scripting. It will be similar to the ConversationStateSaver script, which saves the position in the currently-active conversation and restarts there when you load a saved game.

    In your case, add a script to the Dialogue Manager that has an OnConversationLine method. If it's a core conversation, record the conversation ID and entry ID. Let's say you've defined a custom Boolean field named 'Core' in your conversations to indicate it it's a core conversation.
    Code (csharp):
    1. int currentCoreConversationID;
    2. int currentCoreEntryID;
    3.  
    4. void OnConversationLine(Subtitle subtitle)
    5. {
    6.     var conversation = DialogueManager.masterDatabase.GetConversation(subtitle.dialogueEntry.conversationID);
    7.     if (conversation.LookupBool("Core"))
    8.     { // Record our position in the core conversation:
    9.         currentCoreConversationID = subtitle.dialogueEntry.conversationID;
    10.         currentCoreEntryID = subtitle.dialogueEntry.id;
    11.     }
    12. }
    EDIT: Fixed currentCoreEntryID line above to record entry Id, not conversation ID.

    To jump to a side topic conversation:
    Code (csharp):
    1. bool interruptedCoreConversation;
    2. ...
    3. // If a conversation is already active, remember we interrupted it:
    4. interruptedCoreConversation = DialogueManager.isConversationActive;
    5. // Then stop it:
    6. DialogueManager.StopConversation();
    7. // And start our side topic conversation:
    8. DialogueManager.StartConversation("title", DialogueManager.currentActor, DialogueManager.currentConversant);
    This will entirely stop the core conversation and start the side topic conversation. If that's not what you want to do, further down I'll describe how to link them all into one conversation flow.

    To return directly to the core conversation, check interruptedCoreConversation in an OnConversationEnd method:
    Code (csharp):
    1. void OnConversationEnd(Transform actor)
    2. {
    3.     if (interruptedCoreConversation)
    4.     {
    5.         interruptedCoreConversation = false; // reset it
    6.         // Resume the core conversation:
    7.         var conversation = DialogueManager.masterDatabase.GetConversation(currentCoreConversationID);
    8.         DialogueManager.StartConversation(conversation.Title, DialogueManager.currentActor, DialogueManager.currentConversant, currentCoreEntryID);
    9.     }
    10. }
    To play an "as I was saying" conversation first, you can do something like:
    Code (csharp):
    1. void OnConversationEnd(Transform actor)
    2. {
    3.     if (interruptedCoreConversation)
    4.     {
    5.         interruptedCoreConversation = false; //reset it
    6.         // Play the "as I was saying" segue conversation:
    7.         DialogueManager.StartConversation("As I Was Saying", DialogueManager.currentActor, DialogueManager.currentConversant);
    8.     }
    9.     else if (DialogueManager.lastConversationStarted == "As I Was Saying")
    10.     {
    11.         // We just ended "as I was saying". Play the core conversation at the recorded point:
    12.         var conversation = DialogueManager.masterDatabase.GetConversation(currentCoreConversationID);
    13.         DialogueManager.StartConversation(conversation.Title, DialogueManager.currentActor, DialogueManager.currentConversant, currentCoreEntryID);
    14.     }
    15. }
    To keep this reply from getting ridiculously long, I'll describe how to do this in one conversation in a second reply.

    The response timeout is only used for response menus. If it's zero, it will show the menu until the player clicks a response button or cancels the conversation. If it's nonzero, it will make a selection for the player if the timeout duration is reached. If the dialogue UI has a timer slider, it will show the time left in the slider.

    If you're not seeing that behavior, here are some things that may be happening:
    • If you've unticked Input Settings > Always Force Response Menu, and if the response menu would only have one button, the conversation will auto-select that button and skip the menu. Same if one of the responses has an "[auto]" markup tag in it.
    • If you're setting the value programmatically, set it to exactly zero, not some math that might give you an approximation of zero (e.g., 0.0000001).
    • If you set it in a dialogue entry's Sequence, it will take effect in the next response menu.
    • Somewhat related: a dialogue entry's subtitle stays onscreen for the duration of the entry's Sequence. If the Sequence only has "SetTimeout(0)", it will complete immediately. You might want to set that entry's Sequence to something like "SetTimeout(0); Delay({{end}})" or even "SetTimeout(0); {{default}}".

    It's back in version 2.0.5. It was overlooked in the inspector's version 2.x facelift.

    In your scenario, though, I don't recommend it. It sounds like you want to stop one conversation and shift gears to another one, not have multiple conversations playing at the same time.


    Awesome! Congratulations on your release! Looks like it has some pretty intense combat.
     
    Last edited: Oct 19, 2018
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    @Candescence - If you've set up your dialogue UI's main dialogue panel to play show and hide animations, the code above will play the show and hide animations every time you switch to the side topic, then to the "as I was saying" conversation, and then back to the core conversation. If I recall from the last Telltale game I played, there aren't separate main dialogue panel animations, so this isn't an issue. Instead, each subtitle panel and response menu has its own set of show/hide animations, which is no problem.

    If you do want to play main panel show/hide animations, then the code above won't suffice. Instead, you'll need to manually change DialogueManager.currentConversationState. If you need to do this, let me know; I'll describe the steps.
     
  18. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,257
    Can i use this together with Doozy UI?
    Did you hear from someone that it will work?

    Edit:
    So i want to use Dialogues in a mobile (Android) game together with I2 Localization, Doozy UI and Articy Draft.

    Because i just setup the project, do you suggest a way to work?
    At first i want to make the menu´s that have to be localized with I2 Localization but should i setup all the languages and text fields in a database with Dialogues or do this with I2 L.?
     
    Last edited: Oct 13, 2018
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    Hi @RandAlThor - There's no official integration, but I don't see why you couldn't get them to work together. You could write your own implementation of IDialogueUI to work directly with Doozy UI, or you could use the Standard Dialogue UI and use the panels' OnOpen() and OnClose() events to call Doozy, or make subclasses of StandardUISubtitlePanel and StandardUIMenuPanel to do whatever you want with Doozy.
     
    RandAlThor likes this.
  20. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,257
    Ah, sory, just edited my question.
    You are just to fast with your support ;)
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    Hi @RandAlThor - No worries! :)

    The Dialogue System's i2 Localization support makes it easy to add localization near the end. The only thing you need to worry about when setting up your UIs is to add a LocalizeUI component to each text-based UI element (Text, Dropdown, TextMeshProUGUI). You can leave the fields unassigned. Add the text of each field to a Text Table.

    Later, when you pull i2 Localization into it, you can assign a Text Table to the Dialogue Manager, and it will automatically push and pull localization from i2.

    For your database, articy has its own localization plugin. Do you want to use it, or i2?
     
  22. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,257
    I want to use i2 i think because of the automatic localization.

    Btw. do not know that you make UMA assets.
    Will have a look.
     
  23. Candescence

    Candescence

    Joined:
    Aug 26, 2014
    Posts:
    105
    @TonyLi I don't think the panel stuff is going to be an issue considering my specific implementation of subtitle UI stuff (basically completely custom), but if I have issues that your advice doesn't solve I'll let you know.

    That being said, I'm not sure how/where to implement the second chunk of code in your post, specifically the one about jumping to a side conversation, because it implies you don't put it in an OnConversationStart() method, but I can't think of any other means of doing so other than a custom trigger action.
     
  24. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    471
    Hey @TonyLi quick question, is there any OnConversationEnd that sends the conversation title that finished? I'm trying to trigger something, but only if a specific conversation was completed.
     
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    That will work fine. When you're ready to localize, use the instructions on the i2 Localization Support page. The Dialogue System's i2 Localization Support package adds a new editor window that can copy data to/from a dialogue database (and/or text table) and i2's localization prefab.

    Thanks! More are on the way, too. The artist is Steve Finney at Arteria3D. I'm just helping to get them onto the Asset Store, and also providing support.

    How do you intend to jump to a side conversation? A Dialogue System Trigger? (The code I suggested above assumed you were starting the side conversation from one of your own scripts.)

    If you're jumping from one conversation to another using cross-conversation links and you want to be able to return to the point before the cross-conversation link, you may be interested in the feature coming in version 2.0.5 that lets you record a conversation position and then return to it, as described in this post.

    If you have a script with an OnConversationEnd method, the title of the conversation that just finished is in DialogueManager.lastConversationStarted.
     
    Rotary-Heart likes this.
  26. Candescence

    Candescence

    Joined:
    Aug 26, 2014
    Posts:
    105
    Yeah, I'm planning on mainly using triggers to start new side conversations. So I guess that implies a custom trigger that informs another script to start a side convo, then.
     
  27. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    Hi @Candescence - For now, yes. In the upcoming version 2.0.5, the "action" methods in Dialogue System Trigger are virtual, so you can make a subclass that overrides the DoConversationAction() method. Your overridden method can use the code above to stop the active core conversation first, then call the base DoConversationAction() method.
     
  28. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    637
    Tony, can you provide an integration document for Easy Main Menu? Thanks for all of your hard work on supporting your AAA quality asset.
     
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    When 1.1 goes live on the Asset Store, I'll do a put up a video tutorial at the same time that I put up the final tutorial in the cutscene series.
     
    SickaGamer likes this.
  30. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    637
    Awesome news! Thanks!
     
  31. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    471
    That definitely did the trick. Many thanks!

    Is there any way that I could make actions not be displayed on the UI, while still have the Show PC Subtitles checked?
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    Hi @Rotary-Heart - Yes. There are a couple ways to interpret your question.

    If you want to show PC subtitles for non-menu nodes (i.e., when the player only has one response, so it auto-plays instead of showing a menu), but not for menu nodes, tick the Dialogue Manager's Subtitle Settings > Skip PC Subtitle After Response Menu.

    If you want to not show a specific node, add the markup tag [nosubtitle] to that node's text.
     
    Rotary-Heart likes this.
  33. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    471
    Perfect, thanks again for such a fast response!
     
  34. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    164
    Both UCC and Dialogue System use the Standalone Input Module. If I remove the WASD key, UCC characters will not be able to walk. Is there any other way?
     
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    Hi @AngelBeatsZzz - UCC uses Unity Input to move, but it doesn't use the Unity UI EventSystem. In the Unity Input manager (Edit > Project Settings > Input), you can define your inputs like below:
    • Horizontal: A,D
    • Vertical: S,W
    • UIHorizontal: left,right
    • UIVertical: down,up
    Here's a screenshot. I collapsed Vertical & UIVertical, but they're configured similarly.

    upload_2018-10-15_10-44-16.png

    UCC's Unity Input component will read from Vertical and Horizontal. This means your character will move using WASD.

    Configure the Unity UI EventSystem to use UIVertical and UIHorizontal:

    upload_2018-10-15_10-47-42.png

    This means Unity UI (e.g., the Dialogue System's dialogue UI) will use the arrow keys.

    There are additional definitions for Horizontal and Vertical for joystick input. You can do the same thing -- for example, mapping UIHorizontal and UIVertical to axes 6 & 7 (d-pad) instead of the sticks.
     
  36. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    164
    Ok,thanks for reply.
     
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    Walled City Infotech's Easy Main Menu now has integration with Pixel Crushers' Save System. This means you can use it with the Dialogue System as well as Love/Hate and Quest Machine. This video shows how to set up Easy Main Menu with the Dialogue System:

     
    magique and walledcityinfotech like this.
  38. walledcityinfotech

    walledcityinfotech

    Joined:
    Oct 10, 2016
    Posts:
    715
    This is so Awesome man!! You have done an AMAZING job in creating the Dialogue System and this tut video is really helpful !

    Looking forward to work on more amazing ideas with you!

    Best
    Hamzah
     
    TonyLi likes this.
  39. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    Example Visual Novel UI with Multiple Characters & Focus

    A frequent request is how to set up a Fire Emblem-style visual novel UI that supports multiple characters that can pop in and out, and that focuses the speaker and defocuses the other actors. The Dialogue System's Standard Dialogue UI makes it relatively easy to do without any extra scripting. Here's an example scene:

    VNFocusUIExample_2018-10-18.unitypackage

    It looks like this:



    The unitypackage contains a text file that describes the steps used to set up this UI. You can also just use the UI setup as-is if you like. The UI frames are purposely generic solid-color boxes that you can swap with your own UI textures.

    For reference, in case you're not familiar with Fire Emblem, its dialogue UI looks like this (Path of Radiance sequel shown):

     
    hopeful likes this.
  40. Candescence

    Candescence

    Joined:
    Aug 26, 2014
    Posts:
    105
    @TonyLi Alright, so I've gotten around to writing in the core/side conversation stuff, which has also exposed an oversight/bug in my custom UI scripting (turns out I forgot that my UI script was handling the timer, so I made it so the timer doesn't appear or do anything when the starting value is set to 0).

    Also, there was a bug in your side conversation script example, turns out if you set interruptedCoreConversation before stopping said core conversation, you'll end up instead playing the "where were we" conversation before you even play the side-convo, because you'll trigger OnConversationEnd first. So, instead, I did this:

    Code (CSharp):
    1.         // If a core conversation is/was already active, remember we interrupted it (but set
    2.         // interruptedCoreConversation to false afterwards so the "where were we" conversation or the core covo isn't triggered
    3.         // when the current conversation is stopped:
    4.         bool coreTemp = coreConversationActive || interruptedCoreConversation;
    5.         interruptedCoreConversation = false;
    6.         // Then stop it (without reverting back to a core conversation):
    7.         DialogueManager.StopConversation();
    8.         // And start our side topic conversation:
    9.         dialogueUI.HideResponses();
    10.         DialogueManager.StartConversation(sideConversation);
    11.         // Set interruptedCoreConversation
    12.         interruptedCoreConversation = coreTemp;
    So right now, it's working pretty well, aside from a problem I've run into: I've noted that if a core conversation stops on a currently-running dialogue response menu, when it returns, it automatically skips over the responses and goes to the dialogue node after a specific choice for some reason. I would like to avoid this behaviour, but I'm not sure how.
     
  41. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    Hi @Candescence - Since your custom UI script is handling the timing, is it possible that the timer on the core conversation is still running even when switching to a side conversation? If so, it's possible that the timer runs out in the background and chooses a response for you.
     
  42. Candescence

    Candescence

    Joined:
    Aug 26, 2014
    Posts:
    105
    Eh, not really, @TonyLi - the timer is only active when there are responses in the first place, and it picks the third branch out of four for some random reason, as opposed to the first option, which the custom UI is designed to pick as the default option. I went over the script to make sure, and I'm certain this behaviour isn't the fault of the script itself.

    So, I'm inclined to believe it's some quirk with the dialogue system causing it to go to a post-response node rather than the original node.
     
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    This test seems to work correctly:

    TestSideConversations_2018-10-19.unitypackage

    I fixed a typo in my original reply. currentCoreEntryID was recording the conversation ID instead of entry ID:
    Code (csharp):
    1. currentCoreEntryID = subtitle.dialogueEntry.id;
    Here's the test script:
    Code (csharp):
    1. using UnityEngine;
    2. using PixelCrushers.DialogueSystem;
    3.  
    4. public class HandleSideConversations : MonoBehaviour
    5. {
    6.  
    7.     [ConversationPopup]
    8.     public string sideConversation;
    9.  
    10.     int currentCoreConversationID;
    11.     int currentCoreEntryID;
    12.     bool interruptedCoreConversation = false;
    13.  
    14.     private IDialogueUI dialogueUI { get { return DialogueManager.dialogueUI; } }
    15.     private bool coreConversationActive { get { return DialogueManager.isConversationActive ? DialogueManager.masterDatabase.GetConversation(DialogueManager.lastConversationID).LookupBool("Core") : false; } }
    16.  
    17.     void OnConversationLine(Subtitle subtitle)
    18.     {
    19.         var conversation = DialogueManager.masterDatabase.GetConversation(subtitle.dialogueEntry.conversationID);
    20.         if (conversation.LookupBool("Core"))
    21.         { // Record our position in the core conversation:
    22.             currentCoreConversationID = subtitle.dialogueEntry.conversationID;
    23.             currentCoreEntryID = subtitle.dialogueEntry.id;
    24.             Debug.Log("Recorded core position " + currentCoreConversationID + ":" + currentCoreEntryID + " '" + subtitle.formattedText.text + "'");
    25.         }
    26.     }
    27.  
    28.     void OnConversationEnd(Transform actor)
    29.     {
    30.         if (interruptedCoreConversation)
    31.         {
    32.             interruptedCoreConversation = false; // reset it
    33.                                                  // Resume the core conversation:
    34.             Debug.Log("Resuming core position " + currentCoreConversationID + ":" + currentCoreEntryID + " '" + DialogueManager.masterDatabase.GetDialogueEntry(currentCoreConversationID, currentCoreEntryID).currentDialogueText + "'");
    35.             var conversation = DialogueManager.masterDatabase.GetConversation(currentCoreConversationID);
    36.             DialogueManager.StartConversation(conversation.Title, DialogueManager.currentActor, DialogueManager.currentConversant, currentCoreEntryID);
    37.         }
    38.     }
    39.  
    40.     public void StartSideConversation()
    41.     {
    42.         // If a core conversation is/was already active, remember we interrupted it (but set
    43.         // interruptedCoreConversation to false afterwards so the "where were we" conversation or the core covo isn't triggered
    44.         // when the current conversation is stopped:
    45.         bool coreTemp = coreConversationActive || interruptedCoreConversation;
    46.         interruptedCoreConversation = false;
    47.         // Then stop it (without reverting back to a core conversation):
    48.         DialogueManager.StopConversation();
    49.         // And start our side topic conversation:
    50.         dialogueUI.HideResponses();
    51.         DialogueManager.StartConversation(sideConversation);
    52.         // Set interruptedCoreConversation
    53.         interruptedCoreConversation = coreTemp;
    54.     }
    55. }
     
  44. Candescence

    Candescence

    Joined:
    Aug 26, 2014
    Posts:
    105
    @TonyLi Well, it turns out that specific typo was causing the problem, lol. It pretty much works fine now, thanks. I'll let you know if I have any more issues.
     
  45. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    Sorry about not catching that typo earlier. Glad it's working now!
     
  46. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    164
    Is there a tutorial for the Terminal dialog in the DEMO scene? I want to make an input detection dialog.
     
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    Hi @AngelBeatsZzz - There isn't a specific tutorial for it, but you can edit the demo database to see how it's set up. It uses the TextInput() sequencer command to read input from the player.
     
  48. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    164
    I get it, thanks.
     
  49. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    164
    I found that "Computer Dialogue UI with Text Input" prefab uses "GUI Text Field", I want to use "Unity Input Field", I have not found such a UI Prefab, is there any good way to make it?
     
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,354
    Hi @AngelBeatsZzz - The Standard Dialogue UI templates in Assets / Plugins / Pixel Crushers / Dialogue System / Prefabs / Standard UI Prefabs have text field UIs. (The type is Standard UI Input Field.) It's easiest to copy one of those, but you can also create one from scratch by adding a Standard UI Input Field component and assigning the UI elements:

    upload_2018-10-20_7-54-17.png