Search Unity

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

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

  1. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @NioFox - It requires a little scripting. Here's one way:
    1. Move your conditions from the Conditions field to a new custom field named something like EnableConditions. If a dialogue entry's Conditions field is false, it's excluded from the list of responses provided to your dialogue UI. Instead, you'll put the conditions in EnableConditions so you can delay evaluation until you're preparing the response buttons for display.

    2. Create a subclass of UnityUIDialogueUI. (The source file is in Scripts/Supplemental/UI/Dialogue UI.) Override the ShowResponses() method. Use basically the same code as in the base ShowResponses(), but evaluate each dialogue entry's EnableConditions field using Lua.IsTrue() and set the button enabled or disabled based on the return value.
    Pseudocode (for brevity):
    Code (csharp):
    1. foreach (var response in responses) {
    2.     ...
    3.     button.interactable = Lua.IsTrue(Field.Lookup(response.destinationEntry.fields, "EnableConditions"));
    4. }
     
  2. NioFox

    NioFox

    Joined:
    Dec 28, 2012
    Posts:
    65
    Phew, this introduces a few more steps in conversation writing.
    Not only do I have to set the EnableConditions in multiple places (depending on where the choice branch occurs, there may be more or less responses to choose from), but I also have to clear the variable after a choice is made to ensure future choices aren't affected.

    Any plans for adding an option to toggle between hide or disable?
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    I'll be releasing a patch fairly soon (need to update the articy:draft converter for the new version of articy:draft), and I should be able to get this option in there, too. It'll be an option on the Dialogue Manager.
     
  4. NioFox

    NioFox

    Joined:
    Dec 28, 2012
    Posts:
    65
    That would be perfect, thanks a million!

    Edit: I finally figured out what you meant about adding a custom field (to the template). I've implemented this and it works pretty good for now. Thanks!
     
    Last edited: Jun 20, 2015
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Dialogue System 1.5.2 Patch 2015-06-19 Available

    A patch is available on the Pixel Crushers customer download site. If you need access, please PM me your Unity Asset Store invoice number. The patch includes:
    • Added: Display Settings > Input Settings > Include Invalid Entries checkbox; UnityDialogueUI and UnityUIDialogueUI show invalid responses as disabled buttons.
    • Fixed: Conflict that prevented Windows Store & WP8 builds.
    • Fixed: Fixed CSV Converter bug caused by exporting from applications that fill out extra fields on all lines.
    • articy:draft: Updated Converter to handle articy:draft 2.4.
    • Realistic FPS Prefab: Added PersistentSmoothMouseLook component to save player rotation.

    @NioFox - I'm glad the template thing worked out! Your other feature request is in the patch above. On the Dialogue Manager, tick Include Invalid Entries. When a dialogue entry's Conditions field is false, UnityUIDialogueUI will show its response button in a disabled state. If your buttons use Color Tint, you may want to adjust the Disabled color to make it more obvious that it's disabled.
     
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    ^ If you're using Unity 4.x, also import the updated package "Scripts/Unity UI Support.unitypackage". This updates UnityUDialogueUI to show invalid responses as disabled buttons.
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    articy:draft Converter Tutorial:



    Next up: RPG Kit 3.0 dialogue and quests tutorial.

    All tutorials are available on the Pixel Crushers Dialogue System Tutorials page.
     
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    RPG Kit 3.0 Quests & Conversations Tutorial:



    All tutorials are available on the Pixel Crushers Dialogue System Tutorials page.
     
  9. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    Last edited: Jun 22, 2015
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
  11. Darkkingdom

    Darkkingdom

    Joined:
    Sep 2, 2014
    Posts:
    81
    Hey guys,

    I have a small question about your system:

    I wrote the following SequencerCommand (based on your QTE Command^^) to set Variables during a Sequence:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using PixelCrushers.DialogueSystem;
    4. using PixelCrushers.DialogueSystem.SequencerCommands;
    5.  
    6.  
    7. public class SequencerCommandSetVariable : SequencerCommand {
    8.    
    9.     private string varName;
    10.     private string variableValue;
    11.     private FieldType variableType;
    12.    
    13.     public void Start() {
    14.        
    15.         varName = GetParameter(0);
    16.         variableValue = GetParameter(1);
    17.         variableType = GetVariableType();
    18.  
    19.         if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: Variable({1}, {2})", DialogueDebug.Prefix, varName, variableValue));
    20.         Lua.Run(string.Format("Variable[\"{0}\"] = \"\"", varName), DialogueDebug.LogInfo);
    21.     }
    22.    
    23.     private FieldType GetVariableType() {
    24.         float temp;
    25.         if ((string.Compare(variableValue, "true", System.StringComparison.OrdinalIgnoreCase) == 0) ||
    26.             (string.Compare(variableValue, "false", System.StringComparison.OrdinalIgnoreCase) == 0)) {
    27.             return FieldType.Boolean;
    28.         } else if (float.TryParse(variableValue, out temp)) {
    29.             return FieldType.Number;
    30.         } else {
    31.             return FieldType.Text;
    32.         }
    33.     }
    34.    
    35.     public void Update() {
    36.         Lua.Run(string.Format("Variable[\"{0}\"] = {1}", varName, DialogueLua.ValueAsString(variableType, variableValue)), DialogueDebug.LogInfo);
    37.     }
    38.    
    39.     public void OnDestroy() {
    40.     }
    41.    
    42. }
    43.  
    But I always get the following error:

    Line 15 is the varName = GetParameter(0); part.

    I don't get it^^

    It would be very nice if you could help me :)

    Thanks!
     
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @Darkkingdom - How are you invoking this in your sequence? Can you post the text of your sequence or a screenshot? It looks like there might be a syntax error. (In the next release I'll make sure it handles this more gracefully and provides more feedback.)
     
    Darkkingdom likes this.
  13. Darkkingdom

    Darkkingdom

    Joined:
    Sep 2, 2014
    Posts:
    81
    Hey TonyLi thanks for your fast reply! :)

    The text of my Sequence is "SetVariable(MyVariable, true);"
    No condition is set and trigger is "On Trigger Enter" other sequence codes are working.
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @Darkkingdom - I pasted your script in verbatim and also set up a Sequence Trigger (OnTriggerEnter) with the sequence exactly as you entered it, and it doesn't throw any errors. Can you paste a screenshot of your Sequence Trigger's inspector view?

    Also, what versions of Unity and the Dialogue System are you using? The Dialogue System version is in Assets/Dialogue System/_README.txt. I tested with Dialogue System 1.5.2 in Unity 4.3.4 and 5.0.1.

    BTW, you can shorten your script to the version below. Update() and OnDestroy() aren't required. But you do need to call Stop() at some point. I added Stop() to the end of Start().
    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using PixelCrushers.DialogueSystem;
    4. using PixelCrushers.DialogueSystem.SequencerCommands;
    5.  
    6. public class SequencerCommandSetVariable : SequencerCommand {
    7.  
    8.     private string varName;
    9.     private string variableValue;
    10.     private FieldType variableType;
    11.  
    12.     public void Start() {
    13.      
    14.         varName = GetParameter(0);
    15.         variableValue = GetParameter(1);
    16.         variableType = GetVariableType();
    17.      
    18.         if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: Variable({1}, {2})", DialogueDebug.Prefix, varName, variableValue));
    19.         Lua.Run(string.Format("Variable[\"{0}\"] = {1}", varName, DialogueLua.ValueAsString(variableType, variableValue)), DialogueDebug.LogInfo);
    20.         Stop();
    21.     }
    22.  
    23.     private FieldType GetVariableType() {
    24.         float temp;
    25.         if ((string.Compare(variableValue, "true", System.StringComparison.OrdinalIgnoreCase) == 0) ||
    26.            (string.Compare(variableValue, "false", System.StringComparison.OrdinalIgnoreCase) == 0)) {
    27.             return FieldType.Boolean;
    28.         } else if (float.TryParse(variableValue, out temp)) {
    29.             return FieldType.Number;
    30.         } else {
    31.             return FieldType.Text;
    32.         }
    33.     }
    34.  
    35. }
     
    Last edited: Jun 24, 2015
    Darkkingdom likes this.
  15. Darkkingdom

    Darkkingdom

    Joined:
    Sep 2, 2014
    Posts:
    81
    Hey TonyLi :)

    I use Unity 4.6.5 and Dialogue 1.5.0.
    As wished here is a screenshot of my Sequencer Trigger:



    Oh and I get the following warnings before the error:
    (The SequencerCommandSetVariable File is in the scripts -> templates dircetory)





    Oh and thanks for the edited code^^
     
    Last edited: Jun 24, 2015
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @Darkkingdom - Thanks for posting the Sequence Trigger screenshot. It looks good.

    You can ignore the "Sequencer received a blank string" warning. Later versions of the Dialogue System suppress this message. It occurs because the grammar for sequences defines a semicolon as a separator between two sequencer commands. Since your sequence has a semicolon at the end, the Dialogue System treats it as a separator between your command and a blank (empty string) command. This is kind of a pointless warning, so it's not reported any more. You can also delete that trailing semicolon if you want.

    I have a question about the other messages. "Can't find any built-in sequencer command ... or a component named SequencerCommandSetVariable" means it can't find your script. The Dialogue System searches the global namespace as well as PixelCrushers.DialogueSystem and PixelCrushers.DialogueSystem.SequencerCommands.

    It looks like your script is in the global namespace (i.e., it isn't wrapped in a namespace XXX {...} block), so it shouldn't report this message. Does the NullReferenceException occur right after this message? If so, that's really strange behavior, since the Dialogue System shouldn't be able to run the script if it can't find it. Does anything change if you wrap the script in "namespace PixelCrushers.DialogueSystem { <your-class-here> }"?

    I also just PM'ed you your access information for the Dialogue System customer download site. Please feel free to download the patch to see if it helps (or at least suppresses that "blank string" warning).

    Since I can't reproduce this using the code you posted (which works for me), can you please send an example project to tony (at) pixelcrushers.com? I'll be happy to take a look.
     
    Darkkingdom likes this.
  17. Darkkingdom

    Darkkingdom

    Joined:
    Sep 2, 2014
    Posts:
    81
    Hey TonyLi :)

    thank you very much for the link and your great help!
    The namespace didn't help, but I fixed the problem :)
    I deleted all stuff from the dialogue system and when imported the newest version of your system.
    Then I made a new dialogue DB and wrote all stuff new.
    And finally it works!!! :)
    Thanks again Tony!

    Buuut I have another small question:
    How can I specife the "OnTriggerEnter" Trigger? Atm. my bullets trigger a conversation^^
    Is there a possiblity to only trigger when a object with a special tag enters?
     
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @Darkkingdom - I'm glad to know the sequencer command is working now!

    Trigger components have a Condition section. You can set the valid tags in the Condition's Tags list.
     
    Darkkingdom likes this.
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Dialogue System Minimum Version: Unity 4.6.5

    I'd like to increase the minimum Unity version for the Dialogue System to Unity 4.6.5. Will this negatively affect anyone currently using the Dialogue System?
     
  20. Riff-Rex

    Riff-Rex

    Joined:
    Mar 14, 2014
    Posts:
    19
    Hi Tony, I have another little issue I hope you can help me with.

    I'm using the typewriter effect, but when text is set to "middle centre" it does this as the letters are generated:

    though once the line is finished it does correct itself:

    Any ideas? Thanks for your help!

    Polygonzo
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @Riff Rex - I'll describe how to address the issue in the next paragraph. I'll explain the issue here first. It's due to the way the typewriter effect had to be implemented in legacy Unity GUI. To place the text properly, the typewriter effect has to compute the position of the full text. As it "types," it draws the partial text left-aligned at that position. The GUI style you're using includes a background image. Since the typewriter effect draws left-aligned, the background image is also left-aligned at the starting position of the text. When the typewriter effect is done, it draws the full text in the final alignment setting (middle centre), which Unity GUI knows how to handle properly.

    The best way to address the issue is to remove the background image from the GUI style and move it into its own UI element instead. Inspect the GUI Root to find the GUI Skin it's using. Then inspect this GUI Skin. Find the GUI Style you're using for the subtitle text ("Subtitle"). Expand its Normal foldout and set Background to None.

    Now create a GUI Image under NPC Panel. Give it the same scaled rect settings as your subtitle label. Assign the image to it (Prefabs/Unity Dialogue UIs/Circle/Textures/Circle Subtitle). Then move your subtitle label under that GUI Image. You'll probably have to fiddle with its scaled rect to get it to fit nicely in the GUI Image.

    The end result is that your hierarchy will change from something like this:

    NPC Panel
    NPC Subtitle Line (text with integrated background image)​
    to something like this:

    NPC Panel
    NPC GUI Image (just the background image)
    NPC Subtitle Line (text only; no image)
     
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    @Darkkingdom - I hope you don't mind if I take inspiration from your sequencer command script and add SetVariable() as a built-in command. I think this would be useful to a lot of other Dialogue System users, too.
     
    Darkkingdom and Dreamaster like this.
  23. pwas

    pwas

    Joined:
    Jan 14, 2015
    Posts:
    11
    Hello. I asked about displaying two portraits of conversant and actor at the same time few months ago. You have showed me an prefab that it shows how it should works. It works like chram, but...
    How can I display more than two portraits? Consider that I have scene, where 4 conversants are talking to each other and I would like to display portraits of all of them. How to set actor / conversant? How should I set dialogue system gui to implement such the functionality?
     
    Last edited: Jun 29, 2015
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @pwas - In the prefab I linked you to in this post, the dialogue UI overrides the ShowSubtitle() method. The logic used in ShowSubtitle() is described in this post. I'll repost it here:

    TestDialogueUI is a subclass of UnityDialogueUI. It overrides ShowSubtitle() to display the subtitle in the correct area:
    1. PC box if the line is spoken by the player,
    2. NPC box if the line is spoken by the NPC assigned as the conversation's conversant,
    3. Crew1 box otherwise. (You can change this logic of course.)
    Change the logic of #3. Here are two suggestions:

    1. In each Actor definition, add a custom field that specifies a panel number to use. In ShowSubtitle(), look up this field and use that panel number. This gives each actor a specific panel to always use.

    2. Or assign panel numbers as they're needed in each conversation, keeping track of them in a list of assignments. You can override the Open() method to initialize that list.

    If you don't like either of these solutions, please keep in mind that the Dialogue System is completely GUI-independent. If you prefer, you can write your own UI that implements the handful of methods in IDialogueUI. In this case, it can do whatever you write.
     
  25. pwas

    pwas

    Joined:
    Jan 14, 2015
    Posts:
    11
    Thanks, I will try to implement it as you have indicated and will post report here.
     
  26. Darkkingdom

    Darkkingdom

    Joined:
    Sep 2, 2014
    Posts:
    81
    Sure please help yourself. I would be happy if my code helps someone :)
     
    hopeful and TonyLi like this.
  27. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    A patch is available on the Pixel Crushers customer download site. If you need access, please PM me your Asset Store invoice number. These additions will also be in the next full release on the Asset Store, but if you need them earlier you can import the patch.

    This patch for Dialogue System 1.5.2 contains:
    • Added: Sequencer commands SetContinueMode(true|false) and SetVariable(variableName,value). (Thanks, Darkkingdom!)
    • Improved: These components how automatically update the quest tracker if you’ve configured one: Condition Observer, Quest Trigger, Lua Trigger, Set Quest State On Dialogue Event, Lua On Dialogue Event.
    • Fixed: Localized text table import & export now handles embedded carriage returns (\r).
    • Fixed: Removed deprecated method warnings in editor code in Unity 5 (if import source into Unity 5).
    • Unity UI: Added a set of generic UI prefabs for dialogue UI, selector, and quest tracker HUD.
    • PlayMaker: Expanded Dialogue System Load Level action with more options.
    • RPG Kit: Updated Dialogue Manager prefab’s dialogue UI to scale better in different screen sizes; Barker prefab now uses Unity UI.
    • (Also in patch 2015-06-20) Added: Display Settings > Input Settings > Include Invalid Entries checkbox; UnityDialogueUI and UnityUIDialogueUI show invalid responses as disabled buttons. (Patch 2015-06-20 changes behavior so this only applies to PC responses, not NPC responses.)
    • (Also in patch 2015-06-20) Fixed: Conflict that prevented Windows Store & WP8 builds.
    • (Also in patch 2015-06-20) Fixed: Fixed CSV Converter bug caused by exporting from applications that fill out extra fields on all lines.
    • (Also in patch 2015-06-20) articy:draft: Updated Converter to handle articy:draft 2.4.
    • (Also in patch 2015-06-20) Realistic FPS Prefab: Added PersistentSmoothMouseLook component to save player rotation.
     
    JacobFalling and Darkkingdom like this.
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Congratulations to TioBob Software, who recently published the multi-platform Multiplication Dragons, which uses the Dialogue System!



    "Memorizing multiplication tables using just a school textbook can be frustrating for you, and for your child. That’s why we have developed Multiplication Dragons, to provide new, fun ways to engage with multiplication that stimulate ease of memorization and improved recall. We all know how difficult it is to remember things without using the proper tools, and Multiplication Dragons provides just that. Our brightly coloured, unique, three-dimensional environments provide visual and auditory in which children can learn by associating multiplication questions with a rhyme, an in-game location, and the dragon that asks the question."
    http://www.multiplicationdragons.com/
     
    Last edited: Jul 2, 2015
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
  30. JacobFalling

    JacobFalling

    Joined:
    Apr 27, 2014
    Posts:
    22
    Tony... thank you for supporting the newest Articy version. It's new dialogue walk-through make planning and implementing for Dialogue System much more organic. Supporting tools completely external to Unity is impressive and a huge added value.
     
    TonyLi likes this.
  31. Bogu-94

    Bogu-94

    Joined:
    Dec 11, 2013
    Posts:
    58
    Need a quick response. Deciding to buy this or UTAGE.
    I want to create an RPG with Visual Novel like conversation.
    As I see, the feature this package offers is far above UTAGE, but I need to know if this supports VN system.

    the only matter is here.
    - Can I bind each conversation line with certain actor and certain expression? (i mean.. is this feature already built in?)
    - Or (if it's not built-in) can I freely add parameter for each line (in my case: Enum DialogueActors, and Enum Expressions) so I can easily customize the system.

    thanks before.
    and FYI I have 2month deadline for a competition submission, so I need your reviews to decide quicker.
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @johanesnw - Yes to both. It's built in, and you can extend it further if you want. I believe in using the right tool for the right job. The Dialogue System has more features than UTAGE. This may also mean that it takes a little longer to learn at first. I'll be here to help, and there is extensive documentation and video tutorials. If UTAGE does exactly what you want and no more, it may be faster to learn if you're under a time crunch.
     
  33. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    One of the many reasons why I love Tony's work.. He could be like a lot of asset authors and only say the things to get folks to buy his assets. But not only does he develop killer assets and provide awesome support, he is also honest and open in responding to the types of questions asked here. You rock, Tony!
     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Thanks as always for the kind words, @Shawn67!


    I got an email notification that someone had a question about TextInput(). The post has since been deleted, so I'm guessing they got it straightened out. If not, this post contains some useful information. In the next release, the documentation for TextInput() has been expanded with more information. The Unity UI example folder (Scripts/Supplemental/UI/Examples) also contains an example of using TextInput(); it can serve as a model.
     
  35. Bogu-94

    Bogu-94

    Joined:
    Dec 11, 2013
    Posts:
    58
    OK I've bought this. Looks more promising, and have better use in the future.
    well because UTAGE is mostly VN (I'll miss so many other features here)
    and the author already confirmed that they don't support NGUI (which I've been using for a whole year)

    I'll start figuring things out now. :D
     
  36. PawkaUnity

    PawkaUnity

    Joined:
    Feb 19, 2015
    Posts:
    2
    Yep that was me! Guilty as charged. Literally 10 minutes after I posted it (After having spent quite a few hours trying to figure it out, I came up with a simple solution based on a discussion that I had missed just one page before in this thread! Figured I'd save you the hassle of typing out something you had already said), but thanks for reaching out anyways! That's some impressive support right there. Keep it up, love your work.
     
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Thanks, @PawkaUnity! Don't hesitate to post or email me directly at tony (at) pixelcrushers.com if you have any other questions. If I can help save someone hours of searching through documentation, I'm more than happy to do so.
     
  38. PawkaUnity

    PawkaUnity

    Joined:
    Feb 19, 2015
    Posts:
    2
    Thanks a bunch Tony! That's awesome to hear. Here's one for ya: I'm working with your TextInput sequencer, and I noticed that while having the accept event set to return key, it doesn't fire the accept event when the "Done" and "Return" are hit on a mobile keyboard (I'm making an iPhone game, so that's where the text input issues are coming up for me).

    As such, the keyboard is never dismissed, and just hangs there. What's the best way to go about interfacing with and changing the mobile keyboard for TextInputs? (I'm looking to have it dismiss on Done/Return, as well as remove the TextInput toolbar added by Unity.)

    Still digging through it, but any thoughts on your end would be awesome. Thanks!
     
  39. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    I'll take a look at implementing this as a built-in feature. In the meantime, you could take one of two approaches:

    1. Make a custom version of the TextInput sequencer command that handles mobile keyboards the way you want. The source file for the original TextInput is in the unitypackage "Scripts/Source Code.unitypackage". The file is "Scripts/Core/Model-View-Controller/View/Sequencer/Sequencer Commands/SequencerCommandTextInput.cs". Make a copy (e.g., SequencerCommandTextInputMobile.cs). In Start(), show the keyboard:
    Code (csharp):
    1. TouchScreenKeyboard keyboard;
    2. public void Start() {
    3.     keyboard = TouchScreenKeyboard.Open();
    4.     ...
    In OnDestroy(), hide the keyboard:
    Code (csharp):
    1. public void OnDestroy() {
    2.     keyboard.active = false;
    3.     ...
    Then use TextInputMobile() in place of TextInput().

    2. Or make a custom implementation of the ITextFieldUI C# interface. The Dialogue System is GUI independent, so it will work with whatever implementation of ITextFieldUI you give it. There's a starter template in Scripts/Templates. You can examine Scripts/Supplemental/UI/Scripts/Dialogue UI/UnityUITextFieldUI.cs as a model. You could make a copy and add the Open() / active=false code from above.
     
  40. mbalic

    mbalic

    Joined:
    Nov 10, 2014
    Posts:
    2
    Hi, interested in this plugin, but first a pre-sales question:

    We have a narration-heavy game where we need to play voice over without interrupting the user's experience. So no conversation branches -- it's a passive voice over complimented by subtitles that are triggered by events in the game. Is this easy to set up and implement on mass? Are there any tutorials or examples of this in action, or can you give us an idea of how this might be achieved?

    Thank you!
     
  41. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @mballic - Yes, this is fairly easy to set up. You can use Alerts or Conversations.


    Alerts:
    If you want to attach narration to trigger areas (e.g., narration plays when player enters trigger collider), use Alert Triggers. You can also attach Alert Triggers to Usable objects. Alert Triggers play through your dialogue UI's alert panel. You can also attach Sequence Triggers to the same objects to play a sequence (such as zooming the camera or animating an object) at the same time.

    I believe Terra Monsters 2 uses Alerts this way.


    Conversations:
    If you want an ongoing narration, you may prefer to write it in a single conversation in your dialogue database. The Tutorial Example included in the Dialogue System does it this way. The conversation plays in the background and waits for specific gameplay events to progress.

    If I recall correctly, Capital runs some conversations like this.
     
  42. Candescence

    Candescence

    Joined:
    Aug 26, 2014
    Posts:
    107
    Just wondering, how easy would it be to implement a Half-Life 2 esque system of narrative sequences with this system? Valve's games in general are something of an odd duck in gaming due to a complete absence of traditional cutscenes, instead giving the player constant control. Though, how HL2 handles things is surprisingly simple in theory, I'd suppose, as it's mainly a sequence of instructions to NPCs to have them talk, move to certain places and perform animations when necessary. I'm intending to mix that style with an 'active' form of dialogue interaction that includes a dedicated dialogue menu button and choices made through actions rather than or in tandem with dialogue.

    Though, there's also stuff like facial animation and lip-sync, which is a dedicated feature in the Source engine and is still one of the industry's best facial animation integration, which helps HL2's presentation a lot, and I dunno how hard that'd be to integrate with this system.
     
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @Candescence - The Dialogue System is designed for both applications (ambient cutscenes and traditional player response conversations). It's been used in games with Stanley Parable-style background narration. It also supports a lot of different lipsync solutions.

    The Dialogue System's sequencer is text-based. This lets authors write sequences as they write dialogue without breaking flow by switching to a different tool. It makes it easy to write short sequences, and some games such as Dead Bunker 4 and Criminal Procedure (which if I remember correctly also does lipsync) use text-based sequences for fairly elaborate cutscenes, too. However, you may prefer designing really complex sequences in an interactive editor such as uSequencer or Cinema Director, both of which the Dialogue System natively supports. Within conversations and cutscenes, you can mix-and-match text-based sequences and uSequencer/Cinema Director sequences as needed.
     
  44. Candescence

    Candescence

    Joined:
    Aug 26, 2014
    Posts:
    107
    A reasonable enough answer, I suppose. I guess I'd have to figure out the exact methods and tools to get the desired result myself, I suppose.
     
  45. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    If you have any questions about how you might want to do it, please let me know. I may have written too much in my previous reply. It's fairly simple to do in the Dialogue System.
     
  46. Bogu-94

    Bogu-94

    Joined:
    Dec 11, 2013
    Posts:
    58
    I'm starting to understand things, but have some problems.
    I'm using the NGUI example, but not too good in reading your code (bad understanding at interface, abstract class, and Events). so I'm working with the TemplateDialogueUI to start fresh.
    What I'm trying to achieve is conversations with directed story (not using responses/alerts/qtes). So the conversation diagram is just like a train.

    So far that I know, these are the most crucial functions for my game dialogue.
    Open() and Close() - called at the Beginning and the End of a Conversation. I use it to show/hide GUI.
    ShowSubtitle(Subtitle sub) - called at the beginning of a dialogue line. used to get the subtitle data to the GUI (line,name,portrait).
    HideSubtitle(Subtitle sub) - called at the end of a dialogue line. haven't really use it.

    under the "Continue Button : Never" setting, this works as expected. but not in the "Always" setting.
    HideSubtitle isn't called (I need to set some flags here, just say enabling continue button)

    Question:
    1) How Can I know that "this dialogue line ended" in this setting? something like "OnDialogueEntryFinished" or such?
    2) I'm using NGUI TypeWriter. When I press Spacebar, I force the typewriter to finish. (but the dialogue manager's "min subtitle second" hasn't exceeded). How can I force the dialogue line to end? - I tried to set the "min subtitle second" to 0. but I need to fix problem 1)

    3) In the example, OnContinue() is called from a UIButton to show next sub. but it doesn't work :( - SOLVED. After browsing the docs
    Code (CSharp):
    1. DialogueManager.Instance.SendMessage("OnConversationContinue");
    4) Can I set a variable inside a conversation node (or inside the dialogue Text like [pic=#])? I have a variable to control whether the Actor will be displayed in the Left/Right portrait panel. (can be int/bool) - finally Solved this after watching one of your vid.
    Code (CSharp):
    1. int posVar = DialogueLua.GetVariable("Position").AsInt;
    2. portPos = posVar == 1 ? PortraitPos.right : PortraitPos.left;
    Thanks in advance.
    and sorry for these many question. it's not like i'm lazy to read the doc, but I don't have many time left until the submission.
    I'll learn sequencer, while waiting for the answer.
     
    Last edited: Jul 9, 2015
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @johanesnw - The Dialogue System will call your dialogue UI's HideSubtitle() method when the dialogue line has ended. You can also add a script that has methods for a number of script messages.

    Use the same "OnConversationContinue":
    Code (csharp):
    1. DialogueManager.Instance.SendMessage("OnConversationContinue");
    This tells the Dialogue System to proceed to the next step in the conversation.

    Yes. Every conversation node (aka "dialogue entry") has a Script field. You can use Lua to set the variable:
    Code (Lua):
    1. Variable["MyVariable"] = 42
    or use the Lua Wizard if you don't want to enter Lua code. Use the Conditions field to check variable values:
    Code (Lua):
    1. Variable["MyVariable"] == 42
    You can also register your own C# methods with Lua if you want to call your own script code inside the Script or Conditions field.

    You can reference variables inside Dialogue Text:
    • Dialogue Text: "Hello, [var=PlayerName]! You are [var=Age] years old."
     
  48. Candescence

    Candescence

    Joined:
    Aug 26, 2014
    Posts:
    107
    Heh, I dunno about questions, but I guess I could outline the specifics of what I'm looking to do:
    • Real-time dialogue with a dedicated dialogue menu button (obviously trivial, I imagine)
    • Non-dialogue means of performing choices and communication, such as presenting items to an NPC Ace Attorney-style or performing gestures Dark Souls-style (again, probably not that hard)
    Breaking up the list for a moment, for context's sake, the idea is basically a mixture of various mechanics from certain games/genres (mainly RPG and classic adventure games) into a real-time system that is designed to not take control away from the player, and also not compromise other aspects of gameplay, or even enhance them - such as dialogue and actions during combat that can affect the behaviour of friend and foe alike, for example.
    • Directing the behaviour and animations of NPCs during sequences, such as more directed sequences, or simply doing things such as following the player. Basically, treating NPCs as actors rather than objects. This includes stuff like facial animation and interacting with objects. (This is one I'm not quite so sure of, but I know there's aspects of this built-in and using certain integrations.)
    And... Uh... Wait, is that it? Huh, I thought there was more to it. Maybe I'm forgetting something. Oh, well, you get the general idea of what I'm going for, hopefully.
     
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    All do-able. Each of these might have different triggering mechanisms, but you can use the Dialogue System as a holistic framework to handle them all in a fairly consistent manner. I recommend taking each one separately and using the Dialogue System mechanism that works best for it. For example, context-driven one-liners during combat ("I'm hit!" or "Cover me; I'm reloading!") may work best as barks, whereas multi-line dialogue will work better as traditional conversations.
     
  50. Darkkingdom

    Darkkingdom

    Joined:
    Sep 2, 2014
    Posts:
    81
    Now I got a new small problem.
    Everytime I reload my scene ingame, for example when the player dies, the dialogue variables won't reset.
    Like the state of quests etc.
    I tried to use the DailogueManager.ResetDatabase at Start() function from the level but nothing happens.

    Code (CSharp):
    1. DialogueManager.ResetDatabase (DatabaseResetOptions.RevertToDefault);
    What am I doing wrong :)?