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
    Happy to help! If you get into it and have more questions, just let me know.

    Love/Hate is focused on solving a specific problem: AI emotions in relation to witnessed deeds. The Dialogue System, which is Pixel Crushers' flagship product, is more general. In a nutshell, it's a very flexible tool that lets you write and run interactive conversations. When you really analyze how interactive conversations work, you find that they need to do a lot more than just show words on the screen. They have to remember the players' responses, decide which branches to follow, manage input and output (subtitles and response menus, camera work, animation and lipsync, etc.), and more. The Dialogue System approaches this holistically to make it all work together, and provides lots of integration packages with other assets and hooks to make it easy to integrate your own code.

    But, to answer your question, yes. In essence you create a dialogue database, run conversations from it, and use values either internally in the database or through your custom scripts. Dialogue databases support language localization, and you can also use a number of third party editors such as Chat Mapper and articy:draft if you or your writers prefer them over the built-in editor.

    Please feel free to give the free evaluation version a spin: Evaluation Version
     
  2. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    356
    I finally bought this asset and it's fantastic. Saves so much time, it's unbelievable. And it makes all of my dialogue so much clearer as well. Great work!
     
    TonyLi likes this.
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Thanks! :)
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Updated Dialogue System Menu Template Available

    The Dialogue System Menu Template package has been updated on the Dialogue System Extras page. This free template is based on Unity's Game Jam Menu Template and adds these new features:
    • Pause menu options for quest log window and return to main menu
    • Load, save, continue, and restart games
    • [NEW] Option to save to encrypted disk files or PlayerPrefs
    • [NEW] Option to use a separate loading screen
    • [NEW] Options menu has toggle for subtitles
    It's designed to give your project a complete menu framework with a main menu scene and in-game pause menu that supports saving and loading games, and it doesn't require any scripting. Just drop it into your project and customize the appearance.
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Updated Realistic FPS Prefab Support Package Available

    The Dialogue System Extras page has an updated support package for Azuline Studios' Realistic FPS Prefab. Saved games now include the number of bullets left in each weapon's magazine, in addition to the reserve ammo count that was previously saved.

    (The Extras page also has an updated support package for Icebox Studios' Adventure Creator 1.51 that updates the example scene to accommodate changes in 1.51.)
     
  6. martire

    martire

    Joined:
    Feb 27, 2015
    Posts:
    36
    Hi, could you help me again? :)

    I have a NPC who barks on idle but I'd like to use the Range trigger to bark only when my player gets closer... I created an empty gameobject and gave it a box collider (trigger) and the Range Trigger script. However, my NPC keeps barking wherever I am :(

    A second question would be: is there a way to reset the sequential lines of dialogue when baking in order to always start from the first one when I exit the trigger?

    Thanks!
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @martire - Disable the Bark On Idle component at design time (i.e., in the editor, before you play). The Range Trigger only takes action when a valid GameObject enters or exits the trigger collider. It doesn't do anything at the start of the scene.

    Also, if you only want the player to affect the Range Trigger, add the player's Tag in the Range Trigger's Condition > Accepted Tags section.

    Not yet. The upcoming version 1.6.4 has two new features that you can use to do this:
    • Range Trigger will have OnEnter and OnExit events that you assign in the inspector (like Unity UI Button's OnClick event).
    • BarkOnIdle and BarkTrigger will have a ResetBarkHistory method. So you can configure the Range Trigger's OnExit event to call ResetBarkHistory.
     
  8. martire

    martire

    Joined:
    Feb 27, 2015
    Posts:
    36
    Thanks!
    This new version it's gonna be awesome too!
     
    TonyLi likes this.
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Dialogue System clashes with my own api with Language which doesn't seem to be in your namespace :/ no big deal - I renamed my classes, thought I'd give you a heads up though.
     
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @hippocoder - The Dialogue System is contained in the PixelCrushers.DialogueSystem namespace, but unless you've switched to NLua it uses LuaInterpreter, which is an open source Lua implementation in the Language.Lua namespace (hence the conflict with your Language). I'd change the namespace since I've already modified the heck out of LuaInterpreter, but I don't want to break other customers' existing projects that reference Language.Lua. I'm glad you could rename your class to work around the conflict.



    For other customers who might be encountering the same thing, you can do what hippocoder did, or use explicit namespaces to disambiguate (e.g., Language.Lua.LuaValue vs. MyPersonalNamespace.Language), or add a using directive at the top of your script to disambiguate (e.g., using Language = MyPersonalNamespace.Language).
     
    Tinjaw and hippocoder like this.
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Dialogue System Menu Template Updated

    The 2016-06-03 version of the Dialogue System Menu Template is now on the Dialogue System Extras page.

    This update adds some nice new options, including:
    • Play animations (e.g., fade in or explode open) when opening/closing Pause menu.
    • Use a separate loading scene.
    • Save games to encrypted disk files instead of PlayerPrefs.
    • Detect whether the player is using keyboard/mouse or joystick, and only auto-focus a menu element if using joystick (to give joystick users a starting point to navigate menu elements).
     
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Dialogue System 1.6.4 Released

    Version 1.6.4 is now available on the Pixel Crushers customer download site (PM me your Asset Store invoice number if you need access) and should be on the Asset Store in a few days.

    The main reason for this release is to fix a superficial but annoying bug introduced in 1.6.3. If the Dialogue Editor window was open, it would auto-inspect the current dialogue entry when switching into playmode, even if you were inspecting a different asset.

    The complete change list is:

    Version 1.6.4

    Core:
    • Added: OnEnter & OnExit events to RangeTrigger.
    • Added: ResetBarkHistory method to BarkTrigger & BarkOnIdle.
    • Fixed: Dialogue Editor window inappropriately auto-selected the current dialogue entry in the Inspector when switching into playmode even when something else was selected.
    • Fixed: SetEnabledOnDialogueEvent component's Lua Condition Wizard wasn't working in Inspector.
    • Improved: LuaInterpreter can now handle exponents with "+" signs such as 1.3E+5 (as well as 1.3E-5 and 1.3E5).
    • Improved: Added string.find() function to LuaInterpreter.
    • Improved: Added continue button support to default (fallback) dialogue UI.
    • Unity UI: Added OnOpen & OnClose events to UnityUIQuestLogWindow inspector; auto-focus also works better now.
    Third Party Support:
    • Adventure Creator: Updated example scene for AC 1.5.1.
    • Realistic FPS Prefab: Now also saves bullets left in clip in addition to reserve ammo.
    • UFPS: Added Lock Cursor On Start checkbox to FPFreezePlayer.
     
    Tiny-Tree and hopeful like this.
  13. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    @ToniLi

    Hey, hello yet once again. I'm now tackling another thing that I need to do with the system. What would be the best way to change the response menu in order to be able to select the response before actually responding? For example, selecting would highlight the entry and the continue button show up, this way I could change my selection and it would prevent users from accidentally select one of them.

    PS: thanks for taking care of that saving bug for good, much better experience since then ;)
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @kebrus - I'm afraid there was still one annoying (but superficial) bug left in the Dialogue Editor. It's fixed in version 1.6.4. In version 1.6.3, if the Dialogue Editor was open it would auto-inspect the last-edited dialogue entry node when switching into playmode, even if you had selected a different asset. It was just a superficial thing, but it was still driving me crazy in my own projects. :)

    Here's one way to handle the response menu (assuming Unity UI):

    1. Add a script like this to the dialogue UI GameObject:

    ResponseMenuContinueButtonController.cs:
    Code (csharp):
    1. public class ResponseMenuContinueButtonController : MonoBehaviour {
    2.  
    3.     public UnityEngine.UI.Text previewText;
    4.     public UnityEngine.UI.Button continueButton;
    5.     public Response currentResponse;
    6.  
    7.     private UnityUIDialogueUI dialogueUI;
    8.  
    9.     void Awake() {
    10.         dialogueUI = GetComponent<UnityUIDialogueUI>();
    11.     }
    12.  
    13.     public void OnConversationLine() {
    14.         SetUIElements(false);
    15.     }
    16.  
    17.     public void OnConversationResponseMenu(Response[] responses) {
    18.         SetUIElements(false);
    19.     }
    20.  
    21.     public void SetCurrentResponse(Response response) {
    22.         SetUIElements(true);
    23.         var dialogueText = FormattedText.Parse(response.destinationEntry.DialogueText, DialogueManager.MasterDatabase.emphasisSettings).text;
    24.         previewText.text = dialogueText;
    25.         currentResponse = response;
    26.     }
    27.  
    28.     public void SetUIElements(bool value) {
    29.         previewText.gameObject.SetActive(value);
    30.         continueButton.gameObject.SetActive(value);
    31.     }
    32.  
    33.     public void OnClick() {
    34.         dialogueUI.OnClick(currentResponse);
    35.     }
    36. }
    2. Create a text element for the preview text (or just remove that from the code if you don't want a preview) and assign it to the Preview Text field of the script above. The preview text will hold the response's Dialogue Text, which could be the verbose version of Menu Text that's actually spoken by the player.

    3. Create a continue button in the response menu and assign it to the Continue Button field of the script above. Set its OnClick event to call the script's OnClick() method.

    4. Add a script like this to each of your response buttons:

    ResponseButtonPreviewer.cs:
    Code (csharp):
    1. public class ResponseButtonPreviewer : MonoBehaviour {
    2.  
    3.     private UnityUIResponseButton responseButton;
    4.     private ResponseMenuContinueButtonController continueButtonController;
    5.  
    6.     void Awake() {
    7.         responseButton = GetComponent<UnityUIResponseButton>();
    8.         continueButtonController = GetComponentInParent<ResponseMenuContinueButtonController>();
    9.     }
    10.  
    11.     public void OnClick() {
    12.         continueButtonController.SetCurrentResponse(responseButton.response);
    13.     }
    14. }
    How it works:
    1. When the response menu starts, it hides the continue button. (This is a different continue button from the subtitle continue button(s).)
    2. When the player clicks on a response button, it doesn't tell the dialogue UI to use that response. Instead, it shows a preview of the response's Dialogue Text and enables the continue button.
    3. When the player clicks the continue button, it actually tells the dialogue UI to use that response.

    You could get even fancier with the SetCurrentResponse() method. Instead of just setting the preview text, you could define a custom field "PreviewSequence" in each dialogue entry. SetCurrentResponse() could look up the response's PreviewSequence field and play it as a sequence. This sequence could play animation to change the player's facial expression and body language, subtly change the background color (e.g., red for aggressive responses, blue for calm responses), etc.
     
    kebrus likes this.
  15. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    @TonyLi

    Thx it worked like a charm. ;)
     
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Awesome!
     
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Dialogue System for Unity 1.6.4 Now Available on Asset Store

    Version 1.6.4 is now available on the Asset Store! The release notes for this version are above.
     
  18. vivalavida

    vivalavida

    Joined:
    Feb 26, 2014
    Posts:
    85
    hi @TonyLi , just noticed a strange 'bug ' in my project.

    I run a conversation once in a 'level 1',
    but once I exited to the 'menu' and came back the conversation doesn't start up again.

    any clue as to why this must be happening?

    am using dialogue system 1.6.1.1

    Thanks for you time.



    edit:
    I guess the conversation is starting, just that it isn't going to the first dialogue for some reason.
    I've setup a continue button,
    When i press it the first dialogue shows up,
    but the first dialogue is supposed to show up without any user input.

    All this works fine the first time the scene is loaded (both editor and build) only on exiting and reentering the scene do these problems show up.
     
    Last edited: Jun 9, 2016
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @vivalavida - Here are some troubleshooting tips:

    1. Open the Dialogue Editor and select the conversation in the Conversation tab's node editor. The current node will be highlighted in green. Possible next steps will have green link arrows; blocked (false) links will be red.

    2. Set the Dialogue Manager's Debug Level to Info. This will log the current state of the conversation as it runs. Look for lines like:

    Dialogue System: Starting conversation...
    Dialogue System: Add Link <-- This entry was added as a possible next step.
    Dialogue System: Block on False Link <-- Entry's Conditions are false; not added as a next step.
    Dialogue System: actor says... <-- Shown as a subtitle.
    Dialogue System: Sequencer: Play... <-- Sequencer commands played with subtitle.​

    This might give you some insight into what's going on with the conversation as it runs. For example, the sequencer commands may be causing the dialogue entry node to wait, or the Conditions may be false after you come back to the conversation.

    If that doesn't help, please feel free to send a reproduction project to tony (at) pixelcrushers.com and let me know what version of Unity to use. I'll be happy to take a look!
     
    Last edited: Jun 9, 2016
  20. r3nrohan

    r3nrohan

    Joined:
    Sep 28, 2015
    Posts:
    33
    Hi, I was wondering if we could get of any Quest Status through Programming in MonoBehavior, similar to DialogueLua.GetVariable(ActualVariableName).AsInt;
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @r3nrohan - Sure; just use the QuestLog class:

    Code (csharp):
    1. using PixelCrushers.DialogueSystem;
    2.  
    3. // Get a quest state:
    4. var questState = QuestLog.GetQuestState("My Quest");
    5.  
    6. // Shortcut functions for convenience:
    7. if (QuestLog.IsQuestActive("My Quest")) { // same for Successful, Failed, etc.
    8.     Debug.Log("Quest is active!");
    9. }
    10.  
    11. // Set a quest state:
    12. QuestLog.SetQuestState("My Quest", QuestState.Success);
    The QuestLog class lets you do a lot more, too, such as getting and setting quest entry states, creating new quests, getting lists of quests, enabling tracking, etc.
     
  22. FlamingFur

    FlamingFur

    Joined:
    Dec 30, 2015
    Posts:
    9
    Hi Tony. I got one more question. Please help.
    I'm using Save System in my game, but I Just can't figure out how to save additional data.
    Can you please make a example scene contains this function?
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @Heycrowbar - Here's an example scene: SaveCustomDataExample_2016-06-10.unitypackage

    It contains a button that you can press. Every time you press the button, it increments a counter. The button script saves the current count to a Lua variable named "ButtonPressCount":

    Code (csharp):
    1. using UnityEngine;
    2. using PixelCrushers.DialogueSystem;
    3.  
    4. public class ButtonRig : MonoBehaviour {
    5.  
    6.     public UnityEngine.UI.Text text;
    7.     public int count = 0;
    8.  
    9.     private Animator m_animator;
    10.  
    11.     void Awake() {
    12.         m_animator = GetComponent<Animator>();
    13.     }
    14.  
    15.     void OnUse(Transform actor) {
    16.         m_animator.Play("PressButton");
    17.         SetCount(count + 1);
    18.     }
    19.  
    20.     public void SetCount(int newCount) {
    21.         count = newCount;
    22.         text.text = count.ToString();
    23.     }
    24.  
    25.     // The Dialogue System calls this method when saving a game or
    26.     // before LevelManager changes levels:
    27.     public void OnRecordPersistentData() {
    28.         DialogueLua.SetVariable("ButtonPressCount", count);
    29.     }
    30.  
    31.     // The Dialogue System calls this method when loading a game or
    32.     // after LevelManager has changed to a new level:
    33.     public void OnApplyPersistentData() {
    34.         SetCount(DialogueLua.GetVariable("ButtonPressCount").AsInt);
    35.     }
    36. }
    If you'd like more details on saving your specific data, just let me know.
     
  24. r3nrohan

    r3nrohan

    Joined:
    Sep 28, 2015
    Posts:
    33
    Thank You, But now I have one issue that I am not able to figure out. Lets suppose we have 5 quest to kill random amount of same monster. But we are to active 3 quest in middle of doing 2 quests and already killed few while those 2 quests are active. This way we also increased count of monster killed in new 3 quests, without killing any monsters. Is there any way to prevent that
     
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    You could use separate variables and reset them when you start a quest. For example, let's say you have two quests:
    • Kill 5 Orcs
    • Kill 3 Orc Shamans
    You could keep track of kills with these variables:
    • Kill 5 Orcs -- Variable["OrcsKilled"]
    • Kill 3 Orc Shamans -- Variable["OrcShamansKilled"]
    Let's also say you use Increment On Destroy to track kills.
    • On your Orcs, add an Increment On Destroy that increments OrcsKilled. When the player kills an Orc, it will increment OrcsKilled.
    • On your Orc Shamans, add two Increment On Destroy components, one that increments OrcsKilled and another that increments OrcShamansKilled. When the player kills an Orc Shaman, it will increment OrcsKilled and OrcShamansKilled.
    When you start the "Kill 5 Orcs" quest, set OrcsKilled to zero. For example:
    • Quest Giver: "Kill 5 Orcs for me."
      • Player: "I accept this quest."
        Script: SetQuestState("Kill 5 Orcs", "active"); Variable["OrcsKilled"] = 0
    Likewise for the "Kill 3 Orc Shamans" quest.
     
  26. r3nrohan

    r3nrohan

    Joined:
    Sep 28, 2015
    Posts:
    33
    LOL I was not hoping for same answer that I applied, so I need lot of variable for counting for same monster
     
  27. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    To track 5 independent values, generally speaking you need 5 independent variables. That's not specific to the Dialogue System.

    If I misunderstood you, please describe what you want to do, and I'll describe how to implement it in the Dialogue System.
     
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Suppressed On Steam Greenlight

    Please support @zephyo's game, Suppressed, on Steam Greenlight:



    In this socially conscious visual novel and 2D platformer, you must escape from an isolated, totalitarian nation modelled after North Korea. (And it's made with the Dialogue System, of course!)
     
    zephyo likes this.
  29. dwaldrum

    dwaldrum

    Joined:
    Jun 20, 2015
    Posts:
    48
    Just grabbed this asset and so far it looks like it will accomplish everything I need. Amazing asset. Question I can't seem to find an answer for yet going through the documentation.

    How would I go about adding status icons above NPC'S heads for quests. Ie: a question mark for quests being available and exclamation marks for quests ready to be completed by talking to the NPC, similar to most mmorpgs.

    Specifically how to know when to add them. I know how to add a world space canvas and icon, but not sure how to get basically a "hasAvailableQuests" and "hasCompletedQuests" type query done.
     
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi! Thanks for buying the Dialogue System!

    Add a Dialogue System Events component to your Dialogue Manager and hook up the quest change event, or add a script with an OnQuestStateChange method. Or, if you're changing quest states during conversations, use the SetActive sequencer command to activate and deactivate canvases. (Side note: Add an Always Face Camera component if you want the world space canvas to always face the player's camera.) You can also get information from the QuestLog class. I'm out of the office at the moment, but if you'd like more details on any of these, I can provide details when I get back.
     
    Last edited: Jun 13, 2016
  31. dwaldrum

    dwaldrum

    Joined:
    Jun 20, 2015
    Posts:
    48
    Thanks for the information. I don't think any of the events will work for this use case. Imagine a player starting a game with an NPC and an available quest. No events have happened, no conversations started, but the npc should be able to show they have an available quest. This is a typical scenerio in mmos and rpgs. I think the quest log looks the most promising for this task. If there is a way to do it with events or any other info you can give me for using the quest log to do this that would be great.
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    A combination of OnQuestStateChange and the QuestLog class will do the job. Here's an example scene with code (exported in Unity 5.3.4):

    QuestIndicatorExample_2016-06-13.unitypackage

    This code will be in the next release when I've had a chance to pretty it up a bit. Functionally it should remain the same as the package above.

    It imports into Dialogue System Examples/Quest Indicator Example. As you talk to Private Hart and the Mainframe Terminal, the quest indicators above them will change. Three scripts do the work:
    • QuestStateIndicator: (On NPCs) Associates a GameObject (e.g., world space canvas element) with an indicator level. In the example scene, level 0 = nothing, level 1 = question mark, and level 2 = exclamation mark.

    • QuestStateListener: (On NPCs) When informed of a quest state change, updates the QuestStateIndicator's current indicator level, and optionally does other things via a UnityEvent that you can hook up in the inspector. The inspector for this script is a bit clunky right now. Add elements to the Quest State Indicator Levels foldout. In each element, specify a quest state and the indicator level associated with the quest state. There's also a corresponding foldout for quest entry states.

    • QuestStateDispatcher: (On the Dialogue Manager) Has a registry of NPCs' QuestStateListeners. When a relevant quest state changes, informs the NPC's QuestStateListener.
     
    hopeful likes this.
  33. Hormic

    Hormic

    Joined:
    Aug 12, 2014
    Posts:
    251
    Hi TonyLi,

    I have a functioning setup with Salsa and RT-Voice and i want to control the dialogs now with your Dialog System.
    You support both tools, so what would you say is the preferable way of setting things up now?
    Thanks for suggestions! :)
     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @Hormic - Import the SALSA Support and RT-Voice Support packages located in Third Party Support. Then add an RT Voice Actor component to your characters, and tick Wait for Voice in Conversations. That's it. You don't have to add special sequencer commands or anything like that. (The full instructions with more details are here.)
     
    Hormic likes this.
  35. Hormic

    Hormic

    Joined:
    Aug 12, 2014
    Posts:
    251
    ohh ok there are example scenes for that, very nice!
    But i'm a bit confused about the Support packages.
    I have now importet the RTVoice Support Package and the package which is included in this package the -> RTVoice Salsa Package.
    Do i also have to import the regular Salsa Support Package, which you have described here ->
     
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    It's a good idea, since it will give you access to the SALSA sequencer commands to control eyes and facial expressions.
     
    Hormic likes this.
  37. pwas

    pwas

    Joined:
    Jan 14, 2015
    Posts:
    11
    Hello.
    I am trying to implement skip feature for conversation. It is done so far by calling StopConversation() on DialogueSystemController instance. But in some nodes in conversation there are lua scripts put in "Script". It is possible to invoke all lua scripts at once? Or should I done it manually?
     
    Last edited: Jun 20, 2016
  38. Corvwyn

    Corvwyn

    Joined:
    Nov 15, 2013
    Posts:
    114
    Hope you don't mind me asking, but have you considered adding support for ink (by inkle)? I'm using your Dialogue system now, with the included dialogue editor, but I'm considering using ink to write dialogue. Don't know how I feel about the visual vs text based editor yet though.

    Might not be compatible, since ink has it's own handling of variables and such, but I thought I'd ask. Maybe it could be considered a competitor, though it mostly handles the text part of the dialogue. I'd have to mix and match at the moment, but I don't know if it's worth the effort.
     
  39. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @pwas - It should be done manually. If the same Lua scripts should always run at the end of a conversation, consider moving them out of the conversation and putting them all in a Lua Trigger set to OnConversationEnd.

    Otherwise you'll have to manually traverse the dialogue tree. You'll need to determine how to handle branches. Take this example:
    • NPC: "Will you deliver this letter to my father?"
      • PC: "Yes." {Script: SetQuestState("Deliver Letter", "active")}
      • PC: "No." {Script: SetQuestState("Deliver Letter", "failure")}
    If the player skips the conversation in the example above, should you run the "Yes" entry or the "No" entry?

    In general, to traverse the tree start with DialogueManager.CurrentConversationState. Then use DialogueManager.ConversationModel to change states through the tree. As you traverse the tree, the conversation model will automatically run the Script fields. Here's some example code:

    Code (csharp):
    1. var state = DialogueManager.CurrentConversationState;
    2. while (state != null) {
    3.     if (state.HasNPCResponse) {
    4.         state = DialogueManager.ConversationModel.GetState(state.npcResponses[0].destinationEntry);
    5.     } else if (state.HasPCResponses) {
    6.         state = DialogueManager.ConversationModel.GetState(state.pcResponses[0].destinationEntry);
    7.     } else {
    8.         state = null;
    9.     }
    10. }
    Hi @Corvwyn - Ink and Twine support are both on the roadmap. :) When Ink support is ready for beta testing, I'll send you an advance copy. It'll be some time, though, because Twine support is next in the queue.
     
    Corvwyn likes this.
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Dialogue System for Unity 1.6.5 Released!

    The Dialogue System for Unity 1.6.5 is now available on the Pixel Crushers customer download site (PM me with your Unity Asset Store invoice number for access) and should be on the Unity Asset Store in a few days!

    The highlights of this release are:
    • Quest state indicators, such as question marks above NPCs' heads when they have quests to offer.
    • Finally fixed the last Dialogue Editor bug (famous last words) related to the API change in Unity 5.3. If you use the Dialogue Editor, 1.6.5 is the version to use.

    Version 1.6.5
    Core
    • Added: IncrementOnDestroy: Condition.
    • Added: Quest State Indicators. Updated Quest Example scene.
    • Added: Bark sequences can now reference entrytag.
    • Added: DialogueManager.PlaySequence(…entrytag) variant to specify an entrytag.
    • Fixed: Dialogue Editor got out of sync with database after playmode in Unity 5.3+.
    • Fixed: Dialogue Editor reported NullReferenceExceptions in editor while adding new localization fields but before entering field title.
    • Fixed: ConversationTrigger didn’t mark scene dirty when changing conversation selection.
    Third Party Support
    • NGUI: Added NGUI Continue Button Fast Forward component.
    • ORK Framework: Added more warning logs in case of typos in Lua functions.
     
    Adrad likes this.
  41. pwas

    pwas

    Joined:
    Jan 14, 2015
    Posts:
    11
    Thank you for your reply. I have chosen the tree traverse and it works perfectly.
     
  42. FlamingFur

    FlamingFur

    Joined:
    Dec 30, 2015
    Posts:
    9
    I'm so sorry keep you waiting for so long these days. I've been flooded by works and now I'm off duty. Thanks for your answer and it really helps me a lot! Problem solved. Thank you again!
     
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    No worries; I'm glad the problem's solved!
     
  44. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    298
    Heya Tony,

    The asset looks great! I'm sorry if you've answered these questions before:
    1. Can conversations have more than two characters in them? I've been looking at using articy:draft and your importer. If I end up doing this, are conversations with more than two characters problematic?
    2. Can I manually handle saving with DSfU? As in, save the data in my own save file, and when the game is loaded inject what I need into DSfU?
    3. I'm hoping to use DSfU as a database that I can access and move through. Let's say I filled out a conversation, a bit of back and forth, checking a variable or two, some multiple choices, how much control do I have over the flow through this? I know you can rig up DSfU to a custom GUI, but what if I say wanted to show text without a next button, and instead handle timing and sound files etc. myself? So regular lines that don't require user input just play through. Is this possible?
    And specifically about articy:draft:
    • Is there anything I should keep in mind when using this? Things like referencing variables from separate conversations, is that all fine when coming in to DSfU? My game only has a handful of characters, but I'm hoping to quite frequently reference choices made throughout the game, can you see any gotchas here? Or it's all pretty straightforward?
    Thanks!
     
  45. Corvwyn

    Corvwyn

    Joined:
    Nov 15, 2013
    Posts:
    114
    Excellent! Looking forward to it. Keep up the good work!

    Hadn't heard of Twine, but I'll have to check that out in the meantime.
     
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @gumboots - Conversations can involve as many characters as you want.

    Yes. The Dialogue System serializes its save data as a string. For example, if you're using Easy Save 2, you can save the Dialogue System's data with this line of code:
    Code (csharp):
    1. ES2.Save(PersistentDataManager.GetSaveData(), "myFile.txt?tag=dialogueSystem");
    and then inject it back into the Dialogue System with this line:
    Code (csharp):
    1. PersistentDataManager.ApplySaveData(ES2.Load<string>("myFile.txt?tag=dialogueSystem"));
    (More info in the FAQ).

    Very possible. This is one of the biggest strengths of the Dialogue System. It uses a modular design, so you can swap in new UI functionality and the Dialogue System will work happily with it. You can do lot of what you described by simply ticking certain checkboxes and changing some dropdowns. You can completely change everything in the UI experience, too, if you want to. I could go on forever on this topic, but just let me know when you get to this point and I'll be happy to point you in the right direction.
    It's all straightforward. There are a few very minor differences, so it's worthwhile to look over the articy:draft Converter page. In particular, the converter adds support for link priorities, and it doesn't convert Strips.

    Please feel free to try out the free evaluation version, and if you have any other questions just let me know!
     
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Pixel Crushers Holiday Hours June 24 - July 2

    I'll be traveling June 24 -July 2. I'll do my best to reply to any posts as promptly as possible each day, but responses might be a little slower than usual next week.
     
  48. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    Enjoy your time off! :)
     
    TonyLi likes this.
  49. knotFF

    knotFF

    Joined:
    Apr 13, 2013
    Posts:
    66
    I am getting this error: (OSX 5.1.4B21)

    Code (CSharp):
    1. HasKey is not allowed to be called from a ScriptableObject constructor (or instance field initializer), call it in OnEnable instead. Called from ScriptableObject 'DialogueEditorWindow'.
    2. See "Script Serialization" page in the Unity Manual for further details.
    3. UnityEditor.EditorPrefs:HasKey(String)
    4. PixelCrushers.DialogueSystem.TemplateTools:LoadFromEditorPrefs()
    5. PixelCrushers.DialogueSystem.DialogueEditor.DialogueEditorWindow:.ctor()
    6.  
     
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @FF1878 - If you'll please PM me your Asset Store invoice number, I'll set you up with access to the Pixel Crushers customer download site where you can download a patch. BTW, what version of Unity are you using?
     
    Last edited: Jun 24, 2016