Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    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. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    425
    Can I show the Continue button only after the typewriter has finished?

    There will be no problem updating any of the assets (Dialogue System, Quest Machine, Love/hate), if Im using them already in my project right?
     
    Last edited: Jun 10, 2020
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Set the Dialogue Manager's Continue Button dropdown back to Never. This makes it never show the button automatically. Then configure the typewriter effect's OnBegin() event to deactivate the continue button and OnEnd() to activate it.
    Configure the typewriter's OnCharacter() event to deactivate the button and OnEnd() to activate it.

    It should be fine, but make a backup beforehand just in case. Note that Quest Machine's minimum Unity version is now Unity 2018.4. Love/Hate and the Dialogue System still run in 2017 or higher. All are tested through Unity 2020, btw.
     
    Last edited: Jun 10, 2020
  3. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    425
    I tried it with the events but doesnt work (sometimes it activates but doesnt wait and goes to the next option). I think even if it did work there would be another problem showing that Continue button even when I have player options.
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Sorry, leave the Continue Button dropdown at Always or Optional/Never Before Response Menu. Configure the typewriter's OnCharacter() event to deactivate the button and OnEnd() to activate it.
     
  5. Kunalz

    Kunalz

    Joined:
    May 11, 2018
    Posts:
    16
    I'm liking the asset so far but how would I use the Dialogue System along with my other game implementions that have their own scripts etc.

    For example, I have an inventory system and my items are scriptableobject, and for quests I'd like the Dialogue system to access my inventory to see if it has a item for the quest. How can I link the conditions for quests with my inventory and so on.

    Same thing for conversations, where lets say a police will check my inventory and say the appropriate dialogue if the player has a certain item in his inventory
     
    Last edited: Jun 11, 2020
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Hi @Kunalz - Thanks for using the Dialogue System!

    I'll assume your scripts already have C# methods to check the quantity of an item in your inventory, and to add and remove items. Simply register those C# methods with the Dialogue System's Lua environment using Lua.RegisterFunction as described here: Registering Functions. At that point, you can enter them directly into your conversations' Conditions and Script fields, and also use them in [lua(code)] markup tags in your quest entries if you want to show a counter in the quest tracker HUD or quest log window.

    For convenience, you can also create a Custom Lua Function Info asset that defines the signatures of your C# methods (i.e., what parameters they have). This will make them available in the "..." dropdown menus of the Conditions and Script fields so you don't have to type them manually.
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Updated Adventure Creator, Corgi Integrations Available

    The Dialogue System Extras page has an updated Adventure Creator integration. Adventure Creator 1.71 introduced some changes that called for an updated DS integration package. The package updates the integration so it once again shows the mouse cursor during DS conversations, and the example scene is now based on the revamped AC example scene that uses Timeline.

    The Extras page also has an updated integration for Corgi Platformer Engine 6.5.
     
  8. Kunalz

    Kunalz

    Joined:
    May 11, 2018
    Posts:
    16
    Yeah, I got the methods for adding, removing, checking etc.

    I'm gonna give it a try again and hope that I can follow your steps. I'm not so familiar with Lua scripting and how it works lol but ill give it a go.

    Also is there a tutorial video for this? and are you planning on doing one if there isn't? I think it will be really helpful if you did. Just something basic that shows how to use other script's methods, methods with parameteres and changing variables in conversation and quest stuff.
     
    TonyLi likes this.
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    That's a great idea. I'll try to record one by the end of next week.
     
    Kunalz likes this.
  10. Kunalz

    Kunalz

    Joined:
    May 11, 2018
    Posts:
    16
    I appreciate that, Thank you! I will be looking forward to it.
     
  11. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    425
    Hello,

    I was wondering if there is a way to cancel a conversation while the typewriter is working in progress and we have a Continue button visible (2 NPC nodes connected). The DialogueManager has "CancelConversation" set to "E", but it only works if there is a player responses visible. I tried setting "CancelSubtitleInput" also to "E", but it won't cancel if I have a continue button, basically I cant exit the dialogue at that point.

    It will also be cool to have timeout for the Continue button to auto select it.
     
    Last edited: Jun 12, 2020
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    The Dialogue Manager's Input Settings > Cancel Subtitle Input should still cancel the subtitle. If the next thing after the subtitle is a response menu, it will immediately show the response menu. If there is nothing after the subtitle, it will end the conversation.

    However, you can also end the conversation using DialogueManager.StopConversation().

    I don't understand. Can you please clarify?
     
  13. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    425
    I managed to find a solution to my second problem. Basically it presses the Continue button if the user forgets to click it. I think you have the same functionality, but to select an option from the player responses, I wanted it only for Continue button. (HideContinueButtonOnContinue must be true).

    Code (CSharp):
    1.     public class MyUiContinueButtonFastForward :  PixelCrushers.DialogueSystem.StandardUIContinueButtonFastForward
    2.     {
    3.         [SerializeField] private bool _hasTimeout;
    4.         [SerializeField] [ShowIf("@_hasTimeout")] private float _timeout = 8;
    5.      
    6.         private IEnumerator AutoContinueTimeout()
    7.         {
    8.             yield return new WaitForSeconds(_timeout);
    9.             OnFastForward();
    10.         }
    11.      
    12.         private void OnEnable()
    13.         {
    14.             if (!_hasTimeout) return;
    15.             StartCoroutine(AutoContinueTimeout());
    16.         }
    17.  
    18.         private void OnDisable()
    19.         {
    20.             StopAllCoroutines();
    21.         }
    22.     }
    I have stacked NPC dialogues like 4-5 in a row and even if I press that Escape key it only displays the full subtitle, then goes forward and waits until Response menu is reached, then it closes the conversation. It will be good if It closed the conversation at any time even if Continue button was coming next instead of Response menu. I will see if I can integrate it. I kinda don't want to write new code a few days before major release though :D
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    @skinwalker - Instead of that script, you could add these sequencer commands (typically to your Dialogue Manager's Default Sequence):

    Delay(8)@Message(Typed)->Message(Timeout);
    Continue()@Message(Timeout)

    The first line starts an 8-second timer as soon as the typewriter has finished. When the time is up, it sends a sequencer message "Timeout".

    The second line waits for the "Timeout" message and simulates a continue button click.
     
    skinwalker likes this.
  15. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    425
    Didn't manage to do the same thing, I think its because I have too many default sequences

    Code (CSharp):
    1.  
    2. AudioWait(entrytaglocal);
    3. Delay({{end}});
    4. Delay(4)@Message(Typed)->Message(Timeout);
    5. Continue()@Message(Timeout);
    6.  
     
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    @skinwalker - I don't understand. Is your sequence working? BTW, if you're using a continue button and the timeout, you may not need this line:

    Delay({{end}});
     
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Clam Man 2 Released on itch, Available on Steam June 19

    Clam Man 2: Open Mic, made with the Dialogue System for Unity, was released on itch.io to rave reviews. You can wishlist it on Steam for its June 19 debut there. It's voice acted and being praised for its witty comedy.



    ---

    Gestalt: Steam & Cinder in Guerilla Collective June 13

    Check out metroidvania RPG Gestalt: Steam & Cinder, made with the Dialogue System for Unity, in the Guerilla Collective tomorrow, June 13.

    upload_2020-6-12_21-19-11.jpeg

    ---

    Steam Summer Game Festival

    Next week I'll try to put together at least a partial list of Dialogue System-powered games that are being featured in the Steam Summer Game Festival, including Gestalt, Dwerve, Framing Dawes, and Legends of Ethernal, shown below.



    Is your game going to be in the Festival? Let me know!
     
  18. Kunalz

    Kunalz

    Joined:
    May 11, 2018
    Posts:
    16
    Hi, just wanted to let you know that I figured out how to do the Register Function stuff and on using it in script and conditions.

    Theres one thing I wanted to ask, which is for the variable tab. Is there an easier way to read my variables in my character class. Lets say I have public int Strength = 10. I want to be able to retrieve/read that from the variable tab. I can make a method GetStrength() and SetStrength(int amount) to do this but is there an easier way?

    And how can I put it in the Variable tab dropdown rather than Custom dropdown tab if I used the method way.

    Thanks
     
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Hi @Kunalz - Variables in the Dialogue Editor's Variables tab will be in the Dialogue Systems Lua environment at runtime. In your C# scripts, you can use DialogueLua.GetVariable() and SetVariable() to access them:
    Code (csharp):
    1. int numApples = DialogueLua.GetVariable("NumApples").asInt;
    Variables in your C# scripts will not be in the Lua environment. You can use your custom Lua functions to access them. If you add the functions' info to a Custom Lua Function Info asset, they will always be in the Custom dropdown. However, you can use forward slashes to organize them into a submenu inside the Custom dropdown if that's helpful:

    upload_2020-6-14_8-49-50.png

    upload_2020-6-14_8-49-38.png
     
  20. ash4640

    ash4640

    Joined:
    Jan 19, 2018
    Posts:
    61
    A simple question probably many have got an answer to already,
    - the assets does not have a parent folder when I try importing it, it overwrites the plugin folder and the editor folder, so basically conflicts with existing assets with same folder names, how I do I avoid this or add a parent folder East Dialou or something like that so it does not overwrite or conflicts with asset folders with same names
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Hi - Generally speaking, all assets are supposed to be in Plugins. (Not every publisher is consistent about following those guidelines, however.)

    The Dialogue System imports into Plugins/Pixel Crushers/Common and Plugins/Pixel Crushers/Dialogue System. As long as other assets do not import into those same folders, there should be no conflict. If you're seeing an issue, please PM me your Unity Asset Store invoice number.

    BTW, the Dialogue System also imports some files into other special Unity folders: Gizmos and Editor Default Resources. Unity makes these folder names mandatory; you should not rename them.
     
    Last edited: Jun 14, 2020
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Video Tutorials - Making Your C# Scripts Accessible to Conversations, How to Use Scene Events

    A couple of requested new video tutorials are now available:



     
  23. nichjaim

    nichjaim

    Joined:
    Apr 23, 2020
    Posts:
    25
    My project is splitscreen local multiplayer and needs to be able to support multiple independent dialogues going at once. I understand that i'm supposed to check simultaneous conversations in the dialogue manager but i'm unsure of what exactly that does. I need to be able to choose what canvas a certain dialogue ui will be placed in and as far as I can tell only one dialogue UI at a time is supported and for only one canvas. Can this asset do this stuff out of the box or do I need to extend and customize certain scripts or do I maybe need to use multiple dialogue managers? Sorry for all the questions, I looked in the documentation but wasn't sure where to find the material for these subjects.
     
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Hi - No need to customize anything. Set up a dialogue UI for each player, for example top/bottom or in the four corners. Add an Override Dialogue UI to each player's GameObject, and assign the player's dialogue UI.
     
    nichjaim likes this.
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Steam Summer Game Festival: Dwerve

    This week during the Steam Summer Game Festival, play a free demo of Dwerve, made with the Dialogue System for Unity.

    upload_2020-6-16_19-55-35.png

    It's a super fun tower defense dungeon crawler RPG with pixel art by Pixel Pete:

     
    Last edited: Jun 19, 2020
  26. Froghuto

    Froghuto

    Joined:
    Oct 4, 2012
    Posts:
    60
    Is there a way to execute lua code at the end of a dialogue entry node, i.e. when you press continue?
    In my usecase we have a dialog that branches with conditions, and at the end of one branch I want to set a variable (once the last diealoge entry is finished by pressing continue). I though I could add a group node after the last dialogue entry node, but the lua on this group node gets executed at the start of the previous dialoge entry. Ideally I would like to have the lua code inside of the dialogue db because that makes it easier to find everything.
     
  27. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Hi - A dialogue entry node's Script field is always guaranteed to run at the start of the node.

    To run Lua code when the player clicks the continue button, just add another node. Put your Lua code in its Script field, and set the Sequence to None(). (You can click the Sequence field's "+" menu and select "None()" from the dropdown menu. No need to type anything.)
     
    Froghuto likes this.
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Steam Summer Game Festival: Framing Dawes

    This week during the Steam Summer Game Festival, play a free demo of Framing Dawes, a dark fantasy adventure game with wonderful Burtonesque hand-drawn art, made with the Dialogue System for Unity. Framing Dawes puts the Dialogue System's Adventure Creator integration to great use.

     
    Last edited: Jun 17, 2020
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Steam Summer Game Festival: The Way of Wrath

    This week during the Steam Summer Game Festival, play a free demo of The Way of Wrath, made with the Dialogue System for Unity. It's a story-driven, turn-based tactical RPG that uses the Dialogue System and Quest Machine with ORK Framework integration and UMA.

     
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Steam Summer Game Festival: Beyond Mankind

    This week during the Steam Summer Game Festival, play a free demo of Beyond Mankind, a sci-fi, time-travelling first-person RPG made with the Dialogue System for Unity.

     
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Steam Summer Game Festival: Gestalt: Steam & Cinder

    This week during the Steam Summer Game Festival, play a free demo of metroidvania RPG Gestalt: Steam & Cinder, made with the Dialogue System for Unity.

     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Steam Summer Game Festival: Suzerain

    This week during the Steam Summer Game Festival, play a free demo of the political simulator Suzerain, made with the Dialogue System for Unity.

     
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Steam Summer Game Festival: Deathbulge: Battle of the Bands

    Through June 22 during the Steam Summer Game Festival, play a free demo of Deathbulge: Battle of the Bands, made with the Dialogue System for Unity.

     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Steam Summer Game Festival: Legends of Ethernal

    Through June 22 during the Steam Summer Game Festival, play a free demo of Legends of Ethernal, made with the Dialogue System for Unity.




    Apologies to all the other great Dialogue System-powered games in the Steam Summer Game Festival that I've missed. If you'd like to mention yours here, too, please feel free to post or PM me!
     
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Clam Man 2: Open Mic Released on Steam

    Comedic RPG Clam Man 2: Open Mic, the prologue to Clam Man 2: Headliner, both made with the Dialogue System for Unity, is now available as a free download on Steam.

     
  36. nichjaim

    nichjaim

    Joined:
    Apr 23, 2020
    Posts:
    25
    Two questions, the inspector window seemed to have stop showing info on dialogue conversation nodes when they're highlighted so now I can't edit any of them, is that a bug or did I accidently mess with some setting? Also, how do I get the info of the various ongoing conversation data, I know I can use DialogueManager.currentConversationState for when there is only ever one conversation but what do I use for local multiplayer where I need to get specific conversation when multiple conversations are going at once?
     
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Are you using Unity 2019? In several versions of 2019, the Inspector view can get into a bad state, entirely unrelated to the Dialogue System, and it won't update. Try closing the Inspector view and opening a new one.

    Two ways:

    1. When a conversation gets to a subtitle or response menu, it will run OnConversationLine or OnConversationResponseMenu methods on the Dialogue Manager and the two primary participants. (See Script Events.) Say you start conversation 1 on NPC A, and conversation 2 on NPC B. If NPC A receives the OnConversationLine event, then you know it's for conversation 1.

    2. In addition, the Dialogue System maintains a list of active conversations in DialogueManager.instance.activeConversations. Each conversation record has a conversationController with a currentState property that's the same as DialogueManager.currentConversationState but for a specific conversation. Newly-started conversations are always added to the end of the list, so as soon as you start conversation 2, the conversation record for conversation 2 will be at the end of DialogueManager.instance.activeConversations.[/quote][/QUOTE]
     
    nichjaim likes this.
  38. SupremeSmash

    SupremeSmash

    Joined:
    Nov 30, 2018
    Posts:
    28
    I integrated the Dialogue System with Corgi Engine and everything is working as it should - in the guidance the image shows the conversation being played out in the Corgi Engine dialogue box

    My conversations and the example scene are played out in the Standard Dialogue UI, how would I go about setting it up like the image above
     
  39. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Hi @SupremeSmash - Add the prefab "ConversationZone" as a child of the NPC. This prefab has everything needed to interact with the NPC, start a conversation, and show it in the black cartoon bubble shown in your post. To see an example, open the scene Pixel Crushers / Dialogue System / Third Party Support / Corgi Support / Example / Corgi Example, and inspect Dude-DS1.
     
  40. SupremeSmash

    SupremeSmash

    Joined:
    Nov 30, 2018
    Posts:
    28
    Hi @TonyLi, Dude-DS1 responses also shows in the Standard Dialogue UI

    Unity Version 2019.3.4f1
    Corgie engine v6.5
    Dialogue System v 2.2.7
     

    Attached Files:

  41. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Hi @SupremeSmash - Sorry it's not very clear, but if you change the Dialogue Actor component's Use Menu Panel For dropdown to Me And Responses To Me, it will work the way you want:

    upload_2020-6-20_16-29-40.png

    If you want the menu options to show in a bubble on the player instead of the NPC, leave the dropdown at Only Me, and add a Dialogue Actor to the player. Add a bubble response menu panel to the player, and assign it to the Dialogue Actor. I've attached an example scene that does that in case you're curious.

    upload_2020-6-20_16-34-40.png
     

    Attached Files:

    SupremeSmash likes this.
  42. SupremeSmash

    SupremeSmash

    Joined:
    Nov 30, 2018
    Posts:
    28
    Thank you. My bad, I though I had looked through all the drop downs.

    Awesome asset by the way!
     
    TonyLi likes this.
  43. nichjaim

    nichjaim

    Joined:
    Apr 23, 2020
    Posts:
    25
    How do you change variable values through script code? I looked in the variable section of the documentation and I didn't see anything for that, though I'm probably just missing it.
     
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Hi @nichjaim - Use DialogueLua.SetVariable() to set a Dialogue System variable in a script. Use DialogueLua.GetVariable() to get a variable value. Example:

    Code (csharp):
    1. using PixelCrushers.DialogueSystem;
    2. ...
    3. int score = DialogueLua.GetVariable("Score").asInt;
    4. DialogueLua.SetVariable("Score", score + 5);
    To go the other way and get a script variable from inside a conversation, register a Lua function (video tutorial).
     
    nichjaim likes this.
  45. nichjaim

    nichjaim

    Joined:
    Apr 23, 2020
    Posts:
    25
    I need to get the buttons when they are available for a section of dialogue whether that be the continue button for a standard section or all the response buttons for a response section but I'm not sure what events are called when these buttons are ready for any particular dialogue section. Do the standard and response sections use different events or do they use the same event and I need to check a certain value to determine if it's a standard or response section. Sorry if question was a little confusing, wasn't sure exactly how to word my problem. Also, what event is called when dialogue is completely finished. Again, sorry for all the questions, I had more questions but I found the answers to those in the documentation, so just know I only ask you stuff as a last resort.
     
    Last edited: Jun 23, 2020
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Hi @nichjaim - You can add a script to handle those events (see Script Messages) or use a Dialogue System Events component. Here's an example using script messages:
    Code (csharp):
    1. // Put in a script on Dialogue Manager so script will receive messages.
    2.  
    3. void OnConversationLine(Subtitle subtitle)
    4. {
    5.     Debug.Log("Showing subtitle: " + subtitle.formattedText.text + ". Continue button may be visible.");
    6. }
    7.  
    8. void OnConversationResponseMenu(Response[] responses)
    9. {
    10.     foreach (var response in responses)
    11.     {
    12.         Debug.Log("Response button: " + response.formattedText.text);
    13.     }
    14. }
    15.  
    16. void OnConversationEnd(Transform actor)
    17. {
    18.     Debug.Log("Conversation ended: " + DialogueManager.lastConversationStarted);
    19. }
    You can also look at ConversationLogger.cs for another example.
     
    nichjaim likes this.
  47. nichjaim

    nichjaim

    Joined:
    Apr 23, 2020
    Posts:
    25
    For any potential dialogue node, I need to be able to change between different actor portrait sprite variants, Set which actor is assigned to which portrait UI image and which actor is speaking. Is there a easy built-in way to do those or do I need to get a little creative?
     
  48. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Hi @nichjaim -

    To change actor portraits for a node, in the Dialogue Editor assign portrait images to the actor. You'll see that each image is assigned a number, starting from 1. In the node's Dialogue Text, use the [pic=#] markup tag. For example, to show portrait image #2:
    • Dialogue Text: "That makes me happy! [pic=2]"
    To set which actor is assigned to a node, inspect the node. In the Inspector view, the Actor dropdown specifies the node's speaker.
     
    nichjaim likes this.
  49. jamesccc

    jamesccc

    Joined:
    Nov 17, 2012
    Posts:
    5
    Hi, sorry if i asked a really simple question. I am using my own sequence camera along with custom angle, may i ask how to change the initial camera position? My sequence camera is a prefab with position zero.

    I use this to focus camera on an object "Camera (Height13, speaker, 3); Delay (5)" but how to change the starting position to my scene camera position? Thank you
     
    Last edited: Jun 26, 2020
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,729
    Hi @jamesccc - If you omit the duration, the camera will immediately cut to the specified angle. Example:

    Camera(Closeup, speaker);
    Camera(Height13, speaker, 3);
    Delay(5)

    The sequence above will immediately move the camera to the Closeup angle on the speaker. Then it will gradually move the camera over 3 seconds to the Height13 angle.
     
unityunity