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. 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. Aidiah

    Aidiah

    Joined:
    Nov 6, 2016
    Posts:
    2
    I knew it'd be something obvious.
    Thanks!
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Happy to help!
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Oops, typo. I just fixed it in my previous reply. I'll paste it here, too:
    Code (csharp):
    1. foreach (var item in DialogueManager.MasterDatabase.items) {
    2.     if (item.IsItem) Debug.Log("Item: " + item.Name);
    3. }
     
    hopeful likes this.
  4. Stonepunsh-Studio

    Stonepunsh-Studio

    Joined:
    Jan 7, 2018
    Posts:
    5
    I know that this question for sure got already asked about a hundred times but is it possible to integrate all your c# scripts? There is for sure a tutorial for this. Thanks
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Hi @Stonepunsh-Studio - What do you mean? Everything is accessible through C# scripts, or without scripting for those who don't want to touch scripts. Here are some useful links:
    If I didn't understand what you're asking for, please let me know.
     
  6. Stonepunsh-Studio

    Stonepunsh-Studio

    Joined:
    Jan 7, 2018
    Posts:
    5
    Thanks dude. I just want to know if i can do things like this:
    For example: I have a var called influence. If inlfuence is > 0 it calls dialog a and if influnce < 0 it calls dialog b.
    Or: If the player clicks on option a in a dialog a function in a c# script is called.
    Or: I want to access a dictonary to make a if statement for a dialog. Is this possible?
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Hi,

    Absolutely! Version 2.0 is being released today. I'll include links to the version 2.0 manual, but the steps are pretty much the same in version 1.x.

    I'll include a lot of info below. The short answer is yes, you can do it. And if you have a question about how to do a specific thing, just ask and I'll do my best to answer.

    Define a variable on the Variables tab. Then use the "..." button next to a dialogue entry node's Script field to set it and the Conditions field to check its value, as described here. Or, if you prefer a video:



    Again, this is for version 2.0, but apart from some new UI conveniences the process is the same in 1.x.

    Two ways: You can use the SendMessage() sequencer command (see Cutscene Sequences) to invoke a C# function, or register your C# function so you can use it in Script and Conditions fields (see this page).

    I'm not sure what you're asking, but I'll offer a few answers:

    You can use RandomElement in your Dialogue Text to choose from a list:
    • Dialogue Text: Hello, my [lua( RandomElement("friend | buddy | dude") )]!
    Or you can register a C# function as mentioned above.

    Or you can just write the 'if' statement directly into the Conditions fields of your dialogue entry nodes.
     
    TeagansDad, Akshara and hopeful like this.
  8. MoFaShi

    MoFaShi

    Joined:
    Oct 25, 2015
    Posts:
    42
    where can I download the version 2.0?
     
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Hi @MoFaShi - If you PM me your Asset Store invoice number, I'll reply with your access info to the Pixel Crushers customer download site.
     
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Dialogue System for Unity 2.0.0 Released!

    Version 2.0.0 is now available for immediate download from the Pixel Crushers customer download site and should be available on the Asset Store in 5-10 business days.

    Important Note: This is a major release. If you're upgrading a project from 1.x, you must follow the update steps in the manual (link) or video tutorial (link provided in manual page).

    Version 2.x Manual

    Video Tutorial Playlist

    There are more improvements than I can list here. Some highlights are:
    • New Standard UI system - easier to configure, more powerful, & includes graybox starter templates.
    • Editor improvements all over the place -- Dialogue Editor window, Dialogue System Trigger component, etc.
    • Dialogue Actor component provides easier configuration of characters' dialogue and bark UIs.
    Thank you very much to all of the beta testers who gave invaluable feedback on 2.0! And thank you to everyone who's supported the Dialogue System for Unity all these years. Version 2 has been a long time coming, but I think you'll find it worth the wait!
     
    MrG, Deckard_89, opsive and 2 others like this.
  11. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,625
    Congrats on your new baby! :)
     
    TonyLi likes this.
  12. janiche

    janiche

    Joined:
    Jan 4, 2015
    Posts:
    52
    I don't know if this problem is just for me, but when I import TextMeshPro, an error appear, I checked and it is because the TextMeshProSupport namespace is "unavailable" and cannot be found, I looked that class namespace and is all commented, every single line. Perhaps is a time human error or the version 2 Updater, but if I uncommented the TextMeshProSupport Namespace, everything works.

    Ah other thing, for some reason, my old script (updated for text table instead localized text table), even UI Localization Manager never update for the new selected language (i'm using UpdateUIs, and nothing). I dont know if I'm a little stupid and doing something wrong, or what
     
    Last edited: Jun 3, 2018
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Hi,
    There are two ways to use TextMesh Pro in Dialogue System 2.x:

    1. Use the Standard Dialogue UI. You can assign UI Text elements or TextMesh Pro UGUI elements to any text fields, such as the subtitle line. Most versions of Unity and TextMesh Pro automatically add the scripting define symbol TMP_PRESENT. The instructions to check and set this symbol are here. One of the beta versions of Unity 2018 didn't recognize this symbol. If the symbol is defined in your project but the Standard Dialogue UI still doesn't accept TextMesh Pro assignments, please let me know what version of Unity you're using.

    2. Or, use the older TextMesh Pro Support package that was originally in version 1.x. If you have any custom scripts that refer to the scripts in this package, you will have to add "using PixelCrushers.DialogueSystem.TextMeshProSupport;" to the top of the script file. It sounds like you may have already done something like this. In what file(s) did you have to uncomment the namespace?

    Sorry, it's a bit of a change, but the new text tables provide better import/export features, and this way you can use the same text tables for the Dialogue System, Love/Hate, and Quest Machine.

    Please look at the Localization Tutorial. There might be a step left to do. I haven't recorded a video version of this tutorial yet. If you find the missing step, please let me know what it is so I can make the documentation clearer. Thanks!
     
  14. janiche

    janiche

    Joined:
    Jan 4, 2015
    Posts:
    52
    I finally can get a solution, I saw that UpdateUIs method only Update the LocalizeUI class, and LocalizeUIText is never being updated, I had to make my own method to update that TMP element.
     
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Hi @janiche - Sorry, I overlooked TextMeshProUGUI in the LocalizeUI class. In the next update, LocalizeUI will update TextMeshProUGUI, too. I'll publish a patch with the fix in the next few days.
     
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Dialogue System for Unity 2.0.0 Available on Asset Store

    Version 2.0.0 is now available on the Asset Store.

    The Dialogue System Extras page has two updated support packages:
    • Corgi Support: ConversationZone now recognizes activation limit settings.
    • TextMesh Pro Support: Re-adds support for older typewriter effect script for existing projects that use the older TMP Support package instead of the standard UI's native TMP support.
     
    Akshara and fancyferret like this.
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Updated uMMORPG Support Package Available

    Make that three updated support packages.

    uMMORPG recently updated to v1.121 and changed a few things.

    The Dialogue System Extras page has an updated package that works with uMMORPG 1.121+. The setup instructions are the same except you need to add a UINpcDialogue_DialogueSystem component to the NpcDialogue UI panel and assign a UI button.
     
  18. ocimpean

    ocimpean

    Joined:
    Aug 10, 2013
    Posts:
    128
    Hello TonyLi
    Thank you for the update. I would like to ask you if the Visual Novel extension is compatible with version 2 and what version of Unity it requires?
     
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Hi @ocimpean - I've contacted the developer of the Visual Novel for Dialogue System for Unity add-on in case he needs to update his add-on.

    I'm working on the Dialogue System's free visual novel starter framework update for version 2.0. (The framework version 1.2 still works.) It should be available on the Extras page by next week. There are some enhancements I'd like to take advantage of in 2.0.
     
    Last edited: Jun 6, 2018
    ocimpean likes this.
  20. ocimpean

    ocimpean

    Joined:
    Aug 10, 2013
    Posts:
    128
    You are always doing a fantastic job TonyLi. Dialogue System's free visual novel starter framework update for version 2.0 is what interest me the most right now for my next project, I would like to stay internal/contain within one system/package. Not that I dismiss the other developer out of hand, but when more plugins are added, is getting more complicated to track what's going on if something is not working as it should, plus the learning process.
    What kind of changes and/or improvements do you want to add, if I may ask?
    I was wondering why you are not going all the way and make it a paid extension, with all the bells an whistles?
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Thanks! I was just planning to update it to use the new Standard Dialogue UI subsystem as described in this video:



    If I were to turn it into a paid extension, what other bells and whistles would people be interested in? It would include the usual interface features -- main menu, in-game menu, text skipping, auto-advancing, and typewriter speed, animated portraits, etc. as well as regular Dialogue System features -- localization, import from formats such as articy:draft and Chat Mapper, cutscene sequencer commands, etc. I'm only considering it at this point; no commitment yet.
     
    castana1962 and ocimpean like this.
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Dialogue System 2.0.0 Patch 20180607 Available

    Patch 20180607 is available on the Pixel Crushers customer download site with the fixes and improvements listed below. If you need access, please PM me your Asset Store invoice number.
    • Fixed: 1x to 2x Updater didn’t update ArticyLuaFunctions GUID.
    • Fixed: LuaInterpreter updated to properly handle OS language number formats in .NET4.6.
    • Fixed: Dialogue Editor’s Sort > Reorder IDs > All Conversations only updated current conversation; now does all.
    • Fixed: Dialogue panel no longer plays hide animation when alert appears before dialogue panel is used.
    • Fixed: Continue buttons on subtitle panels that exist outside the dialogue UI now work.
    • Improved: Articy importer now converts articy:expresso random() to Lua math.random().
    • Improved: Articy importer now Stage Directions As Sequences better if there is also a custom Sequence property.
    • Improved: DialogueActor - added option to only prepend and color actor name.
    • Improved: ActorSubtitleColor - added option to only prepend and color actor name.
    • Improved: InputDeviceManager - added option to not detect & switch to mouse control.
     
  23. ocimpean

    ocimpean

    Joined:
    Aug 10, 2013
    Posts:
    128
    Looks good, I like the animation integration! I wonder if is possible to use Puppet 2d or AnyPortrait to animate those sprites? The first thing that comes to mind is the ease of use. How hard is to get into and learn the system. Regarding other features, I would add NVL support, enabling/disabling the textbox, animated side portrait, Load/Save fully integrated, a basic layout menu that's ready to use out of the box. Regarding cutscenes: Panoply (https://www.assetstore.unity3d.com/en/#!/content/58506) is a very unique asset and a close integration would make for a standout product.
    Another thing is ease of entering a large amount of text (think in terms of +20,000 words for a story) for dialogues, and ease of editing and inserting lines into a conversation at a later time if the need arises for some editing and be able to keep track of choices.
    Regarding other capabilities, bells and whistles, I would download the latest RenPy (v7 at this time) and have a close look, run the tutorial game. Until now, RenPy was the standard software for VN creation, but with the ease of use of Unity and the assets available in the asset store, a lot of other, greater things are possible.
     
    Last edited: Jun 9, 2018
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    There have been a number of requests for Live2D support, which is similar and quite popular in the visual novel development community. However, Stranger Games' Visual Novel Addon for the Dialogue System already has Live2D support. I'm still evaluating whether to do a VN addon; I may just direct people to Stranger Games' addon since they've already put a lot of development into these features.

    Tracking choices is easy in the Dialogue System with variables. You can manage text entirely in the Dialogue System's Unity editor windows, or import from articy:draft, Chat Mapper, and other formats, and import/export to CSV for localization, so I think this aspect is covered pretty well.

    I agree. Ren'py is possibly still the best choice for straightforward visual novels, but Unity lets you stretch your game design. I've seen Dialogue System projects that combine visual novels with first-person shooters, and visual novels with platformers, etc.
     
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Dialogue System for Unity 2.0 Patch 20180614 Available

    Patch 20180614 is now available on the Pixel Crushers customer download site. If you need access, please PM me your Asset Store invoice number. These updates will also be in the upcoming version 2.0.1.

    Patch Notes:
    • Fixed: 1x to 2x Updater didn’t update ArticyLuaFunctions GUID.
    • Fixed: LuaInterpreter updated to properly handle OS language number formats in .NET4.6.
    • Fixed: Dialogue Editor’s Sort > Reorder IDs > All Conversations only updated current conversation; now updates all.
    • Fixed: Dialogue panel no longer plays hide animation when alert appears before dialogue panel is used.
    • Fixed: Continue buttons on subtitle panels that exist outside the dialogue UI now work.
    • Fixed: Bug with SetPortrait(speaker,pic=#) using speaker keyword.
    • Fixed: Now shows correct player portrait if using multiple player actors, starting conversation with a different player actor than in database conversation, and showing on panels start.
    • Improved: Articy importer now converts articy:expresso random() to Lua math.random().
    • Improved: Articy importer now Stage Directions As Sequences better if there is also a custom Sequence property.
    • Improved: DialogueActor added option to only prepend and color actor name.
    • Improved: ActorSubtitleColor added option to only prepend and color actor name.
    • Improved: InputDeviceManager added option to not detect & switch to mouse control.
    • Improved: Added several keyboard shortcuts to the node editor.
    • Improved: Added node editor options to turn confirm deletion on/off, trim whitespace when splitting pipes.
    • Third Party: Updated Corgi Support package.
    • Third Party: Updated uMMORPG Support package.
     
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Dialogue System for Unity 2.0.1 Released!

    Version 2.0.1 is available now on the Pixel Crushers customer download site (PM me your Asset Store invoice number for access) and should be available on the Asset Store in 5-10 business days.

    Highlights of this release include:
    • Dialogue Editor keyboard shortcuts and other usability improvements
    • Improvements to Standard Dialogue UI and Standard Bark UI
    • Sequencer commands now accept "tag=" keyword to specify GameObjects by tag
    • articy:draft import improvements (including support for markup text, courtesy of Racoon7)
    • Motion Controller support (courtesy of Chris Lasting)
    • Updated support for uMMORPG, Corgi Platformer Engine, and more

    Version 2.0.1 Release Notes

    Core

    • Fixed: 1x to 2x Updater didn’t update ArticyLuaFunctions GUID.
    • Fixed: LuaInterpreter updated to properly handle OS language number formats in .NET4.6.
    • Fixed: Dialogue Editor’s Sort > Reorder IDs > All Conversations only updated current conversation; now updates all.
    • Fixed: Standard UI Dialogue panel no longer plays hide animation when alert appears before dialogue panel is used.
    • Fixed: Continue buttons on subtitle panels that exist outside the dialogue UI now work.
    • Fixed: Bug with SetPortrait(speaker,pic=#) using speaker keyword.
    • Fixed: Now shows correct player portrait if using multiple player actors, starting conversation with a different player actor than in database conversation, and showing on panels start.
    • Fixed: Player response menu portrait images when changing player actors in cross-conversation links.
    • Fixed: LocalizeUI wasn’t applying to TextMeshProUGUI.
    • Improved: DialogueActor added option to only prepend and color actor name.
    • Improved: ActorSubtitleColor added option to only prepend and color actor name.
    • Improved: Added Only Show NPC Portraits checkbox to StandardUISubtitlePanel .
    • Improved: Standard Bark UI now supports portrait images.
    • Improved: InputDeviceManager added option to not detect & switch to mouse control.
    • Improved: Sequencer commands now support "tag=" keyword to specify subjects by tag.
    • Improved: Added several keyboard shortcuts to the node editor.
    • Improved: Added node editor options to turn confirm deletion on/off, trim whitespace when splitting pipes.
    • Improved: Added [panel=#] markup tag to specify subtitle panel for dialogue entry.
    Third Party Support
    • articy:draft:
      • Improved: Now converts articy markup to rich text codes (courtesy of Racoon7).
      • Improved: Handles Stage Directions As Sequences better if there is also a custom Sequence property.
      • Improved: Now converts articy:expresso random() to Lua math.random();
      • Fixed: Input & output pins on dialogues (vs. dialogue fragments) are now applied to conversation's input & output entries.
      • Fixed: Dialogue database inspector's Reconvert button reloads changes to articy XML before converting.
    • Corgi Platformer Engine: Added support for activation limits to ConversationZone; option to follow the actor/conversant when using Standard Dialogue UIs.
    • Inventory Engine: Lua functions now use item ID, not item name.
    • Motion Controller: Added support (courtesy of Chris Lasting).
    • PlayMaker: Added Set DialogueActor Subtitle Panel Number action.
    • Realistic FPS Prefab: Added FPSQuestLogWindowHotkey.
    • TextMesh Pro: Made the original typewriter effect available again.
    • UFPS: Moved "Add All Player Scripts" menu item from Component menu to Tools menu to prevent (harmless) warning message in Unity 2018.
    • uMMORPG: : Updated for uMMORPG 1.121Support package.
     
  27. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Version 2.0.1 is now available on the Asset Store!
     
    hopeful likes this.
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Mografi has generously shared the dialogue converter that they use for Jenny LeClue - Detectivu. You can download it from the Dialogue System Extras page, or right here: [JLCDialogueConverter_v02.zip]

    It imports and exports the compact text format shown below, and the package also includes a Google Docs script to auto-format exported text.

    #1 ExampleConversation
    Ben: Hi Joe! {Camera(Wide, Scene, 1);}
    Joe: Hi Ben.
    Ben: What’s your favourite colour? {Camera(Close, Joe, 1);}

    [RED]
    Joe: I like red.
    Ben: Bold choice!
    Ben: Red suggests vitality!
    [RED]
    [GREY]
    Joe: I’ve always been partial to grey.
    Ben: Grey?! Is that even a colour?
    Joe: What can I say, I’m a grey kind of guy…
    [GREY]
    Ben: Well I can’t stand around chatting all day.
    Ben: See you later!

    [PARIS]
    Joe: Actually. I wanted to ask you about your trip to Paris. |Variable["VisitedParis"] == true|
    Ben: Oh it was great. Thanks for asking.
    Joe: Great. See you later then.
    [PARIS]
    [GOODBYE]
    Joe: Ok, bye. |Variable["VisitedParis"] == false|
    [GOODBYE]

    The imported conversation looks like this:



    And while you're at it, check out Jenny LeClue on Unity Connect!
     
    Dreamaster, Akshara and flashframe like this.
  29. lusho_games

    lusho_games

    Joined:
    Jun 4, 2011
    Posts:
    62
    Hi, just got this tool and I'm having fun learning how to use it.

    I want to have a system similar to FF9, where a question mark appears on top of the character when something is interactive.
    ff9.PNG
    How would you achieve this? is an Alert, a Bark?

    I thought about using the "Usable" component to display a custom message but I don't know how to edit the position and style of it.

    For the dialogues, I'm interested in this type of conversations:
    final-fantasy-ix-3.jpg

    Here's an example of the game I'm working on:
    urban88_dialogues.gif

    Thanks for your help!
     
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Hi @3uhox! Thanks for using the Dialogue System!

    There are a few ways. The script-free way in the Dialogue System is to use quest indicators:



    To play with an example, examine the NPC Sergeant Graves in DemoScene2.

    Or you can make a subclass of Usable that manages the question mark. Make it visible in OnEnable and invisible in OnDisable. When the character is interactive, enable its Usable. (BTW, if the question mark is a 2D sprite or world space canvas, you can add an Always Face Camera component to make sure it's always facing the camera.)

    Normally Usables only show an interaction indicator (e.g., question mark) when they're selected -- for example, in the demo scene when you look at an NPC, or on mouse over if that's how you've configured the selector, or when nearby if you're using a proximity selector. If you only want to show the question mark when the NPC is selected, add a Standard Usable UI to it. This probably isn't what you want to do, so I'll skip the details unless you ask for them.

    It looks like you're using world space subtitle panels already. If not, you can try this to start with:
    1. Add a Dialogue Actor component to your NPC.
    2. Set Dialogue UI Settings > Subtitle Panel Number to Custom.
    3. Assign Plugins / Pixel Crushers / Dialogue System / Prefabs / Standard UI Prefabs / Templates / Bubble / Bubble Template Standard UI Subtitle Panel to Dialogue UI Settings > Custom Subtitle Panel.
    This will show subtitles in an overhead cartoon bubble. (Response menus will still use the regular dialogue UI unless you also configure Dialogue UI Settings > Menu Panel.) By default, the bubble will always be over the speaker's head. Different games may want to reposition it differently, so that's left to you. If you have questions about how to reposition it, let me know.
     
  31. dl290485

    dl290485

    Joined:
    Feb 4, 2018
    Posts:
    160
    I'm interested in this as a time saver rather than making my own system in Playmaker. However I am wondering about how easily it would mix in with other parts of the game. For example; I'm considering a game which would include a lot of probability so it wouldn't really play the same way twice, which would include aspects like a NPC offering a quest on one play but not on another. Probably also so the same NPC can randomise between quest 1, quest 2, or no quest at all.

    If I were building it all bottom up with Playmaker, it would take more effort and harder to manage dialogue, but it would be one and the same as the actual quest itself so there would be no question of them mixing together. For this dialogue system, would it be a major effort to have dialogue only appear when conditions created with Playmaker are met?

    Another example would be to have dialogue associated with available quests or trading or etc, but have that all change as a result of your action elsewhere. Like you piss off the quest givers faction so from then on they are like 'go away'.

    Can dialogue depend on global variables set in Playmaker or something easy like that?
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Hi! There are several easy ways to do this, so you can choose your preference. For example, you can set the Dialogue System Trigger's Condition section to check one or more Playmaker global variables using GetFsmBool(), GetFsmInt(), etc. Or, going the other way, your Playmaker FSM can set one or more Dialogue System variables that you can check in conversations, or you can start conversations from FSMs, using the Dialogue System's library of Playmaker actions. The Dialogue System's Playmaker Support page has details.
     
    dl290485 likes this.
  33. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    Hi @TonyLi I'm starting to use your Dialogue System for my new projects, I have a question, I cannot find any examples or tutorials of looping Conversations, I managed to make something work, but the problem is that the node editor doesn't look very pretty, also if I choose to re arrange nodes vertically/horizontally the nodes order gets screwed up (visually speaking), here is an example of what I'm doing

    example.jpg


    So my problem is that, although this is working fine, the node editor starts to look ugly because the returning links facing backwards are occluded by other visual stuff, also when you auto arrange things the order gets screwed up.

    to solve the first problem I suggest to do something like amplify shader editor does, where you can shape the connections the way you like, pinning points anywhere (see the white dots that control the connection splines):




    the second issue I don't know how to fix it, since I guess the auto arrangement is not smart enough to realize the developer intends when doing some kind of loops in conversations right? any suggestions?
     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Hi @Cleverlie - Thanks for using the Dialogue System! The node editor is designed to work like the Mecanim Animator editor, so it has many of the same features and drawbacks. I'll consider your spline suggestion. Thank you; it's a good idea. I have some ideas to improve auto-arrangement, but it will never be perfect for every situation every author may have different intentions. I think your spline idea will be a better way to address the issue.

    In the meantime, here are some tips that might help:

    If you click on a node, it will show outgoing links in yellow and incoming links in brown:



    The image above also shows a "group" node. To make a group node, tick its Group checkbox. It will still process its Conditions and Script fields, but it will pass through to its links. You may want to tick the Group checkbox on your dummy node.
     
  35. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    what I did is: the dummy node has a Sequence:None() to override the default delayed sequence, so I think currently behaves exactly as the group node? what is the advantage or extra functionality that gives using a node marked as group instead of a normal node with nothing on it and with Sequence:None()? I may be missing some important thing here? well if it is just to avoid manually putting a None() lua sequence then it is worth it :).


    suggestion for the rearrangement breaking things problem: you can add another option that makes a sort of smart rearrangement where all the nodes get sticked to a grid, and the distances between them get normalized, I'm not sure if at the end that will make sense, maybe there is some edge case that im missing, but sounds like that can be an option, kind of what Windows does when you are in the desktop and you do right-click->View-> Organize Icons Automatically.
     
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    They are almost identical. The only difference is that the group node evaluates its condition, runs its script, and then immediately moves to the next node(s) and evaluates their conditions, etc. If those are also group nodes, it can keep evaluating down the tree until it hits a non-group node, all in one step.

    On the other hand, if you have a node with Sequence:None(), it processes that node as a single step. Once it's done, it moves on to the next step. You might need to use None() nodes instead of groups sometimes, as described in Conversations Evaluate Conditions On Extra Level Ahead. But, apart from that, they're basically the same.

    I'll play with that. I don't think it will address the problem that nodes and link arrow may overlap, but it will certainly make the canvas look cleaner. BTW, there are align to grid options in the node editor's menu. But it doesn't automatically realign all nodes at the same time.
     
    Cleverlie likes this.
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Gamasutra just posted a throwback link to their 2014 interview with Khris Brown:

    Khris Brown on the secrets of great voice acting

    If you're considering voice acting for your project, it's just as relevant now as it was in 2014. She has great advice on whether to include voice acting or not, how to find the best actors (and the best actors for your budget), running a table read to iterate on the script, how to get the best performances out of your actors, and more.

    The Dialogue System supports several lipsync solutions, as well as entrytags to simplify management of lots of audio files, and can export voiceover scripts for your voice actors and voice director.
     
    AGregori likes this.
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Updated Support for i2 Localization, Inventory Pro, & uMMORPG

    The Dialogue System Extras page has updated support packages for version 2.0.1:
    • i2 Localization: Updates support for i2 Localization v2.8.7, adds localization of Text Tables.
    • Inventory Pro: Updates support for Inventory Pro 2.5.10, adds Lua functions to get & set stats.
    • uMMORPG: Now saves player data to the server as soon as any Dialogue System quest state changes or conversation ends instead of waiting for the regular heartbeat save.
     
  39. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    hi @TonyLi, thanks for your responses! I have another question here, I have a generic intro conversation in the database which I use to meet with any NPC, and it is basically

    "Hi, Player, how can I help you?" where the player can answer with: "nevermind"/"I have a question about your job"/"I've noticed that you are doing something wrong"

    what I would like to do is to dynamically link the nodes "I have a question for you" and "I noticed that you..." to other conversations, depending on game state and the npc which the player is talking to, is this possible? how can I, for example, leave the links of these two nodes empty, and add the link I want to the conversation I want (including a subnode of that conversation) dynamically in runtime, via script?

    this way I will always have the same intro conversation, and then the specific unique conversation that derives from game state and current conversant. thanks!


    EDIT: I figured it out.

    Code (CSharp):
    1. [ConversationPopup]
    2.     public string conver;
    3.  
    4.     [ConversationPopup]
    5.     public string deviationSubConver;
    6.  
    7.     public Transform actor;
    8.     public Transform conversant;
    9.  
    10.     void OnEnable()
    11.     {
    12.         Conversation origin = DialogueManager.masterDatabase.GetConversation(conver);
    13.  
    14.         Conversation deviation = DialogueManager.masterDatabase.GetConversation(deviationSubConver);
    15.  
    16.         DialogueEntry toDeviationEntry = origin.GetDialogueEntry("DeviationQuest");
    17.  
    18.         List<Link> links = new List<Link>();
    19.  
    20.         Link l = new Link(origin.id, toDeviationEntry.id, deviation.id, 1);
    21.         links.Add(l);
    22.  
    23.         toDeviationEntry.outgoingLinks = links;
    24.  
    25.         DialogueManager.StartConversation(conver, actor, conversant);
    26.        
    27.     }


    NOTE: this will change your conversation asset at runtime, meaning that it changes the serialized asset, even after you stop the editor player, changes to the conversation asset can't be reverted.
     
    Last edited: Jul 2, 2018
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    The cleanest way to do this is to set up the links at design time. This way you don't need to change the database at runtime. Instead, you can just set game state variables and let your design time links make the decisions. The Dialogue System provides a lot of features to support this.

    Here's an example intro conversation:



    I'll explain each part.

    In the upper right, there's a group node titled <DANGER>. The link to this node has its Priority set to AboveNormal. If the variable "Danger" is true, then the conversation will always follow this branch instead of the <Normal> branch. If there's danger, it makes sense to talk about danger instead of normal small talk.

    You could link the <DANGER> node to different danger conversations. There's no need to put the danger nodes in the intro conversation like I did in the example.

    If the "Danger" variable is false, then the conversation will follow the <Normal> branch. This branch has a <Juicy Gossip> group node checks the "Gossip" variable to see if there's any gossip going on in the world.

    Otherwise it chooses the <Job> group node. This node links to two conversations: Baker and Doctor.

    Each of those conversations has a condition, which is shown in the lower right of the screenshot above. This is a complex condition. I'll break it down into pieces:
    • We assume that the player is the conversation's Actor, and the NPC is the conversation's Conversant.

    • Each NPC should have a corresponding actor definition in the dialogue database's Actors section, which is available at runtime in the Actor[] Lua table. For example, say Biscuit Bob is a baker. At runtime, his actor data will be in Actor["Biscuit_Bob"]. The string "Biscuit_Bob" is Bob's index in the Actor[] table.

    • The Dialogue System automatically sets the variable Variable["ConversantIndex"] to the conversant's index in the Actor[] table. If the intro conversation is started with Bob as the conversant, then Variable["ConversantIndex"] will be "Biscuit_Bob".

    • This means Actor[Variable["ConversantIndex"]] is equivalent to Actor["Biscuit_Bob"].

    • Now let's assume that each actor has a custom field named "Profession":

      Bob's profession is Actor["Biscuit_Bob"].Profession. The current conversant's profession is Actor[Variable["ConversantIndex"]].Profession.

    • So this means the condition Actor[Variable["ConversantIndex"]].Profession == "Baker" checks if the current conversant is a baker. If so, it goes to the Baker conversation.

    To recap the example conversation:
    • We check two game state variables, "Danger" and "Gossip", and use special branches if they're true.

    • Otherwise we check the conversant's profession and go to the corresponding conversation.
    You could of course check other variables, too. For example, if the player's gender is female and orientation is heterosexual, and the conversant's gender is male and appearance is hunky, the conversation could follow a branch where she makes passes at him.
     
    Last edited: Jul 2, 2018
    Akshara and Cleverlie like this.
  41. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    thanks man, that was a perfectly useful answer! I edited the original question because I found a way to achieve dynamic modifications of the conversation to get similar results, but I might end up using your method because it seems to be the safer and cleaner way around it, thanks again for the fast support!
     
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Glad to help! Sorry I got a little carried away with my reply and forgot to specifically address the "I have a question for you" and "I noticed that you..." branches, but they'd work similarly.

    BTW, if you tick the Dialogue Manager's Instantiate Database checkbox, you can change DialogueManager.masterDatabase as much as you want and runtime changes won't affect your original asset. But I still recommend design-time links instead. Also, changes to Dialogue System variables and actor fields are included in saved games, making it easy to change an NPC's profession mid-game, for example, and have it persist across scene changes and when loading saved games.
     
    Cleverlie likes this.
  43. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    @TonyLi I'm having a problem with your method. well is actually a convenience method I made:

    instead of putting the condition Actor[Variable["ConversantIndex"]].Profession == "Baker"

    I registered a function to lua like this:

    Code (CSharp):
    1. void OnEnable()
    2.     {
    3.         Lua.RegisterFunction("CheckJob", this, SymbolExtensions.GetMethodInfo(() => CheckJob(string.Empty)));
    4.         DialogueManager.StartConversation(conver, actor, conversant);
    5.     }
    6.  
    7. public bool CheckJob(string job)
    8.     {
    9.         string query = "Actor[Variable[\"ConversantIndex\"]].Job == \"" + job + "\"";
    10.         Debug.Log("-------------");
    11.         Debug.Log(Lua.Run("Variable[\"ConversantIndex\"]", true).AsString);
    12.         Debug.Log(query);
    13.         Debug.Log(Lua.IsTrue(query));
    14.         Debug.Log("-------------");
    15.  
    16.         return Lua.IsTrue(query);
    17.     }
    the problem I'm facing now is that it seems that
    Lua.Run("Variable[\"ConversantIndex\"]", true).AsString
    returns empty always. Does this mean that I cannot access this dynamically assigned variable within a Lua C# registered function? I'm I doing something wrong?

    is there any list of all environment dynamic variables I can access at any point in time such as this "Conversant Index"?



    this way in the conditions for a conversation I can just put:
    CheckJob("Engineer")

    instead of forcing the dialogue designer guy to understand more complex coding
     
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Hi @Cleverlie - That code actually works fine for me. It's possible that OnEnable is getting called before the Dialogue System has started. I moved the DialogueManager.StartConversation() line to a Start() method in the attached example scene.

    The list of environment variables is here: Special Variables. Note that Actor, Conversant, ActorIndex, and ConversantIndex are only valid during conversations.

    There are two tools that may be helpful when debugging things like this:

    First, you can add a Lua Console to your scene (typically on the Dialogue Manager). Press ~+L to open it. You can enter commands such as return Variable to show the values of all variables, or return CheckJob("Engineer") to check if the current conversant is an engineer.

    Second, at runtime the Dialogue Editor's Template tab turns into a Watches tab where you can add watches on variables, quest states, and arbitrary Lua expressions check as CheckJob("Engineer").
     

    Attached Files:

    Cleverlie likes this.
  45. janiche

    janiche

    Joined:
    Jan 4, 2015
    Posts:
    52
    Hi, I'm using dialogue system making a tutorial, but I don't know how can I set a script variable after a dialogueEntry, I mean I have a Gameobject with a script (it controls where mask is placed) and I want to set the position anter entry complete, it's necessary lua, a event?
     
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Hi @janiche! You don't have to use Lua, but it's available if you want to use it. To use Lua, register a C# method with Lua. Then use that C# method in the dialogue entry's Script field. The Templates subfolder has a starter script if you want to do this.

    Another alternative is to use the dialogue entry's OnExecute() UnityEvent, but this has two restrictions: (1) since the database doesn't exist in the scene, its UnityEvents can't point to scene objects, and (2) you can't import or export UnityEvents to third party formats such as CSV text files.

    In your case, I recommend a simpler solution. Use the SendMessage() sequencer command. This command calls a method on a script. For example, let's say you have a GameObject named "MaskObject" and a position GameObject named "PositionA".

    In a script on MaskObject, add a method like this:

    Code (csharp):
    1. public void SetMaskPosition(string positionObjectName)
    2. {
    3.     GameObject newPosition = GameObject.Find(positionObjectName);
    4.     // (newPosition is the new position where the mask is placed.)
    5. }
    In the dialogue entry, set the Sequence field to:

    Code (sequence):
    1. {{default}};
    2. SendMessage(SetMaskPosition, PositionA, MaskObject)
    The first line of the Sequence just runs the Dialogue Manager's default sequence (e.g., wait for a duration, or play audio, or whatever it's set to.) The second line calls SetMaskPosition("PositionA") on the scripts on the GameObject named MaskObject.
     
  47. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    Hi TonyLi, based on what you suggested I put a couple of watches andI think I may found a bug.

    See I start a conversation via
    DialogueManager.StartConversation(conver, actor, conversant);


    where
    actor
    and
    conversant
    are two gameobjects, the conversant has a DialogueActor component, so I can assign the Welder actor I created in the database, to this gameobject.
    cvcbcb.jpg

    the actor Welder has a DisplayName defined as "Alfredo" and a Job defined as "Welder" as you see below:
    aaaaa.jpg
    but see, while the conversation is happening, the watchers are telling me this:
    cucuc.jpg

    See how the "Conversant" is in fact shown as Alfredo, but the ConversantIndex is not "Welder" (the index name of Alfredo) but it is instead "NPC".

    Now, see the conversation is configured to have these Actor and Conversant by default:
    eeerererer.jpg


    Conclusion: I have a strong feeling that the DialogueActor or the Dialogue System or whoever is in charge of assigning the runtime replacement actors to the conversations, is forgetting to set the ConversantIndex to the index of the Welder, and instead it is using the index of the default Conversant of the conversation. I think this is not the expected behaviour and it is a bug, otherwise can you guide me to what I'm doing wrong or how to fix it?
     
  48. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Hi @Cleverlie - You're right; I'll send you a patch soon.
     
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    @Cleverlie - I just PM'ed you your access info to the customer download site where you can download the patch.

    If anyone else needs the patch, please PM me your Asset Store invoice number. The patch contains:

    2.0.1 Patch 20180704 Release Notes:
    • Fixed: CSV import of Text Tables wasn’t marking asset dirty, so changes weren’t always immediately saved.
    • Fixed: Articy importer now properly applies nested flow fragment names to flow dialogues.
    • Fixed: ConversantIndex now points to correct actor when using DialogueActor component with GameObject name that doesn’t match conversation actor or DialogueActor.
    • i2 Localization Support: Updated for i2 Localization 2.8.7, added support for Text Tables.
    • Inventory Pro Support: Updated example scene for DS2. Added Get/SetStats Lua functions.
    • uMMORPG Support: Saves character to server immediately at end of conversation or quest state change. Added Lua functions to get and set skill levels.
     
    hopeful and Cleverlie like this.
  50. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    amazing! thanks!