Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

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

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

  1. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Hi @YevgenG - Please make sure a Scrollbar Enabler is assigned to the Standard UI Menu Panel component as shown in the screenshot in this post.
     
    YevgenG likes this.
  2. YevgenG

    YevgenG

    Joined:
    Oct 17, 2018
    Posts:
    22
    That's how magic works :D It helped! Thanks a lot, @TonyLi !
     
    TonyLi likes this.
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    YevgenG likes this.
  4. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    79
    Left a comment earlier, removed it thinking I made a dumb mistake.. but it seems I was correct.
    SetActive(Gameobject,true/false) doesn't always work.

    For example;

    SetActive(BlackToFade,true);
    SetActive(LeanaRemodel (1),false);

    Turning off the LeanaRemodel doesn't work.
    Same goes for
    SetActive(IntroTrigger,false);

    I am 100% sure I don't have any other gameobject with the same name and I am 100% sure I have spelled the gameobject correctly, yet they don't turn off.

    Note: This isn't always the case, in many other cases, SetActive works completely fine. Which is why it's so confusing and I don't know why it happens.
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Hi @SOSolacex - Are the GameObject names unique? Have you tried updating to the latest version of the Dialogue System? (If you do that, back up your project first as always to be safe.)

    Can you use the speaker and listener keywords instead of GameObject names?

    Alternatively, you could use scene UnityEvents. The drawback is that it points to a specific GameObject in a specific scene, whereas SetActive()'s name reference can work in any scene.
     
  6. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    79
    I've noticed that it doesn't set GameObjects as false when they are assigned to my Character layer.

    I made some duplicates, some being tied to the default layer, others to the character layer. The default ones got set as inactive, whereas the character layer ones did not.
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    If they're duplicates with the same name, SetActive() might not be finding the right one. If you can't guarantee that the name is unique, use 'speaker' or 'listener' if possible, or use scene events.

    If the name is unique, make sure no other script is immediately setting it active again.

    You can temporarily set the Dialogue Manager's Other Settings > Debug Level to Info. This will log two lines for each sequencer command. Check the second line, which will show which GameObject is being affected.
     
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Last edited: Apr 23, 2021
  9. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    79
    I'll admit I just went the lazy route and put the object that I had issues with on the default layer, which caused them to work. :p The colliders, aka the things I actually interact with are still on the character layers so there's no issue there.
    I'll definitely try debugging at some point though. However, for now I saw absolutely no correlation between why in one instance it would work, and it wouldnt in another.

    For example, I once made a completely new trigger object which would not be affected by anything except a SetActive false.. which didn't work. That one also happened to be on the character layer.

    Either way, I was wondering.. In Dialogue -> Conversations ->Override Display Settings, would it be possible to assign a second/different dialogue panel? One that would replace the standard one in case of special conversations.
    If so, would you be able to give me a few pointers? I am not sure how to go about that.

    EDIT: Nevermind, it's not tied to the character layer, seems like that happened to be a ton of coincidence.

    Used the debug -> info.. however, there is nothing in the debugger that's turning the objects back on.
     
    Last edited: Apr 25, 2021
  10. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    79
    Ignore the entire post of me having issues with the setactive thing :oops: I had the warnings in the console disabled for a little while considering I have an asset with a lot of camerafilters using some old code, giving me a couple hundred errors every time I import/start up unity. Forgot to turn it back on, resulting in me not seeing the error about the object not being able to be the speaker/listener..

    I tried to deactivate the objects I was speaking to or that were the parents of the object I was speaking to after the conversation was over (last node that would make the player exit the conversation).. resulting in that issue.

    The reason why the "character layer" coincidence was a thing is because every character-layer character I tried it with happened to be the one I'd conversate with, while the default one would be a duplicated one without it participating in a conversation :oops:

    I am stupid sometimes, but this time it takes the cake. haha
    My apologies.
     
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    No worries! Is everything working correctly now?
     
  12. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    79
    Yes, works great as usual!
    My only question is the one I asked before;

    Once I got that done, I swear I'll leave you alone again for a while. haha
     
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    That's not available in Override Display Settings, but you can use the SetPanel() sequencer command in the first node of the conversation -- or, if the character has a Dialogue Actor component, set the Dialogue Actor component's Dialogue UI Settings > Subtitle Panel Number.
     
  14. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    79
    Oh I see. I remember googling a while ago about adding a PauseGameplay option when I needed it.. which was like a year ago or so by now I think. I was able to add it here http://prntscr.com/121glwn . I was thinking it would be nice to just assign the panel you want there for that specific conversation, but yeah SetPanel() would definitely work. Cheers & thanks!
     
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    You could do that, too. Then add an OnConversationLine method that checks the field value and calls the StandardDialogueUI's OverrideActorPanel method. Roughly, something like:

    Code (csharp):
    1. void OnConversationLine(Subtitle subtitle)
    2. {
    3.     int panel = Field.LookupInt(subtitle.dialogueEntry.fields, "Panel");
    4.     if (panel != -1) // Default to -1 for regular panel
    5.     {
    6.         var actor = DialogueManager.masterDatabase.GetActor(subtitle.speakerInfo.id);
    7.         (DialogueManager.dialogueUI as StandardDialogueUI).OverrideActorPanel(actor, PanelNumberUtility.IntToSubtitlePanelNumber(panel));
    8.     }
    9. }
     
  16. Irishall

    Irishall

    Joined:
    Dec 9, 2016
    Posts:
    10
    Hello. I have a question.

    How can I use different DialogueUI in continuous conversations?

    (For example, when "Conversation 1" using JRPG UI ends, "Conversation 2" using VN UI must be started continuously)

    I created a new GameObject including DialogueSystemTrigger and OverrideDialogueUI Component. However, when I used "Link To" to link a node to a second conversation, the UI of that conversation is not being overridden with the new DialogueUI.
     
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Hi @Irishall - Someone else just did the same thing (using the same UIs in fact) in this forum post.

    When you link from one conversation to another, it's considered a cross-conversation link and not the actual stop and start of two different conversations. For this reason, it continues using the same UI.

    If you don't want to set it up the way that other developer did in their forum post, you can add a Dialogue System Trigger set to OnConversationEnd that starts the second conversation. Add it to one of the original conversation participants, but assign a different Conversation Actor or Conversation Conversant to it. On that different Conversation Actor/Conversant, add an Override Dialogue UI component.
     
  18. Irishall

    Irishall

    Joined:
    Dec 9, 2016
    Posts:
    10

    Thank you for your kind reply!

    I succeeded in overriding the UI using OnConversationEnd.

    However, what should I do to get it back to the original UI from the 3rd Conversation? When overriding to the original UI, the panel does not seem to work properly.

    Also, what I really want is to use a different UI for each connected conversation. (JRPG→VN→JRPG→VN...)
    Is there any other good way to do this, other than create countless DialogueSystemTrigger?
     
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Use the technique described in the forum post link I provided above. I'll copy the script here:

    Code (csharp):
    1. using UnityEngine;
    2.  
    3. namespace PixelCrushers.DialogueSystem.SequencerCommands
    4. {
    5.  
    6.     public class SequencerCommandChangeUI : SequencerCommand
    7.     {
    8.         private void Awake()
    9.         {
    10.             // Get the values of the parameters:
    11.             var entryID = GetParameterAsInt(0);
    12.             var dialogueUIName = GetParameter(1);
    13.             DialogueManager.StopConversation();
    14.             DialogueManager.UseDialogueUI(GameObject.Find(dialogueUIName));
    15.             DialogueManager.StartConversation(DialogueManager.lastConversationStarted, DialogueManager.currentActor, DialogueManager.currentConversant, entryID);
    16.             Stop();
    17.         }
    18.     }
    19. }

    Drop that script into your project. Add dialogueUI(s) to the scene (e.g., to Canvases in the Dialogue Manager). Then use your new ChangeUI() sequencer command. For example, say you've added a dialogue UI named "Letterbox" to the Dialogue Manager:

    upload_2021-4-25_13-16-24.png

    Then in your conversation use this Sequence to jump to entry ID 5 and use the Letterbox UI:

    ChangeUI(5, Letterbox)
     
  20. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    79
    In regards to what I was saying before (Disabling the gameobject I've had a conversation with after the conversation), what would be the best way to do this?

    It can't be done using the conversation's nodes, so I was like "Oh, that's easy, I'll just use a dialogue trigger with On Conversation End", but that seems to be causing the same issue. I feel like I am overlooking something super simple while thinking of an over complicated way to solve this (Sending a message to an activation/deactivation manager).

    I got the panel thing to work with the Runic UI by the way, so no problems there. :p
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Hi @SOSolacex - What doesn't work with a Dialogue System Trigger set to OnConversationEnd? As long as the GameObject is the conversation's Conversation Actor or Conversation Conversant, that should work.
     
  22. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    79
    When I try to disable an object after a conversation with it, it still complains in the console about the fact that the object can't be a speaker or a listener for the setactive to work, even though I use a onconversationend dialogue trigger.
     
  23. Venominus

    Venominus

    Joined:
    Sep 5, 2015
    Posts:
    21
    I added response timeout 10 and choose first response, but when player doesn't choose any option for 10 and more seconds nothing happens
     
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Use Actions > OnExecute() UnityEvent:

    upload_2021-4-26_9-53-49.png

    Alternatively, use Actions > Set GameObject Active Or Inactive, which lets you activate or deactivate a list of GameObjects, and specify Conditions for each one to be active or inactive.
     
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Hi @Venominus - Are there any warnings or errors in the Console window?

    Also note: If you've changed the Dialogue Manager's Dialogue Time to Gameplay (which makes it respect Time.timeScale) and you're also pausing the game during conversations by setting Time.timeScale, then the timer will not count down.
     
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    LudoNarraCon - Last Day

    Fellow Traveller's digital convention, LudoNarraCon, ends today! Check out great games made with the Dialogue System, including Disco Elysium, Suzerain, and Lake. You can also watch developer streams and get deals on many games in the LudoNarraCon sale on Steam.

    Reminder: The Dialogue System for Unity is currently 50% off in the Asset Store's Sprint Into Spring Sale.

     
  27. Jakuri_F

    Jakuri_F

    Joined:
    Mar 9, 2020
    Posts:
    3
    Hi Everyone,
    I'm new and I can't figure out how to make a conversation node as a response choice, or just a subtitle. Anyone can help? Thanks.
     
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Hi @Jakuri_F - Please see the Quick Start Tutorial:



    (Other Tutorials)

    Briefly, blue nodes are player responses and gray nodes are subtitles, unless you've changed the actors' node colors in the Dialogue Editor's Actions section.

    If you want a blue node to appear as a subtitle, you can include the markup tag [auto] in the text, or untick the Dialogue Manager's Input Settings > Always Force Response Menu to show all single responses as subtitles. Make sure to also tick Subtitle Settings Show PC Subtitles During Line to show player subtitles.
     
  29. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    79
    Hey Tony,
    As you know "Include Invalid Entries" is a thing, which I have turned on by default.. However I was wondering if it's possible to exclude based on node so that it's on by default but you can exclude some of them.
     
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Hi @SOSolacex - Yes, it's possible. This forum post has an example.
     
  31. Jakuri_F

    Jakuri_F

    Joined:
    Mar 9, 2020
    Posts:
    3
    Got it. Thank you!
     
    TonyLi likes this.
  32. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    79
    TonyLi likes this.
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
  34. DREBOTgamestudio

    DREBOTgamestudio

    Joined:
    Jan 30, 2018
    Posts:
    45
    Hello!

    If I bought an asset under one account and under one studio, do I need to buy it again if I want to create a new account and a new studio?
    Can I buy an asset once and use it in all my projects, regardless of my studio name and account?
     
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Hi @DREBOTgamestudio - Assets are tied to accounts. If you use a different account, you should get a seat license for the asset under your new account. Fortunately, now's the best time since assets like the Dialogue System are 50% off. If your total checkout cart is $100+, you can get 5-10% more off, so you could save 60%.
     
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Last Day To Save 50% - Dialogue System for Unity

    Today's the last day to save 50% on the Dialogue System for Unity, Quest Machine, and Love/Hate.

    You can see the Dialogue System in a long list of award-winning games such as Disco Elysium, Suzerain, and Jenny LeClue; and in highly-anticipated upcoming games such as Lake, The Way of Wrath, and the crowdfunding hit Ova Magica.

     
  37. Stickeyd

    Stickeyd

    Joined:
    Mar 26, 2017
    Posts:
    134
    Hello. I'm changing the actor display name like in the example scene, but it stays so only for this particular conversation. At another one the display name is again like it was before. How to change it for long?
     
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Hi @Stickeyd - Set the actor's Display Name field. C# example:
    Code (csharp):
    1. DialogueLua.SetActorField("Mysterious Figure", "Display Name", "Davey Jones");
    Lua example:
    Code (lua):
    1. Actor["Mysterious_Figure"].Display_Name = "Davey Jones";
    The Dialogue System Extras page has a "Discover Name Example" that sets the actor field and also updates the cached display name in the active conversation.
     
  39. Stickeyd

    Stickeyd

    Joined:
    Mar 26, 2017
    Posts:
    134

    This is exactly what I'm doing yet the changed name doesn't stay changed in another conversation. It holds only in the conversation where it was changed.
     
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Are you perhaps loading old save data? Or somehow changing the value back? After changing the name, you can check the value in the Dialogue Editor window's Watches section. Add a watch for the actor's Display Name field.
     
  41. Stickeyd

    Stickeyd

    Joined:
    Mar 26, 2017
    Posts:
    134
    Indeed the value Display Name stays new(Checked through Watches) yet somehow in the actual new conversation with the same character it sets the old value to the textfield.(I don't load, save or change it anyhow anywhere to answer your question)
     
    Last edited: Apr 30, 2021
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Do you have any custom code -- maybe in your dialogue UI -- that's caching the old value? If your characters' GameObjects have Dialogue Actor components, are the Actor dropdowns set to actors in your database or set to literal strings? If they're set to literal strings, these might take precedence.
     
  43. Stickeyd

    Stickeyd

    Joined:
    Mar 26, 2017
    Posts:
    134
    I figured out the problem. It's because of the localization. I'm using Russian language currently set at Dialogue Manager and it's usual value seems to override the new Display Name
     
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Ah, understood. If you haven't already implemented a solution, you can set the localized Display Name in that case:
    Code (csharp):
    1. DialogueLua.SetActorField("Mysterious Figure", "Display Name ru", "Devid Dzhons");
    (Sorry, the forum doesn't allow posting Russian characters for some reason. o_O)
     
  45. Stickeyd

    Stickeyd

    Joined:
    Mar 26, 2017
    Posts:
    134
    I implemented the solution, the only weird thing is that in the actual conversation when I change the Display name, even if language is Russian it uses Display Name and not Display Name ru. Then when the new conversation starts - it uses the ru one.
     
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    You'll need to set the active conversation's cached Name property. You could change the ChangeActorName() Lua function to something like:
    Code (csharp):
    1. // Note: Assumes newDisplayName is localized version:
    2. public void ChangeActorName(string actorName, string newDisplayName)
    3. {
    4.     if (DialogueDebug.LogInfo) Debug.Log("Dialogue System: Changing " + actorName + "'s Display Name to " + newDisplayName);
    5.     DialogueLua.SetLocalizedActorField(actorName, "Display Name", newDisplayName);
    6.     if (DialogueManager.IsConversationActive)
    7.     {
    8.         var actor = DialogueManager.MasterDatabase.GetActor(actorName);
    9.         if (actor != null)
    10.         {
    11.             var info = DialogueManager.ConversationModel.GetCharacterInfo(actor.id);
    12.             if (info != null) info.Name = DialogueLua.GetLocalizedActorField(actorName, "Display Name").asString;
    13.         }
    14.     }
    15. }
     
  47. Stickeyd

    Stickeyd

    Joined:
    Mar 26, 2017
    Posts:
    134
    This works, but it also sets a Russian version of the name when the language is set on English. Can I check language of Dialogue Manager through code somehow?
     
  48. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Yes. The value is in the property PixelCrushers.DialogueSystem.Localization.language.
     
  49. DREBOTgamestudio

    DREBOTgamestudio

    Joined:
    Jan 30, 2018
    Posts:
    45
    Hello, can you help me? How can I get a list of conversations using a script at runtime?
     
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    11,320
    Hi @DREBOTgamestudio:
    Code (csharp):
    1. var titles = new List<string>();
    2. foreach (Conversation conversation in DialogueManager.masterDatabase.conversations)
    3. {
    4.     titles.Add(conversation.Title);
    5. }
     
    DREBOTgamestudio likes this.
unityunity