Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

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

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

  1. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Happy to help. I'm glad you got it working!
     
  2. zephyo

    zephyo

    Joined:
    Mar 28, 2016
    Posts:
    33
    Hey TonyLi, it's me again, really sorry to bother; I have another problem. All of the Unity UIs I've tried, fail to produce a response menu. During gameplay the response panel isn't enabled when it should be. The GUI Root UIs can get a response menu up but I don't know how to customize those. Do you think you could help me out in getting the response menu to show?
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Hi @zephyo - That's a new one to me. Does Examples/Unity UI Examples/Generic UI Example Scene work?

    What happens if you add Prefabs/Unity UI Prefabs/Generic/Generic Bundled UI to your scene as a child of the Dialogue Manager and assign its Dialogue UI child to the Dialogue Manager's Dialogue UI field?

    Another thing to try: In your scene, try setting the Dialogue Manager's Subtitle Settings > Continue Button mode to Never and let me know if that makes a difference. If it does, then your subtitle is probably waiting for the player to click the continue button. Make sure your continue button is visible.

    Feel free to send a reproduction project to tony (at) pixelcrushers.com and let me know what version of Unity to use.
     
  4. zephyo

    zephyo

    Joined:
    Mar 28, 2016
    Posts:
    33
    Hi, the Generic UI Example Scene does work, but when I tried copy pasting its dialogue manager+generic Unity UI into my scene, some response button(Clone)s were enabled, but I couldn't click them. I also tried as you suggested - putting generic bundled UI as my dialogue UI - but it produced the same results.

    Furthermore, changing the Continue Button to Never has no effect.

    I sent a package to you, using Unity 5.3.4f1 Personal, which I hope can help us solve this! The Database is called Glow2Database, the scene is "Glow2", and the dialogue I'm stuck on is at the very end of the level, on Conversation "End".
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Hi @zephyo - I just replied to your email.
     
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Dialogue System 1.6.2 On Asset Store

    Version 1.6.2 is now available on the Asset Store! Since this version fixes a serialization bug in the Dialogue Editor, I recommend everyone update to it when possible. (Reminder: When importing any package from any source, it's always a good idea to back up your project first.)
     
  7. lukata

    lukata

    Joined:
    May 5, 2016
    Posts:
    2
    Hello, friends! Please help! I have a problem with my dialogue system in Unity 5.3.4. I recorded my different replicas (audio voice acting) for my game heros, put them in the dialogue system, but when I choose one it repeates all the time. What to do to stop this LOOPING? (the loop option is not marked)
     
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Hi @lukata - It's possible that the Dialogue System is choosing to use a different Audio Source than the one you expect. How are you starting the audio clip? For example, are you using an AudioWait() sequencer command? If so, would you please paste the command into a reply here?

    Please also let me know which version of the Dialogue System you're using. Thanks!
     
  9. lukata

    lukata

    Joined:
    May 5, 2016
    Posts:
    2
    Thanks for the reply ToniLi. The command that I use is AudioWait (audiosource), and everything on Audio sequence is done as described in the instructions of the dialog system. The problem appears when I add a voice acting to the hero controlled by the player. I couldn't tell you the version of the Dialogue system because I have 4 :)
     
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Would you mind posting an example Sequence field? (Or, if you're relying on the Dialogue Manager's Default Sequence, please post that.) For example, it might look something like this:
    • Sequence: AudioWait(hello, Hero)
    Or like this:
    • Sequence: AudioWait(hello)

    In the first case (AudioWait(hello, Hero)), the Dialogue System will look for an Audio Source on the GameObject named "Hero" and play the audio clip named "hello". If this GameObject doesn't have an Audio Source, the Dialogue System will add a default one.

    In the second case, (AudioWait(hello)), the Dialogue System will look on the GameObject associated with the current speaker.

    In either case, AudioWait() will stop the current audio clip (e.g., hello) when it's done playing.

    Consider updating to version 1.6.2. It includes a small enhancement to AudioWait() that may resolve your issue or at least provide more information about it.

    Also, are there any errors or warnings in the Console view?

    Please feel free to send an example project to tony (at) pixelcrushers.com and let me know which version of Unity to use. I'll be happy to take a look.
     
    Last edited: May 5, 2016
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Updates for Opsive's Third Person Controller, Unitycoding's RPG Kit, RelationsInspector Preview

    The Dialogue System Extras page has updated support packages for:
    • Opsive's Third Person Controller: Updates support for TPC 1.3.
    • Unitycoding's RPG Kit: UI tweaks for dialogue and quest windows.
    • Icebox Studios' Adventure Creator: Actions now accept parameters.
    • Paradox Notion's SLATE Cinematic Sequencer: Updates support for SLATE 1.2.6+.

    I'm also excited to share a preview image of the upcoming Dialogue System backend for Seldom Tools' excellent RelationsInspector. This fantastic tool gives you visual representations of all kinds of hierarchical data. The developer has been hard at work adding Dialogue System integration so you'll be able to view relationships such as:
    • What GameObjects in my scene are connected to Dialogue System conversations, barks, or quests?
    • Which conversations do my cross-conversation links connect to? (And jump straight to the dialogue entry with a single click!)
    For example, this screenshot shows which GameObjects in the Quest Example scene are connected to conversations and quests:



    The screenshot hardly does the tool justice since all of the Dialogue System's example scenes are purposely simple. But I think it gets the idea across that, if you're working with complicated data (in the Dialogue System or elsewhere), RelationsInspector can be very handy!
     
  12. Julian-Palacios

    Julian-Palacios

    Joined:
    Oct 5, 2015
    Posts:
    3
    Hi, sorry to bother, hope my question is not stupid, but I searched through all the components and in the website without success.
    I have a conversation with two answers: I want to activate a component on another gameobject (neither player or NPC) if I choose answer A.
    I'm sure there is a way!
    Thanks in advice and sorry for the dumb question...
     
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Hi @Julian Palacios - Use the SetEnabled() sequencer command. Inspect answer A, and set the Sequence field to:

    SetEnabled(component, true, subject)

    where:
    • component: Is the name of the component to enable.
    • subject: is the name of the other GameObject.
    For example:
    • Sequence: SetEnabled(BlurEffect, true, MyCamera)
    This will enable the component BlurEffect on the GameObject named MyCamera.
     
  14. Julian-Palacios

    Julian-Palacios

    Joined:
    Oct 5, 2015
    Posts:
    3
    Thanks, it worked!
     
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Dialogue System 1.6.2.2 Released!

    A minor version release is available on the Pixel Crushers customer download site (PM me your Asset Store invoice number if you'd like access) and should be on the Asset Store in a few days.

    Version 1.6.2.2:
    • Adds a method DialogueManager.BarkString() for when you want to bark literal text instead of looking up a line in a conversation.
    • Fixes a bug introduced in 1.6.2 that occurred when starting a conversation and not specifying the conversant.
    • Updates the articy:draft converter for articy:draft 2.4.6+.
     
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    That was quick! Version 1.6.2.2 is now available on the Asset Store!
     
  17. EpicIndustries

    EpicIndustries

    Joined:
    Sep 28, 2014
    Posts:
    32
    Hello.

    I have a problem when reloading my exiting my current Unity scene and then re-entering the one where the Dialogue Manager gameobject resides (I'm using SceneManager.LoadScene).

    Upon re-entering the scene, I get a few warning messages, here are some, but all are similar:

    Code (csharp):
    1.  
    2.  
    3. Dialogue System: Can't register Lua function CurrentQuestState. A function with that name is already registered.
    4. UnityEngine.Debug:LogWarning(Object)
    5. PixelCrushers.DialogueSystem.Lua:RegisterFunction(String, Object, MethodInfo)
    6. PixelCrushers.DialogueSystem.QuestLog:RegisterQuestLogFunctions()
    7. PixelCrushers.DialogueSystem.DialogueSystemController:Start()
    8.  
    9.  
    10. Dialogue System: Can't register Lua function CurrentQuestEntryState. A function with that name is already registered.
    11. UnityEngine.Debug:LogWarning(Object)
    12. PixelCrushers.DialogueSystem.Lua:RegisterFunction(String, Object, MethodInfo)
    13. PixelCrushers.DialogueSystem.QuestLog:RegisterQuestLogFunctions()
    14. PixelCrushers.DialogueSystem.DialogueSystemController:Start()
    15.  
    16. Dialogue System: Can't register Lua function SetQuestEntryState. A function with that name is already registered.
    17. UnityEngine.Debug:LogWarning(Object)
    18. PixelCrushers.DialogueSystem.Lua:RegisterFunction(String, Object, MethodInfo)
    19. PixelCrushers.DialogueSystem.QuestLog:RegisterQuestLogFunctions()
    20. PixelCrushers.DialogueSystem.DialogueSystemController:Start()
    21.  
    22.  
    I have tried PersistentDataManager.Reset() and PersistentDataManager.LevelWillBeUnloaded() but they don't seem to make any difference.

    Additionally I get these warnings every time, even the first time the scene is entered:

    Code (csharp):
    1.  
    2.  
    3. DontDestroyOnLoad only work for root GameObjects or components on root GameObjects.
    4. UnityEngine.Object:DontDestroyOnLoad(Object)
    5. PixelCrushers.DialogueSystem.DialogueSystemController:Awake()
    6.  
    7. Animator is not playing a Playable
    8. UnityEngine.Animator:ResetTrigger(String)
    9. PixelCrushers.DialogueSystem.UIShowHideController:ClearTrigger(String) (at Assets/Dialogue System/Scripts/Supplemental/UI/Tools/UIShowHideController.cs:74)
    10. PixelCrushers.DialogueSystem.UnityUIAlertControls:HidePanel() (at Assets/3rd Party/Dialogue System/Scripts/Supplemental/UI/Dialogue UI/UnityUIAlertControls.cs:88)
    11. PixelCrushers.DialogueSystem.UnityUIAlertControls:SetActive(Boolean) (at Assets/3rd Party/Dialogue System/Scripts/Supplemental/UI/Dialogue UI/UnityUIAlertControls.cs:70)
    12. PixelCrushers.DialogueSystem.AbstractUIControls:Hide()
    13. PixelCrushers.DialogueSystem.AbstractDialogueUI:Start()
    14.  
    Any advice would be helpful. Thanks!
     
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Hi @EpicIndustries - The "Can't register Lua function" warnings are harmless in and of themselves, but they might hint at another issue.

    By default, the Dialogue Manager is configured as a persistent singleton. That is, once it exists, it sticks around through scene changes, and it ensures that only one copy is present at a time. Your runtime Dialogue System data (e.g., the state of Dialogue System variables) is maintained by the Dialogue Manager. In most cases, you want the Dialogue Manager to be a persistent singleton to preserve your data when you change scenes.

    Under the hood, the Dialogue System runs Lua. When the Dialogue Manager starts up, it registers a few Lua functions (CurrentQuestState, etc.) with Lua. The warning just means that another Dialogue Manager has already registered the Lua function, which is fine.

    The Dialogue Manager (actually the DialogueSystemController script on it) uses Unity's DontDestroyOnLoad method to make it stick around through scene changes. Unity 5.3 changed DontDestroyOnLoad so it reports a requirement that GameObjects (such as the Dialogue Manager) must be root objects in the scene. They can't be children of another GameObject.

    So there are two things to check:
    • If the Dialogue Manager's Don't Destroy On Load checkbox is unticked, can you tick it? (If this doesn't work with your game design, let me know; I can suggest alternative setups.)
    • Is the Dialogue Manager a root GameObject?

    Note that you can still have Dialogue Managers in other scenes, too, for easier playtesting in the editor. A common setup is to have your primary Dialogue Manager in a start scene, and a test Dialogue Manager in each of your gameplay scenes. During normal play, the start scene's primary Dialogue Manager comes alive first and continues to persist through all scene changes. Since it's configured as a singleton, it will take precedence over the gameplay scene's test Dialogue Manager and destroy it automatically. But if you're working on a gameplay scene in the Unity editor and press Play, the gameplay scene's test Dialogue Manager will be there to take care of all Dialogue System functionality during your playtest.


    The "Animator is not playing on a Playable" message means you've specified to play "Show" and "Hide" animations on your alert panel, but your alert panel's Animator isn't capable of playing animations. Here are a couple of ways to fix it:
    • On your Unity UI Dialogue UI component, inspect Alert > Alert Panel > Animation Transitions and clear the Show and Hide fields. This way, the UI won't try to play animations.
    • Or assign an Animator Controller to your Alert Panel's Animator > Controller field. There are some sample Animator Controllers in Prefabs/Unity UI Prefabs/Animation.
     
    TeagansDad likes this.
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Last edited: May 13, 2016
    Alverik and TeagansDad like this.
  20. EpicIndustries

    EpicIndustries

    Joined:
    Sep 28, 2014
    Posts:
    32
    Thank you so much for your rapid and informative reply. Moving the Dialogue Manager to the root resolved most of my issues, and clearing the Animation Transitions solved the remaining one. Thanks again!
     
  21. EpicIndustries

    EpicIndustries

    Joined:
    Sep 28, 2014
    Posts:
    32
    I may have jumped the gun a bit. My custom dialogue UI is no longer showing up upon re-entering the scene. The dialogue manager now appears to revert to "Default Dialogue UI". I think this is because my custom Dialogue UI doesn't exist in the scene I move to before returning to this scene, and since the Dialogue Manager is now persistent between scenes, it loses that initial reference.

    To get around this I am reassigning Dialogue UI manually in code each time the scene enters. Is this correct practice?
     
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Can you make the dialogue UI a child of the Dialogue Manager? This way the Dialogue Manager will carry the UI around with it.
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    RelationsInspector supports Dialogue System for Unity!

    Seldom Tools' RelationsInspector 1.1.2 now has support for the Dialogue System, and it's currently 50% off!

    This great tool produces visual representations of all kinds of hierarchical data in your project. For the Dialogue System, it will show you:
    • What GameObjects in your scene are connected to Dialogue System conversations, barks, or quests. (Documentation)
    • Which conversations your cross-conversation links connect to. (And you can jump straight to the dialogue entry with a single click!) (Documentation)
    For example, this screenshot shows which GameObjects in the Quest Example scene are connected to conversations and quests:



    If you have complex dialogue, or any complex data in your project, RelationsInspector looks like a really useful tool. You can get it here:

     
    Last edited: May 16, 2016
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Grimsfield Now On Sale!

    escooler's Grimsfield, made with the Dialogue System for Unity, is now out! This game has a really unique style and a great concept:



    You can buy it here -- or if you act fast you can get a 10% discount today only by clicking this discount link.
     
    Alverik likes this.
  25. zephyo

    zephyo

    Joined:
    Mar 28, 2016
    Posts:
    33
    Hello, it's me again. I have another problem happening; I tried using RemoveItem lua script for S-Inventory but I get an error and nothing happens. What is wrong? (thank you for your patience once again)
     
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Hi @zephyo - Try this:

    Code (csharp):
    1. RemoveItem("Player4(Clone)", "purified water", 1)
    Unlike sequences, when using strings in Lua code, you need to put quotes around them.

    Also remember to add an S-Inventory Dialogue Actor component to your player if you haven't already. (Select your player and then menu item Component > Dialogue System > Third Party > S-Inventory > S-Inventory Dialogue Actor.)
     
  27. zephyo

    zephyo

    Joined:
    Mar 28, 2016
    Posts:
    33
    Hi TonyLi - thank you, the quotes worked!! Could you help me with a sequence that isn't working? It's - SetActive(Purified water(Clone), false)@6.5. I see it in my hiearchy but it's not getting disabled, and I followed the documentation to the T.
     
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    This is a known issue with sequences. The parser doesn't handle parameters containing parentheses such as "Purified water(Clone)". Coincidentally, I'm working on that right now. It's the last thing to do before I release version 1.6.3 tomorrow.

    In the meantime, can you rename your GameObject to "Purified water"?
     
  29. zephyo

    zephyo

    Joined:
    Mar 28, 2016
    Posts:
    33
    Hey, yeah! I went back a little in the thread and saw that so I scripted to change the name. It works now. Good luck!
     
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    RelationsInspector - Links Updated (and still currently 50% off)

    I added links to RelationsInspector's Dialogue System documentation to the RelationsInspector post above and also here:
    Links to the Asset Store:
     
    Alverik and Tinjaw like this.
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Adam Wells, the author of Grimsfield, posted a really great "Making Of" article:

    Making Grimsfield

    If you're interested in the creative process of making narrative games, it's worth your time to read.
     
  32. KWaldt

    KWaldt

    Joined:
    Nov 1, 2013
    Posts:
    127
    Hey there!

    I tried out the articy:draft converter today and ran into some troubles--it simply won't create conversations (neither from documents, nor from flow fragments). I'd think that it's an export problem, but if I change "FlowFragments are" to "Quests", it works. Do you happen to know how to solve this?

    Best Regards,
    Kristina Waldt
     
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Hi @KWaldt - Thanks for trying out the articy:draft converter! The converter creates conversations from articy Dialogues.

    If you set FlowFragments are to Conversation Groups, conversations will be titled with the FlowFragment name plus the Dialogue name. For example, if you have a FlowFragment named "Qeynos" containing a Dialogue named "GuardWarning", then the converter will create a conversation titled "Qeynos/GuardWarning". If your conversations aren't converting properly with this setting, make sure your FlowFragments actually have names and not blank strings.

    If you set FlowFragments are to Quests or Ignore, conversations will only have the Dialogue name, such as "GuardWarning".

    If that doesn't help, please feel free to send an example XML file to tony (at) pixelcrushers.com. I'll be happy to take a look!
     
  34. KWaldt

    KWaldt

    Joined:
    Nov 1, 2013
    Posts:
    127
    Thank you for the help--I looked over my project, and it was my mistake and is now solved. =)
    (I had them as Flow Fragment, but the Dialogue System wanted Dialogue Fragments.)

    I have another question--is it somehow possible to keep the connections between the different dialogues?
    I prefer to write in articy:draft since it's more comfortable, and I have a lot of text and connections as I'm working on a Visual Novel--so recreating every connection is a lot of work.
     
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Hi Kristina - The rules for Dialogues (conversations) are here. In brief:
    • Jumps: If you're using Dialogue System 1.5.8+, Jumps from one Dialogue to another Dialogue are imported.
    • Connections: Connections from one Dialogue to another Dialogue are not imported.
    If you already have a lot of Connections that cross Dialogues, let me know. I can implement this in an upcoming version. Other developers have been using Jumps, so this hasn't come up as a request yet.
     
  36. dl_studios

    dl_studios

    Joined:
    Oct 14, 2012
    Posts:
    76
    @TonyLi I just downloaded the latest version of Dialogue System and have run across a problem. The first nodes and connections I make work fine, but if I try to add nodes or edit the dialogue these changes are often not saved. If I however copy the whole conversation, the changes I made are present in the copy. I'm using Unity 64 5.3.4. Is there something I need to be doing to save changes?

    Thanks!
     
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Hi @dl_studios - You're doing nothing wrong. This is a bug that was introduced in version 1.6.2. I'm just now packing up version 1.6.3 (which contains the fix) to submit to the Asset Store and publish on the Pixel Crushers customer download site. If you'd like access to the Pixel Crushers customer download site to download version 1.6.3 today, please PM me your Asset Store invoice number.
     
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Dialogue System 1.6.3 Released!

    Version 1.6.3 is now available on the Pixel Crushers customer download site (PM me your Asset Store invoice number for access) and should be on the Asset Store soon. It fixes that serialization bug in the Dialogue Editor.
     
  39. KWaldt

    KWaldt

    Joined:
    Nov 1, 2013
    Posts:
    127
    Oh, wow, thank you--using Jumps is absolutely fine, I kinda forgot about that possibility!
    If I understand correctly, it will even port variable changes and conditions, right?

    Another question--the system allows to store which dialogue entry was already played (right?), so does this mean that there is a possibility to skip known dialogues? (For example by pressing shift.)
    I noticed that you support the Visual Novel Toolkit, which has this functionality--I wondered if it is natively included, or if I would need that Asset for it.
     
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Hi Kristina - Yes. They'll be ported into the Script and Conditions fields of dialogue entries.

    Yes, but it's a little hard to use this feature with articy:draft. When the Dialogue System converts an articy XML file into a dialogue database, it assigns a unique ID number to each dialogue entry (i.e., DialogueFragment in articy).

    The Dialogue System uses dialogue entry IDs to record which dialogue entries have already been displayed. (This technique comes from Chat Mapper, which is another product similar to articy:draft. Internally, the Dialogue System uses Chat Mapper's data format.)

    So, for example, you could have Conditions like this in the Dialogue System:

    Dialog[42].SimStatus == "WasDisplayed"

    When you're writing content in articy, the ID numbers haven't been assigned yet, so you can't write Conditions like above.

    However, you can configure the Dialogue Manager to handle some things automatically. On the Dialogue Manager's Input Settings, you can set the Em Tag For Old Responses to use an emphasis tag to show already-played responses in a different color such as grayed out.

    The Dialogue System doesn't have a specific integration package for Visual Novel Toolkit. However, the Dialogue System Extras page does have a separate, free example visual novel framework that doesn't use Visual Novel Toolkit. It's a basic starter framework, but you can use it to create most typical styles of visual novels without having to do any extra scripting.
     
  41. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    416
    Hi! I just wanted to check if it's possible to get integration with two other assets.

    https://www.assetstore.unity3d.com/en/#!/content/60055
    https://www.assetstore.unity3d.com/en/#!/content/39426

    The first is Ink, a free narrative scripting language which tries to emulate normal writing as close as possible (created by inkle, the guys from the game "80 days"). It can handle branching conversations and variables. It looks really awesome (specially for writers!) :D. It can also export JSONs... would that help? (sorry for the noob question, but I don't use any external editors, so I've never had to import anything...)

    The other is "Third Person Game Foundation Kit". This third person camera and controller aims to emulate the play styles of games like mario 64 or any legend of zelda game in 3D, which is awesome. It's still in development, the developer's working the battle mechanics and some other stuff, but what it can do already looks great! it's more like a whole game template, not just a controller :D. But, I feel it would stand to gain a lot from the Dialogue system! :cool: And, also, you know... who hasn't wanted to do a game in the style of The Legend of Zelda before?

    Anyway, sorry to bother you, hope you find my requests interesting! ;)
     
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Hi @Alverik! Ink integration is already on the roadmap to be added.

    I'll take a look at Third Person Game Foundation Kit. In the meantime, the Dialogue System provides general-purpose features such as Dialogue System Events and Set Component Enabled On Dialogue Event, as well as plenty of script messages, to tie into other assets for which the Dialogue System doesn't provide specific integration packages. Users have recently tied the Dialogue System into Corgi Engine and Platformer Pro using these features, and it was fairly easy to do.
     
    Alverik likes this.
  43. KWaldt

    KWaldt

    Joined:
    Nov 1, 2013
    Posts:
    127
    Hmmm... So if I understand this correctly, there is no way to globally enable skipping, but you'd add a condition to every entry. [And since imported a:d-entries get their IDs after converting, they would be overwritten every time I override my database.]
    Would it be possible to write an editor extension that generates these conditions automatically? All it would have to do is to is to set the condition of every entry to something like ((Variable["Skip"] == true) and Dialog[ID].SimStatus ~= "WasDisplayed"), and to set the false condition to "Passthrough". The variable "skip" would be manipulated by the shift key and another variable "isSkipable" that allows me to set unskipable parts (like menus, and I can set this variable in articy:draft)--aka "skip" is true while shift is pressed down, and isSkipable is true).
    I guess I'll look into it the following days--however, if I'm completely off track, or writing extensions for Dialogue System is not supported, just tell me.

    Also, thanks for the great support!
     
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    With a small bit of scripting, you can enable global skipping.

    1. Tick the Dialogue Manager's Include Sim Status checkbox. This tells the Dialogue System to use SimStatus to remember which lines have been displayed. It's off by default to save a little memory, since each dialogue entry uses about 36 bytes to remember SimStatus.

    2. Add a script to the Dialogue Manager GameObject that contains a method to check SimStatus, and register it with the Dialogue System's IsDialogueEntryValid delegate:
    Code (csharp):
    1. using UnityEngine;
    2. using PixelCrushers.DialogueSystem;
    3.  
    4. public class SkipDisplayedLines : MonoBehaviour {
    5.  
    6.     public bool IsDialogueEntryUndisplayed(DialogueEntry entry) {
    7.         // Return true if the dialogue entry has NOT been displayed yet:
    8.         return Lua.IsTrue("Dialog[" + entry.id + "].SimStatus ~= 'WasDisplayed'");
    9.     }
    10.  
    11.     public void Start() {
    12.         // Tell the Dialogue System to use the method above:
    13.         DialogueManager.IsDialogueEntryValid = IsDialogueEntryUndisplayed;
    14.     }
    15. }
    I just typed this into the reply so it might have a typo.


    You could also add a Boolean to your DialogueFragment template in articy that specifies whether it's skippable or not. Let's say you call it "Skippable". Then adjust your script to something like this:
    Code (csharp):
    1. using UnityEngine;
    2. using PixelCrushers.DialogueSystem;
    3.  
    4. public class SkipDisplayedLines : MonoBehaviour {
    5.  
    6.     public bool ShouldShowThisEntry(DialogueEntry entry) {
    7.         var wasDisplayed = Lua.IsTrue("Dialog[" + entry.id + "].SimStatus == 'WasDisplayed'");
    8.         var skippable = Field.LookupBool(entry.fields, "Skippable");
    9.         var shouldSkip = wasDisplayed && skippable;
    10.         return !shouldSkip;
    11.     }
    12.  
    13.     public void Start() {
    14.         DialogueManager.IsDialogueEntryValid = ShouldShowThisEntry;
    15.     }
    16. }
    You could also work the Shift key into the "ShouldShowThisEntry" method above. I omitted it to keep the code simpler.
     
    Last edited: May 18, 2016
  45. KWaldt

    KWaldt

    Joined:
    Nov 1, 2013
    Posts:
    127
    The code you wrote is spot on, no typos in sight. ;)
    And thank you, this is a great help!

    However, I have problems making it more responsive, aka making it possible to start skipping in the middle of a conversation.
    I tried something like this:
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using PixelCrushers.DialogueSystem;
    4.  
    5. public class Dialogue_Skip : MonoBehaviour
    6. {
    7.  
    8.     public bool IsDialogueEntryUndisplayed(DialogueEntry entry)
    9.     {
    10.         // Return true if the dialogue entry has NOT been displayed yet:
    11.  
    12.         var wasDisplayed = Lua.IsTrue("Dialog[" + entry.id + "].SimStatus == 'WasDisplayed'");
    13.         var skippable = Field.LookupBool(entry.fields, "isSkippable");
    14.         var shouldSkip = wasDisplayed && !skippable && Input.GetKey(KeyCode.LeftShift);
    15.  
    16.         return !shouldSkip;
    17.     }
    18.  
    19.     public void Start()
    20.     {
    21.         // Tell the Dialogue System to use the method above:
    22.         DialogueManager.IsDialogueEntryValid = IsDialogueEntryUndisplayed;
    23.     }
    24. }
    25.  
    I am testing this on a conversation with three entries, and if I change my variable "skipActive" (either in the Inspector or via key) once a conversation already started, it shows the first two, though the last one is skipped.
    How would I do it that once I press my skip button, it starts skipping immediately? (And by this I mean even skipping the current entry if it was already displayed previously.)

    EDIT: Just saw you expanded your post--I adjusted my code accordingly, thank you! However, the problem with the responsiveness still exists.
     
    Last edited: May 18, 2016
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Hi @KWaldt - Try this:
    Code (csharp):
    1. void Update()
    2. {
    3.     if (Input.GetKeyDown(KeyCode.LeftShift))
    4.     {
    5.         // When player presses Shift, set skipActive true:
    6.         skipActive = true;
    7.         if (DialogueManager.IsConversationActive)
    8.         {
    9.             //...and if already in conversation,
    10.             // update responses according to new skipActive value:
    11.             DialogueManager.UpdateResponses();
    12.             //...and skip to next stage:
    13.             DialogueManager.ConversationView.OnConversationContinue();
    14.         }
    15.     }
    16.     else if (Input.GetKeyUp(KeyCode.LeftShift))
    17.     {
    18.         // When player releases Shift, set skipActive false:
    19.         skipActive = false;
    20.     }
    21. }
     
  47. KWaldt

    KWaldt

    Joined:
    Nov 1, 2013
    Posts:
    127
    This seems to work, there are just two things:

    1. Small error at start
    If I press shift while reading a new piece of dialogue, it skips the next textbox.
    (So if I show dialogue 1 and press shift, I am suddenly in dialogue 3.)
    If I remove the line "DialogueManager.ConversationView.OnConversationContinue();", it skips to the next dialogue like planned.
    I noticed that if I start the game with a
    Code (CSharp):
    1. Debug.Log("Show? "+!shouldSkip+", ID: "+entry.id);
    it gives me two logs (the current entry, and the next one), so that might be the reason.
    Is it supposed to behave that way?

    2. Stopping skipping / making the text reappear
    Releasing the skip button does set skipActive to false, however, the text does not reappear.
    Right now, the flow gets broken if I try to skip, and even if an entry sets isSkippable to false, this entry doesn't reappear.

    I'm sorry--this seems to be really complicated.

    Best Regards,
    Kristina
     
  48. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    Hi @KWaldt - I think in the end the code will probably be simple. Usually what's complicated is getting me to understand what the goal is. :)

    I think the script below does what you described, or at least my current understanding of it. Here's an example package that contains the script and a test scene: Dialogue_Skip_2016-05-18.unitypackage. It's for Unity 5.3.4, and it imports into a folder named "Test".

    In the test scene, I also unticked the Dialogue Manager's Preload Resources checkbox. This checkbox invisibly loads the first conversation in the database, evaluates the first dialogue entry, and prepares to show it in the dialogue UI. Its purpose is to allow custom scripts that load resources (such as textures) to do all of the loading and processing at the start of the scene instead of when the first conversation starts. (If these scripts take a long time, it could cause a brief stutter, which wouldn't look good when starting a conversation.) In most cases, it doesn't really need to be checked. In your case, it's causing that first dialogue entry to be evaluated twice, as you reported.

    In the script, I also added a debug bool that you can tick in the inspector if you want to get information as it checks each dialogue entry.

    Code (csharp):
    1. using UnityEngine;
    2. using PixelCrushers.DialogueSystem;
    3.  
    4. public class Dialogue_Skip : MonoBehaviour
    5. {
    6.  
    7.     public bool debug;
    8.  
    9.     public bool IsDialogueEntryUndisplayed(DialogueEntry entry)
    10.     {
    11.         // Return true if the dialogue entry has NOT been displayed yet:
    12.         var wasDisplayed = Lua.IsTrue("Dialog[" + entry.id + "].SimStatus == 'WasDisplayed'");
    13.         var skippable = Field.LookupBool(entry.fields, "isSkippable");
    14.         var shouldSkip = wasDisplayed && skippable && Input.GetKey(KeyCode.LeftShift);
    15.         if (debug) Debug.Log("'" + entry.DialogueText + "': wasDisplayed=" + wasDisplayed +
    16.             ", shift=" + Input.GetKey(KeyCode.LeftShift) + ", shouldSkip=" + shouldSkip);
    17.         return !shouldSkip;
    18.     }
    19.  
    20.     public void Start()
    21.     {
    22.         // Tell the Dialogue System to use the method above:
    23.         DialogueManager.IsDialogueEntryValid = IsDialogueEntryUndisplayed;
    24.     }
    25.  
    26.     public void Update()
    27.     {
    28.         if (Input.GetKeyDown(KeyCode.LeftShift))
    29.         {
    30.             if (DialogueManager.IsConversationActive)
    31.             {
    32.                 DialogueManager.UpdateResponses();
    33.                 if (!IsDialogueEntryUndisplayed(DialogueManager.CurrentConversationState.subtitle.dialogueEntry))
    34.                 {
    35.                     DialogueManager.ConversationView.OnConversationContinue();
    36.                 }
    37.             }
    38.         }
    39.     }
    40. }
     
  49. KWaldt

    KWaldt

    Joined:
    Nov 1, 2013
    Posts:
    127
    Haha, that's true. I guess I should polish my communication skills a bit more.
    Hmm... It probably helps to think of it less like ignoring the already displayed messages, but rather auto playing them fast, and switching back to the typical mode (continue button, no auto play) once a new message appears, or the skip mode is cancelled.
    I made you a gif of how this typically looks like in Visual Novels, maybe that conveys the goal more clearly:
    https://drive.google.com/open?id=0B9__fAK_9Q-Xa2djZlFOaUFlNnM
    [In this case, I used the onscreen button, but I could have also pressed shift instead.]

    I'm not currently at home, but if I remember correctly, it still had the problem of skipping to the next stage if the message is new. I also think that the message didn't reappear if releasing shift.
    However, the double entries are solved, thanks for explaining this!
     
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,533
    No, the problem is usually my thick skull. :) And, in this case, also my inexperience with visual novels. I've played a few, but I never noticed the skip button. Please try this example, which behaves more like the gif you sent:

    Dialogue_Skip_2016-05-19.unitypackage

    The script changed to:
    Code (csharp):
    1. using UnityEngine;
    2. using PixelCrushers.DialogueSystem;
    3.  
    4. public class Dialogue_Skip : MonoBehaviour
    5. {
    6.  
    7.     [Tooltip("When skipping a line, show it for this long first.")]
    8.     public float skipDelay = 0.2f;
    9.  
    10.     [Tooltip("Tick to show debug info.")]
    11.     public bool debug;
    12.  
    13.     private bool skipNextLine = false;
    14.  
    15.     public void OnPrepareConversationLine(DialogueEntry entry)
    16.     {
    17.         if (entry.id == 0)
    18.         {
    19.             // Ignore the START node:
    20.             skipNextLine = false;
    21.         }
    22.         else
    23.         {
    24.             // OnPrepareConversationLine is called before the Dialogue System sets SimStatus.
    25.             // We need to record whether to skip the line before it sets SimStatus.
    26.             var wasDisplayed = Lua.IsTrue("Dialog[" + entry.id + "].SimStatus == 'WasDisplayed'");
    27.             var skippable = Field.LookupBool(entry.fields, "isSkippable");
    28.             skipNextLine = wasDisplayed && skippable && Input.GetKey(KeyCode.LeftShift);
    29.             if (debug) Debug.Log("OnPrepareConversationLine '" + entry.DialogueText + "' - wasDisplayed=" + wasDisplayed +
    30.                 ", shift=" + Input.GetKey(KeyCode.LeftShift) + ", skip=" + skipNextLine);
    31.         }
    32.     }
    33.  
    34.     public void OnConversationLine(Subtitle subtitle)
    35.     {
    36.         if (skipNextLine)
    37.         {
    38.             // Modify the sequence to fast-forward the typewriter to the end:
    39.             var ui = DialogueManager.DialogueUI as UnityUIDialogueUI;
    40.             if (ui != null)
    41.             {
    42.                 var lineName = (subtitle.speakerInfo.characterType == CharacterType.NPC)
    43.                     ? ui.dialogue.npcSubtitle.line.name
    44.                     : ui.dialogue.pcSubtitle.line.name;
    45.                 subtitle.sequence += "; SendMessage(Stop,," + lineName + ")";
    46.             }
    47.  
    48.             // Modify the sequence to continue to the next line after the skipDelay:
    49.             subtitle.sequence += "; SendMessage(OnContinue,,Dialogue Manager,broadcast)@" + skipDelay;
    50.         }
    51.     }
    52.  
    53.     public void Update()
    54.     {
    55.         if (Input.GetKeyDown(KeyCode.LeftShift))
    56.         {
    57.             if (DialogueManager.IsConversationActive)
    58.             {
    59.                 DialogueManager.UpdateResponses();
    60.                 DialogueManager.ConversationView.OnConversationContinue();
    61.             }
    62.         }
    63.     }
    64.  
    65. }
     
    KWaldt and Alverik like this.