Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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. EDarkness

    EDarkness

    Joined:
    Feb 1, 2013
    Posts:
    506
    Well, what I mean is, I don't even want to deal with having a separate GUI prefab. In my main GUI, I have a set of windows used for conversation. Using the prefab conversation NGUI UI keeps messing up my camera, current UI, and screens. I'm gonna see if I can mess around with it a bit, but it's pretty frustrating.
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    EDarkness, you don't need a separate GUI prefab. You can do this all in your main GUI. Just implement those methods (ShowSubtitle, etc.) in any script. Then just assign the object containing that script to the Dialogue Manager's Dialogue UI property.

    Say you already have a script named MyGUI.cs that works with your main GUI. For example:
    Code (csharp):
    1.  
    2. public class MyGUI : MonoBehaviour {
    3.  
    4.     public void AddTextToChatWindow(string someText) {
    5.         // (Your NGUI code to add text to the chat window.)
    6.     }
    7.  
    8.     // ... (and more methods - health meter, action bar, etc.) ...
    9.  
    10. }
    11.  
    And say that you've added MyGUI.cs to a GameObject named MyGUIObject.


    To make it work with the Dialogue System, modify it to look like this:
    Code (csharp):
    1.  
    2. using PixelCrushers.DialogueSystem;
    3.  
    4. public class MyGUI : MonoBehaviour, IDialogueUI {
    5.  
    6.     public void AddTextToAlertWindow(string someText) {
    7.         // (Your NGUI code to add text to the chat window.)
    8.     }
    9.  
    10.     public void ShowAlert(string message, float duration) {
    11.         AddTextToChatWindow(message);
    12.     }
    13.  
    14.     public void HideAlert() {} // Don't do anything; main GUI scrolls it away if necessary.
    15.  
    16.     public void Open() {} // Don't do anything, since main GUI is already open.
    17.  
    18.     public void Close() {} // Don't do anything, since main GUI always stays open.
    19.  
    20.     // ... (and more methods - health meter, action bar, etc.) ...
    21.  
    22. }
    23.  
    In the example above, alerts are sent to a hypothetical chat window in your GUI.

    For clarity, I only included the Show/HideAlert(), Open(), and Close() methods. You'd also need to implement Show/HideSubtitle(), Show/HideResponses(), and Show/HideQTEIndicator(), which could be empty methods if you don't need them.

    Then assign MyGUIObject to the Dialogue Manager's Dialogue UI property.

    Don't let the prefab thing throw you. It's just a convenience. If you've assigned a prefab to the Dialogue UI property, the Dialogue Manager will automatically instantiate it for you. But if it's already in the scene, it'll just use it.

    If I misunderstood you, and if you want to use the NGUI implementation provided in the third party support package (NGUIDialogueUI.cs) but in your own NGUI windows, please let me know and we can discuss it. Since you say you have your own windows that you want to use, I'm guessing that this isn't the case. But if it is, this is possible -- but there are gotchas because the NGUIDialogueUI implementation, while very flexible, is set up to use specific controls that may conflict with what's already in your windows.
     
    Last edited: Feb 17, 2014
  3. EDarkness

    EDarkness

    Joined:
    Feb 1, 2013
    Posts:
    506
    Thanks for the information. I think I understand it well enough.

    A couple of questions.

    1. How do I set it up if I want there to be a series of exchanges between the PC and the NPC before some options pop up?
    2. What the best way to put a pause (where the player can click a button to move on) between lines of dialog?
    3. Also, how do I get the name of the two entities chatting when the chatting is initiated?
     
    Last edited: Feb 17, 2014
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    On the Dialogue Manager, under Input Settings, untick "Always Force Response Menu". This way, if the PC only has only line, he or she will say it automatically instead of options popping up.

    Configure the button to send "OnConversationContinue" to the Dialogue Manager object.

    On the Dialogue Manager, under Subtitle Settings, tick Wait for Continue Button. In version 1.1.7.1, which is being uploaded to the Pixel Crushers customer download page right now, Wait for Continue Button has been replaced by a drop-down with variations on continue button behavior. (Thanks, speedis, for the suggestion!) If ticked, the Dialogue Manager will wait until it receives an "OnConversationContinue" message.

    In the database, a conversation defines an actor and a conversant, but conversations can actually occur between any number of characters. For each line (subtitle), the Dialogue System puts together a Subtitle structure with information about the line.

    IDialogueUI's ShowSubtitle() method receives this Subtitle structure, which provides the following info:
    • speakerInfo and listenerInfo: CharacterInfo structures containing info about the speaker and listener.
    • formattedText: A structure containing formatted text info. Use formattedText.text if you just want the plain text.
    • sequence and responseMenuSequence: The cutscene sequences being played during the subtitle and during the response menu. You don't need to do anything with these.
    The CharacterInfo structure provides this info:
    • id: The actor ID as defined in the dialogue database.
    • characterType: PC or NPC.
    • nameInDatabase: The actor name as defined in the database.
    • Name: The name of the actual participant in the active conversation. You'll probably want to use this property. It's possible for you to define a multi-purpose conversation (e.g., "Generic Shopkeeper Conversation") in the database and use it for any number of actual characters in-game (e.g., "Tavernmaster Fred"). This property returns the actual character name.
    • transform: The transform of the character.
    • portrait: The portrait texture of the character, if you've assigned one in the database.
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    The Dialogue System for Unity 1.1.7.1 is now available on the customer download page. PM me your invoice number if you need access.

    This is a small release that implements some customer requests:
    • Improved: Replaced Dialogue Manager's Wait For Continue Button with multiple new options (Never, Always, Optional Before Response Menu, and Hide Before Response Menu).
    • Improved: Added PC Name Image properties to the response menu in dialogue UIs. When the response menu is displayed, you can now show the PC's name and portrait image as well as the NPC subtitle reminder's NPC name and portrait image.
    • Improved: Dialogue database merging now has the option to assign unique IDs to prevent conflicts.
    • Changed: Removed the obsolete Raw|Edit bar in the dialogue database inspector, since editing has been moved to the Dialogue Editor window accessible through the inspector's Edit... button.
    • (NGUI) Changed: NGUIDialogueUI was finally converted to use the AbstractDialogueUI base class. There should be no impact to your existing NGUI dialogue UIs.
     
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    The next release will feature a new quest log window system that works similarly to the dialogue UI. You'll be able to use any GUI system and drop in your own GUI controls to customize its look and feel.

    It will work like the current quest log window, with these additional features:
    • If the quest has a field named "Abandonable" set to true, the player can click an Abandon Quest button to abandon the quest.
    • If the quest has a field named "Trackable" set to true, the player can toggle quest tracking, which will set another field named "Track" to true or false. Your gameplay HUD can then show tracking information however you want.
    If you have any other feature suggestions, please let me know in the next few days as I finalize the design. Thanks!
     
  7. EDarkness

    EDarkness

    Joined:
    Feb 1, 2013
    Posts:
    506
    Okay. Thanks for the heads up.

    Another question. Do all exchanges have to be advanced with a "continue"? I have an exchange, but it only prints the NPC's first line. The PC's line shows up a long time later, but only after I close the conversation and open it again.


    I mean, when the chat window is opened, I'd like to know who the player is chatting with instead of waiting for the first subtitle to be sent. I suppose I could just check my own NPC data and use that. Hmmm...probably the best way now that I think about it.
     
    Last edited: Feb 18, 2014
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Try setting Dialogue Manager's Default Sequence to "None()" (without quotes) and set Continue Button to Never. It sounds like it's either waiting for the continue button or for the default sequence to finish. The initial default sequence waits a number of seconds based on the length of the line.


    Easy: DialogueManager.CurrentActor and DialogueManager.CurrentConversant. The current actor is usually the player, and the current conversant is usually the NPC.
     
  9. EDarkness

    EDarkness

    Joined:
    Feb 1, 2013
    Posts:
    506
    Been putting this through the paces the last few days and I found a pretty serious issue that needs to be adjusted.

    First, let me say that while we CAN do this on a Mac, this piece of software was not designed to work on Macs. Without the use of Chat Mapper or something like that, the Unity dialogue editor is really not adequate for lots of dialog and complicated setups. At some point I'm going to need to switch to something else and that's really the reality of it all.

    So I found out that if you're using the Unity dialogue database setup and you need to change dialogue (i.e. you put something in the wrong order and need to move it around to put it right), the database entry gets messed up for using in the game and will stall. I've tried this multiple times and got the same result. I originally didn't know what I was doing and put a menu choice on the Player without a comment from the NPC. After realizing this, I went back and fixed in it the database. When I looked at the dialog in the database editor, it was right. However, when I tried to run the conversation in the game, it would stall after the Player response. No amount of manipulating things would fix it. So I had to delete the whole conversation and start from scratch. When I did this, it worked fine. Not sure what's going on behind the scenes, but it's really annoying. Now, I have to plan out the conversation way in advance on paper so that I don't mess it up when entering so that it works fine in the game.

    Right now, my dialogues are short, so it's not too much of a problem, but it's something that needs to be looked at.
     
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi EDarkness, I'm sorry you're frustrated with the dialogue editor window. Are you using version 1.1.7 or higher? Extra handling was added to 1.1.7 to help prevent issues like this. If you wouldn't mind emailing me a dialogue database that exhibits the stall, I'd like to look into it and give you a more detailed response. I'll PM you the customer download page since 1.1.7.1 isn't yet on the Asset Store.
     
  11. EDarkness

    EDarkness

    Joined:
    Feb 1, 2013
    Posts:
    506
    I'm using the most recent version from the Asset Store. I'm hesitant to change it now since I have to keep editing it to work with my game and changing versions is getting tiring. Also, I think I have the link to the download space. I don't have a dialog that in the database that doesn't work now, since I deleted it and started over. If it happens again (and it probably will), then I'll send it to you.

    I've been playing with this all afternoon and again my dialog is all messed up. It started changing the Actor and Conversant and when doing so the conversation gets messed up and now it's ruined. This is the fourth time with this same conversation. I don't know how to fix it. If any kind of editing goes on in the conversation, it gets messed up and will stall. Not sure what else to do, but as of now this is pretty much unusable.

    EDIT: So how can I send you this dialog to take a look at?

    EDIT2: Okay. Maybe the problem isn't really the dialog editor, but more how it handles the wait for a continue. I decided to turn off the Wait for Continue option and after some time it'll go through the conversation and get to the responses without any trouble. However, every time I have the Wait for Continue option on, it will only do the first continue and stall after that. I ran multiple tests and this seems to always be the case. Automatic flowing through the conversation will work fine. Perhaps that'll help. Of course, there is a possibility that this has something to do with the database. Perhaps that's something you can work on to track down the problem.
     
    Last edited: Feb 20, 2014
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    It sounds like the issue is in handling Wait for Continue. I think we can get a resolution for you quickly.

    I strongly recommend subclassing or otherwise working with the existing codebase whenever possible, rather than modifying it directly. That's the reason for providing interfaces such as IDialogueUI as well as numerous callbacks such as OnConversationStart, OnConversationLine, etc. Of course, the source is included just so you can edit it if necessary. But it will make it hard for you to incorporate enhancements provided in newer versions. The Dialogue System has been used very successfully on all platforms, including Mac and iOS, by a broad range of developers from independents to big game studios, universities, and other large organizations. To my knowledge, none of them has had to modify the source code. I'd like to think this is partly because I try to be very responsive to customer feature requests. If there's a feature that you need, please let me know. I'll do my best to incorporate it quickly.

    If you're committed to maintaining a separate, custom-edited branch, and if you're not already at 1.1.7, you should be able to drop in the 1.1.7 versions of Scripts/Core/Editor/* to get the improvements to the Dialogue Editor window. (Save a backup copy first in case you've made a custom edit that's incompatible.) You can't do the same with 1.1.7.1, which replaces the Wait for Continue checkbox with a drop-down containing more options. The change in 1.1.7.1 reaches into more files, including ConversationView.cs, since it needs to know how to handle the new options.

    Please email it to tony (at) pixelcrushers (dot) com.

    When Wait for Continue is ticked, the Dialogue System will wait until it receives an "OnConversationContinue" message, as documented here. In the example scenes, the UI has a continue button that sends OnConversationContinue when clicked. It sounds like your UI is set up to do something similar, since it works for the first line. Please check your code to make sure that it will continue to send OnConversationContinue messages as necessary throughout the conversation. You can also temporarily change the Dialogue Manager's Debug Level to "Info". It will log a lot of information, but it may help you track down the issue.

    If you'd like to email me an example project that exhibits the problem, I'll be happy to take a look at it.
     
    Last edited: Feb 20, 2014
  13. EDarkness

    EDarkness

    Joined:
    Feb 1, 2013
    Posts:
    506
    The only thing I need is for all barks to be attached to my own game object attached to my NPCs. So I have to modify the code to get this to happen.


    Well, it took a bit, but I figured it out. Seems to be working now. Yay!
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Can you use the IBarkUI interface? It only has one method to implement: Bark(subtitle). (It also has a property called IsPlaying so you can tell the Dialogue System when the bark is done.) There's a template in Scripts/Templates; you can just make a copy of the file and paste in your code.

    Barks look on the speaker's transform for a script that implements IBarkUI. In your bark trigger, you can point the speaker to your special game object.

    I'm glad it's working now! If you run into any other issues, please feel free to send me a dialogue database and/or project to look at.
     
    Last edited: Feb 20, 2014
  15. EDarkness

    EDarkness

    Joined:
    Feb 1, 2013
    Posts:
    506
    Is there any way to make sure a particular option is always at the bottom of a list?

    Also, how do I check for the end of the conversation? What I want to happen is the conversation is disengaged and then the NPC barks the "goodbye" message. I'm not sure how to set that up.
     
    Last edited: Feb 21, 2014
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    You'll probably want to use the [position #] tag in your dialogue text. If, on the other hand, you only want to consider showing an entry if no higher priority options are valid, you can set the Priority of its link.

    You can set up a Bark On Dialogue Event trigger to automatically bark On Conversation End, or in a script you can hook into the OnConversationEnd() message.
     
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Chat Mapper users: Urban Brain Studios just released Chat Mapper 1.7 and a new publishing platform, http://play.chatmapper.com, powered by the Dialogue System. It's in the early stages; development will be directed by what features users ask for. Also, if you're using Chat Mapper with your Dialogue System-based project, you can submit it to the Chat Mapper Showcase!

    An upcoming release of the Dialogue System will take advantage of new features in Chat Mapper 1.7, including the [var] tag and the ability to export dialogue databases to Chat Mapper via XML.

    Chat Mapper certainly isn't required to take full advantage of the Dialogue System, but it's a great environment for heavy-duty writing. We've arranged a 10% promotional discount code with Urban Brain Studios. To get the code, please PM me your invoice number.


    Chat Mapper 1.7 Released; New Publishing Platform

    Chat Mapper 1.7 has officially been released and is now available from the download page! Since version 1.4, we have made several enhancements and some important productivity improvements, including:
    • The ability to import XML and apply templates to existing projects
    • Connectors between different Chat Mapper files that are dynamically linked together during simulation
    • Improved copy and paste system with the ability to copy and paste nodes between files
    • Reviewer tools including the ability to lock nodes for editing, set review status, and leave comments (for license holders)
    • Improved editor productivity including Ctrl+Mousewheel zoom, new variable value dialogue tag, and improved simulator GUI
    For a full list of changes, check out the what's new section of our website.

    Introducing play.chatmapper.com: a new publishing platform

    In the coming months, we plan to develop and release a new platform to publish, share, and showcase your Chat Mapper projects. Integrating cloud storage for Chat Mapper projects as well as advanced 3D game simulation, play.chatmapper.com seeks to offer a new medium to collaborate and enjoy your projects.

    Proposed features include:
    • Cloud storage of your Chat Mapper projects
    • Public and private project sharing
    • Instant online simulation with 3D avatars
    • Portfolio with customizable page and URL
    Please click here to take a short survey about this new offering

    Submit your project to the Chat Mapper Showcase

    Along with the new Chat Mapper website, we have launched a showcase to highlight some of the unique and interesting project made possible by Chat Mapper in the areas of entertainment, e-learning, and research.

    If you would like to submit your project for inclusion in our showcase, please send us a note through our contact page with a description of your project.

    As always, thank you for your continued support!

    The Chat Mapper Development Team
    www.chatmapper.com
     
    Last edited: Feb 21, 2014
  18. EDarkness

    EDarkness

    Joined:
    Feb 1, 2013
    Posts:
    506
    Well, what happens when the dialogue reaches an END? Does something get called automatically? Can I intercept this call with my own thing?

    EDIT: Reading the documentation, it says that an OnConversationEnd() is sent to the participants. Unfortunately, I can't get it to trigger, and I'd prefer the trigger to happen with the manager I created and I want to know how to get this to work.
     
    Last edited: Feb 22, 2014
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi EDarkness, OnConversationEnd() is broadcast to the Dialogue Manager object as well as the participants. So if your manager script is on the Dialogue Manager object or one of its children, you can add a method like this:
    Code (csharp):
    1.  
    2.     public void OnConversationEnd(Transform actor) {
    3.         // The conversation just ended. Do something here.
    4.     }
    5.  
    Otherwise, if your manager object is somewhere else, you can put a script like this on the Dialogue Manager object:
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using PixelCrushers.DialogueSystem;
    4.  
    5.  public class NotifyMyManagerOnConversationEnd: MonoBehaviour {
    6.  
    7.     public MyManagerClass myManager; // Point this to your manager.
    8.      
    9.     public void OnConversationEnd(Transform actor) {
    10.         myManager.DoSomethingAtEndOfDialogue(); // Tell your manager that the dialogue is done.
    11.     }
    12.      
    13. }
    14.  
    Note that it sends the transform of the participants. Each participant receives the transform of the other participant, so they know who they just finished talking with. For the Dialogue Manager, you can just ignore the value (it's set to the Actor, which is usually the player), but you still need to include it as the parameter for the method.
     
    Last edited: Feb 23, 2014
  20. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    The Dialogue System for Unity 1.1.7.2 has been submitted to the Asset Store and is available now on the customer download page! If you need access, please PM me your invoice number.

    This release includes a bug fix (Proximity Selector in 2D) and several smaller enhancements while development continues on the general-purpose, GUI-independent quest log window system and additional features to ensure unique IDs across dialogue databases.

    Version 1.1.7.2:
    • New: [var=VarName] dialogue text tag (introduced in Chat Mapper 1.7). You may find the syntax more convenient than [lua(Variable["VarName"])] -- plus, it works in Chat Mapper!
    • New: AudioWWW() sequencer command. Stream audio over the network!
    • Improved: When splitting a dialogue entry with pipes, items in the Audio Files field are now split into each new entry.
    • Improved: [pic=#], [pica=#], and [picc=#] tags are now recorded in FormattedText, but the Dialogue System still doesn’t do anything with them by default. This is primarily for Chat Mapper customers who use these tags.
    • Changed: Barks now also look on the barker’s children for a Bark UI component.
    • Fixed: Bug in ProximitySelector that wasn’t registering 2D triggers.
     
  21. Alarconte

    Alarconte

    Joined:
    Jan 8, 2014
    Posts:
    32
    Little question, after a night of searching around solutions.

    I'm making dialogues interaction only by keys (with a UnityGUI dialogue system), and I have two questions;

    Where is set which key works for selecting responses? (Right now (default I guess) is Space, but is a key I reserve to jump because there is real time movement inside conversations)

    There is a way to use Mousewheel to select responses? (It's not an option in Navigation of the Response Panel, for now I use a workaround solution).

    The Space as selector key is in the Dlls maybe? Is a thing I can change in the DialogUI template?

    Thanks.
     
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi, Alarconte! This is built into Unity GUI. It's not specific to the Dialogue System. I'll find out if Unity provides a way to change the key and get back to you.

    Not yet, but that's a good idea. I'll put it into the next release.
     
  23. DieHappyGames

    DieHappyGames

    Joined:
    Feb 24, 2014
    Posts:
    44
    Hey Tony, small problem that I'm guessing just needs a quick clarification...

    I'm trying to use the MoveTo sequence to move my player from one room to another (MoveTo(GreenRoomSpawnPoint, Player, 0)) and I'm getting an error that the target is null. In my example, both the target and the subject are the names of the GameObjects, and I'm guessing my problem is that while the subject is designed to accept the name of a GameObject in the scene, the target is designed to accept a Transform. Do I need to teak the syntax for my target somehow, or is it meant to receive Vector3 coordinates rather than an actual object name? Thanks for the clarification
     
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Sounds like it can't find GreenRoomSpawnPoint. Does this exactly match the name of the GameObject? Try setting the Dialogue Manager object's Debug Level to Info and run that sequence. It'll log a lot of information, but you should see the original sequencer command, followed by a version with the parameters filled in with the values it found in the scene.

    In the syntax:
    Code (csharp):
    1. MoveTo(target[, subject[, duration]])
    target and subject can be the names any GameObjects in the scene. Sorry, the manual page doesn't make that very clear. If you omit subject, it defaults to the current speaker. The rules for finding GameObjects are:
    1. If it's "speaker" or "listener", use the current speaker or listener.
    2. Otherwise find an active GameObject in the scene that matches the name (i.e., GameObject.Find()).
    3. Otherwise find an inactive GameObject in the scene, as long it's a child of an active GameObject.
    4. Otherwise find any match, including loaded prefabs.
    If you get stuck, you're welcome to email me a project that exhibits the issue, and I'll be happy to take a look. My email address is tony (at) pixelcrushers (dot) com.
     
  25. DieHappyGames

    DieHappyGames

    Joined:
    Feb 24, 2014
    Posts:
    44
    I notice that the Override Name field in the Useable script only overrides the name that's displayed when you approach/focus on the NPC - when you actually initiate the conversation, the name that displays in the portrait box seems to be pulled directly from the GameObject the script is attached to. Is there a way of making so that the Override Name also affects the name in the conversation or in a perfect world, where it could be separately overriden? In my use case, there are certain interactables where I want it to show the name when you approach, but no name in the conversation (in reality the name would be a single space). I realize I could accomplish this by changing the GameObject name to a single space, but for organization purposes in the hierarchy, this is not ideal, so I thought I'd see if I was missing something...
     
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    In the next release, there's a small script you can add to override the name. I plan to release it early next week.
     
  27. DieHappyGames

    DieHappyGames

    Joined:
    Feb 24, 2014
    Posts:
    44
    I'm running into an issue that's present in your demos as well, where if the player is in motion at the point where conversation is initiated, they're locked into their run animation (as a byproduct of disabling player controls with SetEnabledOnDialogueEvent). I thought this would be a quick fix of adding the SetComponentEnabledOnDialogueEvent to toggle the Player's Animator component, but when I try I get the console error "Don't know how to enable/disable Player.Animator"
     
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    In your conversation's START entry, set the animation to what you want it to be at the start of the conversation -- for example, set the START entry's sequence to "AnimatorPlay(Idle)". The Dialogue System doesn't force characters into an idle animation at the beginning of a conversation; what if, for example, you really want them to continue walking while they talk? This way, you have the flexibility to do whatever you want. Thanks for pointing this out in the demo; I'll force them to idle in the next release.

    If you really want the character to always start the idle animation at the beginning of all conversations, you can add a short script with a method something like this:
    Code (csharp):
    1.  
    2. public void OnConversationStart(Transform actor) {
    3.     myAnimator.Play("Idle");
    4. }
    5.  
     
  29. pixlweaver

    pixlweaver

    Joined:
    Dec 21, 2012
    Posts:
    92
    I have a couple small requests:

    1) A "notes" textfield for each dialogue entry in a dialogue database. I work with a team and often times have complex sequences in a dialogue entry. It would be awesome to be able to leave notes about how and why I set up a sequence so that other devs (or reminders to myself) can make sense of it easier.

    2) The sequence trigger component has a text field that does not expand based on it's content like the database does. I try to avoid using the component because of that (easier to keep it all in a database anyways). But would be nice if it would expand. Otherwise I have to view/edit the sequence text in a text editor and then copy/paste it into the text field.
     
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    I'll try to get these into the next release! :)
     
  31. pixlweaver

    pixlweaver

    Joined:
    Dec 21, 2012
    Posts:
    92
    Sweet, thank you!

    Another question...(sorry lol)...I'm looking to set database variables from a script but it seems the documentation is out of date? I do not see SetVariable or GetVariable under Pixelcrushers.DialogueSystem.DialogueLua.
     
  32. DieHappyGames

    DieHappyGames

    Joined:
    Feb 24, 2014
    Posts:
    44
    Thanks, I solved it by adding a StartSequenceOnDialogueEvent and used the sequence AnimatorFloat(Speed, 0), since my run animation is handled by the float value Speed - just thought I'd share this, since this is likely the case for anyone working in 2D
     
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Here's the documentation page on the DialogueLua class. GetVariable() and SetVariable() were introduced in version 1.1.6. Maybe you need to update? Version 1.1.7.2 was just released on the Asset Store. Here's a use example:
    Code (csharp):
    1.  
    2. using PixelCrushers.DialogueSystem;
    3.  
    4. void MoMoney() {
    5.     int coins = DialogueLua.GetVariable("Coins").AsInt;
    6.     DialogueLua.SetVariable("Coins", 2 * coins);
    7. }
    8.  
    Clever! I'll add this to the FAQ. Thanks for sharing it! I've also added AnimatorStateOnDialogueEvent and AnimationOnDialogueEvent in the next version.
     
    Last edited: Feb 27, 2014
  34. Novitch

    Novitch

    Joined:
    Jun 26, 2013
    Posts:
    3
    Hi,

    I'm very interested in using your system for a game I'm working on. I just have a few questions.

    1. Let's say the character can only answer in negative or positive. Can I change the text conversation options and use icons instead?

    2. In a FPS gameplay, can the dialogue system trigger itself upon entering a certain area / close by leaving it, and leave total freedom to the player by not using the mouse but the keyboard for dialogue?

    3. And if I'm using this system (keyboard for answers/total freedom to player) can the dialogue system also trigger itself on mouseOver for certain objects?

    If yes, are those built-in options or coding is needed?

    Thank you,
     
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi, Novitch! Yes, absolutely! When you build your UI visually in Unity GUI, NGUI, DF-GUI, or 2D Toolkit UI (or your own system if you don't want to use any of the built-in ones), just use icons for your player response buttons. Or, if you use any of the provided UI prefabs, just add your icons to the response buttons.

    Yes for both. The Dialogue System includes a large number of conversation triggers, including one that triggers when you enter or exit a trigger collider. With Unity GUI, you can use the mouse, keyboard, or gamepad. By default, keyboard/gamepad navigation is turned off, but it's just one checkbox on the dialogue UI. The other GUI systems have their own methods of keyboard/gamepad navigation, and the Dialogue System doesn't interfere with them. In all of them, you can also assign Unity buttons (e.g., "Fire1") or keys to each one (e.g., KeyCode.Y and KeyCode.N).

    It comes with a flexible selector component that can trigger on mouse clicks, but for mouseOver you'd need to write a small script like:
    Code (csharp):
    1.  
    2. void OnMouseOver() {
    3.     DialogueManager.StartConversation("My Conversation");
    4. }
    5.  
    With the same amount of code, you could trigger barks (non-interactive one-off lines) on mouseOver. For example, a character could look at the mouse cursor (using a cutscene sequence defined on the bark entry) and make a wisecrack at the player.

    With the exception of mouseOver, all of those and much more are built-in and require no scripting. There's also support for PlayMaker and plyGame. If I can answer any other questions, please ask any time!

    Complete documentation is also available at: http://pixelcrushers.com/dialogue_system/manual/html/index.html
    And video tutorials at: http://www.pixelcrushers.com/dialogue-system-tutorials/
     
    Last edited: Feb 27, 2014
  36. DieHappyGames

    DieHappyGames

    Joined:
    Feb 24, 2014
    Posts:
    44
    Hi Tony, I'm having trouble finding where this option is? The closest I found was the Enabled box for Navigation in the GUIRoot child of the Dialogue UI, but enabling it doesn't seem to make keyboard navigation work in the dialogue menu and give the error "division by zero" - am I looking in the wrong place?
     
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    You're almost there. Tick Navigation > Enabled in the Response Menu Panel, not GUIRoot. (And untick it in GUIRoot.) You'll also need to assign the order of the response buttons to tell the GUI system how to navigate through them. Take a look at any of the provided prefabs for an example. I'll also replace that error message with something more helpful.
     
  38. Deleted User

    Deleted User

    Guest

    Hello,

    When installing 1.1.7.2 (fresh install) and then applying the Daikon Forge Third Party Plugin I get the following error:

    Code (csharp):
    1. Assets/Dialogue System/Third Party Support/Daikon Forge GUI/Daikon Forge Dialogue UI/Daikon Forge Dialogue Controls/DaikonForgeSubtitleControls.cs(136,39): error CS1501: No overload for method `ResetLayout' takes `1' arguments
    2.  
    3. Assets/Dialogue System/Third Party Support/Daikon Forge GUI/Daikon Forge Dialogue UI/Daikon Forge Dialogue Controls/DaikonForgeSubtitleControls.cs(139,46): error CS1501: No overload for method `ResetLayout' takes `1' arguments
    4.  
    5. Assets/Dialogue System/Third Party Support/Daikon Forge GUI/Daikon Forge Dialogue UI/Daikon Forge Dialogue Controls/DaikonForgeSubtitleControls.cs(143,38): error CS1501: No overload for method `ResetLayout' takes `1' arguments

    Daikon Forge has made an update (Daikon Forge 1.0.15), perhaps its related to that update?
     
  39. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Yes. It's always a catch-up game when supporting other products that are in active development. I'll publish an updated DF-GUI Support unitypackage to the customer download page later today.
     
  40. Deleted User

    Deleted User

    Guest

    For me it's not such a big issue that I can't wait for the next proper release; I can live on 1.1.7 for now, just wanted to let you know so it'd be fixed for the great alluring 1.1.8 release with the quest :D
     
  41. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Thanks. I'll post it today anyway in case others need it. I test all support packages prior to each release, but the guys over at Daikon Forge have been cranking out updates at an insane rate. :)
     
  42. DieHappyGames

    DieHappyGames

    Joined:
    Feb 24, 2014
    Posts:
    44
    I'm embarrassed to admit it, but I still can't find this option. I'm modifying a duplicate of the JRPG example - is the option in the Dialogue UI or the GUI Skin? Here's where I'm looking

    Two other questions, while I'm at it...
    In most games, if the user reads faster than the text is printing, he can hit a button that will either double the speed or dump the whole window of text for that conversation branch - does DS have similar functionality built-in? I know that the escape button kind of does something similar, but it will also close out the entire conversation if used during the Player lines, so not quite what I'm looking for in that instance.

    Also, I've just been debating between whether to use Chatmapper or to stick with the built-in editor, and wanted to find out ahead of time if there are features of chatmapper that don't function in DS. I've been watching some scripting tutorials on making the most of Chatmapper by checking/manipulating things like SimStatus and Priority, and am just worried about building a conversation that will work in Chatmapper but then break when converted into DS. Is this a valid concern, or does everything that works in CM carry over to DS?

    As always, thanks for the great product, and the impeccable support!
    Dave
     
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Sorry, it's a bit obscure; I've expanded the documentation in the next release. Add an instance of the JRPG UI to your scene. Expand it and inspect the Text Panel object. Tick Navigation > Enabled (on the Text Panel). You'll see that the Order list already has buttons 1-4. You can add or remove child controls to this list, or reorder them, to specify how keyboard/gamepad input navigates the controls. Then you can assign this JRPG UI object to your Dialogue Manager or save it as another prefab and assign that prefab.

    You're right about the Cancel (Escape) key -- it dumps the whole subtitle text if it's printing text, but it exits the conversation if you're on the escape menu. I think most games work this way. There's also the Continue button. If enabled, when clicked it also dumps the whole text and moves immediately to the next stage (i.e., the player response menu or the next NPC line). Do you have any suggestions? I could separate the Cancel key into two separate keys, one for subtitles and another for the player response menu. You could always set the player response menu Cancel key to none. Or what about adding a double-speed/dump key to the typewriter effect? The typewriter effect itself would speed up or dump the text if the player presses, say, Space (or whatever key/button you specify).

    The Dialogue System handles everything in Chat Mapper except [pic=#] tags, and those are coming soon because http://play.chatmapper.com/ needs to handle them. In fact, some cross-pollination is happening; they're thinking of adding the Dialogue System's [lua(...)] tag to Chat Mapper. But for now Chat Mapper 1.7's [var=varName] tag (also supported in the Dialogue System) handles most everyone's needs in Chat Mapper.

    Thanks! It's my pleasure!

    BTW, the updated DF-GUI support package is on the customer download page for anyone who needs it.
     
  44. barjed

    barjed

    Joined:
    May 9, 2013
    Posts:
    70
    Hi,

    I've just bought your asset and have two quick questions about it.

    1. Is it possible to hold a conversation with two actors at the same time? In my game, the protagonist is a classic mute and all of the dialogue happens between the various NPCs in the game world.

    2. Is it possible to skip right through to the NPCs answer after the player selects one of the dialogue choices? So I click on an answer and the player does not speak, instead the NPC answers straight away.

    Thanks!

    edit: I've fiddled a bit with the asset. Is it possible to end a conversation with a NPC line instead of forcing the player to pick an answer that ends the dialogue?

    edit2: I have some really weird behaviour with the Continue Button. I've set the Continue Button to Always in DialogueManager, I linked the button's instance in the Daikon Forge Dialogue Panel Component but nothing happens, the dialouge doesn't continue when the button is clicked. Everything works fine when Continue Button is set to Never.
     
    Last edited: Mar 1, 2014
  45. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi barjed, yes, you can assign any actor to any line, including NPCs to all of the lines.

    Yes. On the Dialogue Manager, untick Subtitle Settings > Show PC Subtitles During Line.

    Yes. As long as there is no follow-up dialogue entry, the conversation will end. The last entry can be a player line or an NPC line.

    The Continue Button must also have a Df Event Binding that sends "OnContinue" to your Daikon Forge Dialogue UI. Please see the "Daikon Forge TechBlue Dialogue UI with Continue Button" for an example.
     
  46. barjed

    barjed

    Joined:
    May 9, 2013
    Posts:
    70
    Hello Tony,

    thank you for all your answers. Continue button works flawlessly after setting up the Event Binding. I am sorry for such silly question.

    I have three more questions, I hope you don't mind.

    1. When using multiple NPC speakers is it possible to persist their portraits during the conversation? Or at least display more than one at any given time. Something similar to this: http://gamerlimit.com/wp-content/uploads/2009/01/disgaea22-500x281.jpg.

    2. When using a Conversation Trigger, the NPC speaker name that gets displayed in the Portrait Name section is taken from the name of the actual Prefab that has had the Trigger applied to. Is it possible to change this for the Actor names that were set in the Dialogue Editor?

    3. When using Daikon, is it possible to get the "typewriter" effect on the dialogue text, similar to your 2D example?

    Finally, let me congratulate you on your wonderful asset. The amount of content that's packed here is amazing!

    edit: Oh and I have small suggestion. It would be nice if the Subject parameter of the Animation() Sequencer command could somehow access child object of the actual speaking object. I think it's a regular practice to nest models inside parent objects to prevent the animations from overriding object's rotation.
     
    Last edited: Mar 2, 2014
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi barjed, I'm happy to answer any questions! The dialogue UIs don't currently do this, but you could add that functionality by subclassing an existing dialogue UI system. Or just add the extra controls to your UI, and add OnConversationStart and OnConversationLine methods that set their images.

    People usually want to go the other way: define a generic "Shopkeeper" in the Dialogue Editor, and use the name of the actual character (GameObject or prefab) that you're talking with. But in the upcoming version 1.1.8 (due tomorrow), you can add an Override Actor Name component to use a different name.

    Yes. Window > Dialogue System > Component > UI > Daikon Forge GUI > Effects > Typewriter.

    Thanks! I appreciate your feedback!

    That's a good idea. I'll add it to the roadmap.
     
  48. DieHappyGames

    DieHappyGames

    Joined:
    Feb 24, 2014
    Posts:
    44
    Hi Tony,

    I want to have a given line of dialogue or the end of a given conversation to cause a new level to load. I realize I could do this by creating a script on an object in my world with the given methods that would load these levels and then use SendMessage() in the sequence to fire that method, but I'm wondering if there's a more direct way? Does DS have the ability to compile a given line of code on-the-fly, or is the closest approximation for me to create a SequencerCommand that loads a new scene and accepts as a parameter the name of the scene to be loaded? Hope this makes sense - I'm still new to most of this and I know I tend to mix up my terminology...
     
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi Dave, you have a lot of options, most easy, but nothing that's exactly "on conversation end, load level". As far as terminology, I try to be consistent with myself at least, but they're just terms I arbitrarily chose or borrowed from Chat Mapper. Here are some ideas:
    • Use the SendMessage() sequencer command to run a method on a GameObject like you described.
    • Write a custom sequencer command to load a level, again like you described. (See below)
    • Register a C# method with Lua.RegisterFunction() and call it in a dialogue entry's User Script, or even using a Lua On Dialogue Event trigger.
    • Listen for OnConversationEnd() in a script on the Dialogue Manager or either actor. You could set a Lua variable in your conversation and use DialogueLua.GetVariable() to check it in your script.
    • Register a Lua observer and set a Lua variable when you want to change levels.
    • Do the equivalent in PlayMaker or plyGame.

    Here's the sequencer command to load a level. If you have Pro, you may prefer to use Application.LoadLevelAsync().
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using PixelCrushers.DialogueSystem;
    4.  
    5. namespace PixelCrushers.DialogueSystem.SequencerCommands {
    6.  
    7.     public class SequencerCommandLoadLevel : SequencerCommand {
    8.  
    9.         public void Start() {
    10.             string levelName = GetParameter(0);
    11.             if (!string.IsNullOrEmpty(levelName)) Application.LoadLevel(levelName);
    12.             Stop();
    13.         }
    14.        
    15.     }
    16.  
    17. }
    18.  
    Just add your level to the build settings (e.g., "My New Level") and use this sequence command:
    Code (csharp):
    1.  
    2. LoadLevel(My New Level)
    3.  
     
    Last edited: Mar 4, 2014
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    The Dialogue System for Unity version 1.1.8 has been submitted to the Asset Store and is available now on the customer download page. (PM me your invoice number if you need access.)

    This release features a GUI system-independent, language-localizable quest log window system, with built-in implementations for Unity GUI, NGUI, and DF-GUI. In the near future, I'll be adding a 2D Toolkit UI implementation as well as more prefab quest log windows for all of the GUI systems. (The old UnityQuestLogWindow still exists, so projects using it will continue to work fine, just without the new features below.)

    To support arbitrary GUI localization, a new type of custom asset, Localized Text Table, was also introduced. You can also use this for purposes other than quest log windows. Future enhancements will include CSV import/export (e.g., MS Excel).

    Quests now have Track and Abandonable flags that are observed in the quest log window. You're responsible for displaying tracking info in your gameplay HUD, though.

    Version 1.1.8:
    • New: GUI system-independent quest log window system, with built-in implementations for Unity GUI, NGUI, and Daikon Forge GUI.
    • New: General-purpose Localization Tables.
    • New: Override Actor Name component. Also, if Usable or Persistent Data name overrides are blank, Override Actor Name will be used if defined.
    • New: Set Animator State On Dialogue Event and Set Animation On Dialogue Event components.
    • New: (QuestLog) Added IsQuestTrackingEnabled(), SetQuestTracking(), IsQuestAbandonable(). New options reflected in Dialogue Editor.
    • New: (Unity GUI): Can now change keyboard navigation click key from Unity's default Space.
    • New: (Unity GUI): When keyboard/gamepad navigation is enabled, mouse wheel scrolls through choices.
    • New: (PlayMaker): SetQuestTracking, IsQuestTrackingEnabled, and IsQuestAbandonable actions.
    • New: (plyGame): SetQuestTracking, IsQuestTrackingEnabled, and IsQuestAbandonable blocks.
    • Improved: Sequence Lua Trigger inspectors now have multiline text areas.
    • Improved: If a "Notes" field is defined in a dialogue entry, the editor shows it. Also added a foldout for All Fields.
    • Fixed: Unity GUI controls weren't auto-fitting correctly in some cases.

    The next release will focus on features to make it easier to ensure that dialogue asset IDs are unique across dialogue databases, for those of you who are using multiple databases.