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,697
    Dialogue System for Unity v1.5.0 Patch 2015-05-04 Available

    This patch adds one feature to the articy:draft Converter. If you don’t use articy:draft, or if you don’t need this feature, then you don’t need to import this patch.
    • articy:draft Converter: Added conversion of enum and slot properties; an optional ConversationEntity property can be used to specify the conversant for a dialogue fragment.
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Dialogue System v1.5.0 is now available on the Asset Store!
     
  3. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    So... are there any issues that stem from importing a 4.x version of Dialogue System into Unity 5? Because I'm on 5 and I recently reimported the evaluation version to give it another shot since making my own dialogue system turns out to take several months and work 10% as well as this. However, when importing everything, all the stuff looks like this:



    And following the guides in the documentation to get things to work with the new GUI just give me blank screens coming up when I press play.

    edit: It turns out the problem was in the settings I was using on my other project for github. Fixing those got everything working again, whoops!
     
    Last edited: May 6, 2015
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Murgilod - Glad it's working now! BTW, I have a bug report open with Unity. Unity 5 is 64-bit, and serialization now uses a different integer format. Its YAML parser currently can't import some values in scenes and prefabs that were originally built and serialized in Unity 4 if you import in Force Text or Force Binary serialization mode. Set your project's serialization mode to Mixed before importing the Dialogue System. You can set it to Force Text or Force Binary after import if you want.

    tl;dr: Set your project to Mixed serialization (not Force Text or Force Binary) before importing. After importing, you can change it to whatever you want.
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Updated Adventure Creator Support Package

    An updated Adventure Creator support package (tested on AC 1.44 and 1.45) is available here or on the Pixel Crushers customer download site. It adds two new actions:
    • ThirdParty: Dialogue System Alert (shows gameplay alerts using the Dialogue System's dialogue UI)
    • ThirdParty: Dialogue System Sequencer Message (sends a message to the sequencer)
     
  6. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    So.

    This is embarrassing. Mostly because I'm asking for help with an asset I won't be able to buy until the 25th due to payment issues but also because my problem is incredibly simple.

    I've got everything working for my complicated useNET looking dialogue system just fine, but I also have some more simple implementations that I just can't figure out. I'm trying to create an incredibly simple visual novel style conversation system.



    All of the dialogue will be in the lower box and require the player to click in there to advance. When the player comes to a choice of dialogues, I want them to be presented like this:



    With the previous dialogue right at the bottom there. Looking at the docs, this should be simple and require no coding at all on my part but I just can't figure it out, even stepping through the 4.6+ GUI tutorial.
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Murgilod - It's probably just a matter of hooking up the UI elements to your UnityUIDialogueUI component. This is sometimes easier said than done, so this post is going to be a bit long.

    First you need a GameObject (a child of a Canvas) that has a UnityUIDialogueUI component. The rest of the dialogue UI elements will be children of this GameObject.

    Let's assume the bottom box is a Panel with a Text element to contain the text. Assign the Panel to Npc Subtitle > Panel and Response Menu > Subtitle Reminder > Panel. Assign the Text to Npc Subtitle > Line and Response Menu > Subtitle Reminder > Line.

    "Npc Subtitle" is shown when the NPC (your washroom sign) is speaking its dialogue text. "Subtitle Reminder" is shown when the response menu is up.

    If you want to add a typewriter effect, duplicate this box. Assign one of the duplicates to "Npc Subtitle" and the other to "Subtitle Reminder". Add a UnityUITypewriterEffect to the Npc Subtitle's Text element.

    Now for the continue button. Add a button that covers the entire box. Set its Image component's alpha to 0 so it's invisible, or disable it. Add an OnClick() handler. Assign your UnityUIDialogueUI component, and select the OnContinue method. Finally, inspect the Dialogue Manager and set Display Settings > Subtitle Settings > Continue Button to Always.

    Let's assume the top box (the response menu) is a Panel with a number of Buttons. Assign the Panel to Response Menu > Panel. Add a UnityUIResponseButton component to each Button, and assign the Button and Label fields. Then assign the Buttons to Response Menu > Buttons. When showing a response menu, the Dialogue System will hide any buttons that it doesn't need to use.

    You'll probably want to group both of these Panels under a main Panel, which the Dialogue System refers to as the Dialogue Panel. Assign this panel to Dialogue > Panel.

    If the washroom sign image serves as the NPC's portrait image, assign it to Npc Subtitle > Portrait Image and Response Menu > Subtitle Reminder > Portrait Image. This way the Dialogue System will know to assign the current NPC's image to it.

    More detailed instructions are on the manual page, which has info that the video tutorial had to gloss over to stay at a reasonable length.

    Dialogue UIs are very flexible. You may want to use a response button template instead of manually adding all the buttons at design time. You can play PC subtitles. You can change the behavior of the continue button so the first click fast forwards to the end of the line and the second click actually continues. These options and more are described on that manual page.

    If I can provide more details or help out with a specific problem, please post here or feel free to email an example project to tony (at) pixelcrushers.com. I'll be happy to take a look.
     
  8. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    Okay! That helped a lot and everything is working fine now, including a couple extra things like gamepad support and whatnot. I was wondering though, is there a native way to step back through a conversation? Like if a player accidentally clicks past a section of text and wants to go back. Or am I better off just logging what they've already gone past?

    Thanks for all the help with this, by the way. It's a major part of why I've been recommending everyone I can this asset.
     
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Thanks, @Murgilod! To review text, you may find it easiest to log what they've already gone past. See Scripts/Supplemental/Utility/ConversationLogger.cs for an example. The Dialogue System's script messages make it pretty easy.

    If you want to actually rewind the conversation, there are a couple ways. One might be better for you than the other depending on your use case. One way is to restart the conversation from a specific dialogue entry ID. The DialogueManager.StartConversation() method lets you specify the ID to jump to. The other way is to jump to a different dialogue entry without leaving the conversation. It's more complicated and involves working directly with DialogueManager.ConversationController and DialogueManager.ConversationModel. If you need to do this, let me know and I'll describe the process.
     
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Updated Unity UI Support package available

    A Dialogue System user pointed out that the Unity UI dialogue UI didn't respect the "[a]" tag used to denote "action" responses by putting them in italics. You can download an updated package here or on the Pixel Crushers customer download site that contains the fix.
     
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Dialogue System Extras Page - Free Downloads

    The Dialogue System "Extras" have been moved from the access-controlled Pixel Crushers customer download site to a new, free-access Dialogue System Extras page. You can download files such as:
    • Updated third-party support packages before they're available in regular releases
    • Choose-Your-Own-Adventure (CYOA) framework
    • Additional dialogue UI classes
    • Example projects for Oculus VR, 2D platformers, and more
     
    Licarell and BackwoodsGaming like this.
  12. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    Since I don't have any looping dialogue entries, I just ended up using a list to store the passed entries in a list. It's not terribly elegant, but it gets the jorb done. However, I have yet another question. Thankfully, this one is much more simple.



    Let's say I want to have the player able to save mid-conversation. Could I just use the DialogueManager.StartConversation() method to load their position in the conversation?
     
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Murgilod - yes. This feature was added at the request of another developer who wanted to do exactly this.
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Script/Quest Integration Tutorial

    Here's a short tutorial on connecting the Dialogue System to your own scripts:


    Tutorial Assets
     
  15. Demonith88

    Demonith88

    Joined:
    Jun 30, 2014
    Posts:
    216
    Hi this asset is awesome !!! i working on a little and i use zeranos rpg kit 3 so i try to get work on wow like alerts when

    Code (CSharp):
    1. Dialogue System: Bark (speaker=Shop 1 (UnityEngine.Transform), listener=Third Person Character (UnityEngine.Transform)): 'Best sells here' speaker has no bark UI
    2. UnityEngine.Debug:LogWarning(Object, Object)
    3. PixelCrushers.DialogueSystem.<Bark>c__Iterator5:MoveNext()
    4. UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    5. PixelCrushers.DialogueSystem.DialogueSystemController:Bark(String, Transform, Transform, BarkHistory)
    6. PixelCrushers.DialogueSystem.DialogueManager:Bark(String, Transform, Transform, BarkHistory)
    7. PixelCrushers.DialogueSystem.BarkStarter:TryBark(Transform)
    8. PixelCrushers.DialogueSystem.<BarkLoop>c__Iterator10:MoveNext()
    9.  
    Code (CSharp):
    1. Dialogue System: Conversation 'Best sells here' not found in database.
    2. UnityEngine.Debug:LogWarning(Object)
    3. PixelCrushers.DialogueSystem.ConversationModel:.ctor(DialogueDatabase, String, Transform, Transform, Boolean, IsDialogueEntryValidDelegate, Int32)
    4. PixelCrushers.DialogueSystem.<Bark>c__Iterator5:MoveNext()
    5. UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    6. PixelCrushers.DialogueSystem.DialogueSystemController:Bark(String, Transform, Transform, BarkHistory)
    7. PixelCrushers.DialogueSystem.DialogueManager:Bark(String, Transform, Transform, BarkHistory)
    8. PixelCrushers.DialogueSystem.BarkStarter:TryBark(Transform)
    9. PixelCrushers.DialogueSystem.<BarkLoop>c__Iterator10:MoveNext()
    10.  
    Code (CSharp):
    1. Dialogue System: Bark (speaker=Shop 1 (UnityEngine.Transform), listener=Third Person Character (UnityEngine.Transform)): 'Best sells here' has no START entry
    2. UnityEngine.Debug:LogWarning(Object, Object)
    3. PixelCrushers.DialogueSystem.<Bark>c__Iterator5:MoveNext()
    4. UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    5. PixelCrushers.DialogueSystem.DialogueSystemController:Bark(String, Transform, Transform, BarkHistory)
    6. PixelCrushers.DialogueSystem.DialogueManager:Bark(String, Transform, Transform, BarkHistory)
    7. PixelCrushers.DialogueSystem.BarkStarter:TryBark(Transform)
    8. PixelCrushers.DialogueSystem.<BarkLoop>c__Iterator10:MoveNext()
    9.  
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. PixelCrushers.DialogueSystem.BarkController+<Bark>c__Iterator5.MoveNext ()
    3. UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    4. PixelCrushers.DialogueSystem.DialogueSystemController:Bark(String, Transform, Transform, BarkHistory)
    5. PixelCrushers.DialogueSystem.DialogueManager:Bark(String, Transform, Transform, BarkHistory)
    6. PixelCrushers.DialogueSystem.BarkStarter:TryBark(Transform)
    7. PixelCrushers.DialogueSystem.<BarkLoop>c__Iterator10:MoveNext()
     
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Demonith88 - You will be interested in the How to Play Barks section of the manual and maybe the associated bark tutorial video. The video is for advanced barks. I recommend reading the manual first, since the video will be confusing unless you already know how to play barks.

    In brief, here are the steps:
    1. In your dialogue database, create a conversation. The line(s) that the NPC barks (yells) should all be linked from the START node.
    2. Add a Bark On Idle component to your NPC. Select your conversation from the drop-down menu. This component makes the NPC bark automatically on a timed interval.
    3. Add a Unity Bark UI component to your NPC. This shows the bark onscreen.
    Unity Bark UI uses the legacy Unity GUI. Later, you can swap it out with a different GUI system if you want, such as Unity UI Bark UI to use the new Unity UI. But that's a litle more complicated. I recommend getting the bark working in the simplest way first.
     
    Demonith88 likes this.
  17. Demonith88

    Demonith88

    Joined:
    Jun 30, 2014
    Posts:
    216
    Tnx will try it and see where it goes
     
  18. Demonith88

    Demonith88

    Joined:
    Jun 30, 2014
    Posts:
    216
    I have little problem i done everything what says in documents so everything works but its stuck on conversation 2 its not going on to the next one


    And gui its not showing like bubble like WoW u know like in side gui image bubble chat what ever they call it its nto showing but i have add the GUI prefab

     
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Demonith88 -

    When an NPC barks, it shows a single line of dialogue. To see barks in action, play the Feature Demo. Sergeant Graves demonstrates barks. Or examine the NPC named "Barker" in the RPG Kit example.

    When an NPC starts a conversation, it follows an entire conversation tree that usually involves more than one line of dialogue. To see a conversation in action, talk to Private Hart in the Feature Demo. Or examine the NPC named "Converser" in the RPG Kit example.

    I'll assume that you want to do barks, like Sergeant Graves.

    In either case, always leave the orange "START" node untouched.

    When creating a bark conversation, leave the "START" node untouched, and link the bark nodes to it. Here is Sergeant Graves' bark conversation:



    Barks are not interactive. The NPC says a line, and that's it.

    If you want to run a back-and-forth exchange with the player, you need to set up a conversation. If this is what you want to do, let me know, and I'll explain the steps.
     
    Demonith88 likes this.
  20. Demonith88

    Demonith88

    Joined:
    Jun 30, 2014
    Posts:
    216
    Tnx for fast replay i think that last so when the character barks or yells in my opinion so this silver nods are randomly yelling or do i need tot interact with npc to do random yelling ?

    This is what i want i will try to explaine :)

    So my NPS is outside and i wont her to yell or bark randomly conversation but with that npc i can make a IN Use conversation like for guide or talk so that will be a Bark and Conversation in one
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Demonith88 - The silver nodes can be random or sequential (one after the other). Set the behavior using the Bark Order dropdown:



    Yes. Add these components to your NPC:
    • Bark On Idle: Barks on a regular timed interval
    • Unity Bark UI: Shows the bark text
    • Conversation Trigger: Starts a conversation (see here)*
    • Usable: Makes the NPC usable to start a conversation*
    • Some kind of collider: Allows selection using raycast*
    * You do NOT need these last 3 in RPG Kit. Instead, use an ICode state machine (see here) to start the conversation.
     
  22. Demonith88

    Demonith88

    Joined:
    Jun 30, 2014
    Posts:
    216
    Woow tnx man tnx again i will try this tomorrow its getting night here and its time for a brake anyway before i go i see that when my NPC bark the gui shows up but i can see that text from the end of the terrain :/ can be there some visible to show half away from NPC or something anyway tnx :)
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi - Yes. It depends on what GUI system you're using. If you want to stick with legacy Unity GUI for now, add a Unity Bark UI On GUI component. Set the Offset to position the label where you want. If you want it to word wrap, set Max Width.

    Also, on Unity Bark UI, you can tick or untick Check If Player Visible. This does a raycast to the player. If there's something in the way, such as a wall, it will temporarily hide the bark.
     
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    The Dialogue System Extras page has two updated support packages: Unity UI Support and TextMesh Pro Support that contain these additions:
    • Adds support for the “[a]” markup tag in responses.
    • Resets the scrollbar when updating the response menu if you’re using response button templates.
    • Adds an OnContentChanged event to the response menu.
    • Adds Unity UI Scrollbar Enabler (which you can hook into the OnContentChanged event) to automatically show or hide the scrollbar as needed.
     
  25. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    I'm having a hard time parsing the documentation about this... How are quest states accessed/set from code? Are they enum values or stored as ints or what?
     
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Murgilod - The easiest way to work with quests in code is the QuestLog static class. It uses an enum QuestState:
    Code (csharp):
    1. // Activate a quest:
    2. if (QuestLog.GetQuestState("My Quest") == QuestState.Unassigned) {
    3.     QuestLog.SetQuestState("My Quest", QuestState.Active);
    4. }
    Under the hood, the Dialogue System uses Lua to track runtime quest states. The Lua table Quest[] contains subtables, one per quest. Each subtable contains an index "State" -- for example: Quest["My_Quest"].State. Lua doesn't do enums, so State is a string:
    Code (Lua):
    1. Quest["My_Quest"].State = "active"
    One other peculiarity: The Dialogue System uses the data model defined in Urban Brain's Chat Mapper. Chat Mapper replaces space characters with underscores in indices. If you end up digging into Lua this deep, you'll want to read the sections Important Note About Table Indices and Lua Examples (which includes a short table of syntax differences between Lua and C#).
     
    Last edited: May 20, 2015
  27. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    Thanks! That actually clears up a whole bunch. I assume the same applies toward custom variables?
     
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Absolutely. The QuestLog class doesn't provide anything extra for custom variables, so in C#/UnityScript you'll need to use the somewhat lower-level DialogueLua class. For example, say you've defined a custom field named "XP Reward":
    Code (csharp):
    1. // Get the quest's XP reward:
    2. var xpReward = DialogueLua.GetQuestField("My Quest", "XP Reward").AsInt;
    Or in Lua:
    Code (Lua):
    1. Variable["Alert"] = Quest["My_Quest"].XP_Reward .. " XP gained!"
     
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Urban Brain Studios just released Chat Mapper 1.9 with a host of new features:
    • New Feature: HTML5 online publishing
    • New Feature: HTML5 support for Actor pictures and audio files
    • New Feature: HTML5 responsive web design templates
    • New Feature: Online Lua to JavaScript conversion
    • New Feature: Multi-language ResponsiveVoice Text to Speech integration
    • New Feature: Local HTML preview
    The Dialogue System can import and export Chat Mapper format. Many developers have written their dialogue in Chat Mapper and brought it to life in Unity using the Dialogue System. Before 1st June, you can use the discount code MAY15ATD to get Chat Mapper for 10% off!
     
  30. Dreamaster

    Dreamaster

    Joined:
    Aug 4, 2014
    Posts:
    148
    I've been learning to use this recently, and you do show an example for 2 NPC's "barking at each other" but it seems a bit complicated. I think this is a feature request, but would it be possible someday to make it to where NPC's have a barking conversation with each other simply by building a conversation tree with each other just like you do with the player? That would make coding cut scene style dialog a bit easier? Or perhaps make it easier to code say, 3-4 NPC's talking to each other and then they all look to the player near the end for an interactive response?
     
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Dreamaster - You're probably looking for a variation of Bark Dialogue UI, which plays a regular conversation through the actors' bark UIs instead of the dialogue UI's text elements. Bark Dialogue UI doesn't allow a response menu, but this version does through Unity UI. It's also available on the Dialogue System Extras page.
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    The Pixel Crushers forum (http://www.pixelcrushers.com/forums/) will be down for a few days while we switch from bbPress to phpBB. In the meantime, please continue to post here or PM or email me directly at tony (at) pixelcrushers.com!
     
  33. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    thanks for the heads up!
     
  34. Elzbach

    Elzbach

    Joined:
    Dec 5, 2014
    Posts:
    29
    I've been playing around with this asset and watching tutorials for a few days now, and is there a way to add sound like voiced audio along with the dialogue as is appears?
     
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Elzbach - Absolutely! If you only want to play audio (not lipsync), use the AudioWait() sequencer command. For example, say you've recorded an audio clip named hello_world and put it in a Resources folder. Then your dialogue entry can be:
    • Dialogue Text: "Hello, world!"
    • Sequence: AudioWait(hello_world)
    You can read more about sequences here.

    If you want to do full lipsync, you have many options. They're covered in the How to Add Lipsync section and also the Voice() sequencer command.
     
  36. Elzbach

    Elzbach

    Joined:
    Dec 5, 2014
    Posts:
    29
    Wonderful! Thank you!
     
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Dialogue System for Unity 1.5.1 Released!

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

    Highlights:
    • Improvements to Unity UI dialogue UIs.
    • Improvements to Adventure Creator support.
    • Updated support package for the new Realistic FPS Prefab 1.22.


    Version 1.5.1

    Core
    • Added: Bark order option First Valid, which stops searching for entries after finding the first valid entry.
    • Added: Lua.UnregisterFunction.
    • Improved: Dialogue Editor now keeps current conversation selected when entering playmode.
    • Improved: Exposed ConversationController.GotoState() method.
    • Improved: Sorting by quest title is now optional in QuestLog.GetAllQuests().
    • Changed: ConversationTrigger, BarkTrigger & SequenceTrigger set to OnTriggerEnter tests condition against object that entered trigger, not actor or conversant.
    • Changed: If sending OnConversationStart/OnConversationEnd to the DialogueManager, now passes the DialogueManager transform if there are no participants.
    • Unity UI:
      • Added option to show scrollbar in dialogue and quest UIs only when needed.
      • Added response menu scrollbar reset value.
      • Fixed animation handling when sending OnContinue while playing Show/Hide animations.
      • Fixed [a] markup tag in dialogue UI.
    Third Party Support
    • Adventure Creator: Added Alert action; added syncing of float and popup variables; improved syncing of runtime variables.
    • articy:draft: Added conversion of enums and slots; added ConversationEntity property.
    • Aurora NWN converter: Added conversion of actors' Tag field.
    • ORK Framework: Unregisters Lua functions when bridge is disabled.
    • Realistic FPS Prefab: Updated for RFPS 1.22.
    • S-Inventory: Updated S-Inventory/RFPS bridge scripts for RFPS 1.22.
    • TextMesh Pro: Fixed [a] markup tag in dialogue UI; added response menu scrollbar reset value.
     
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Version 1.5.1 is now on the Asset Store!
     
  39. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Dialogue System 1.5.1 Patch 2015-06-01 Available

    A patch is available on the Pixel Crushers customer download site. (PM me your Asset Store invoice number if you need access.) It includes:
    • Changed: Camera() sequencer command now uses Lerp instead of Slerp to move.
    • Improved: Unity GUI and Unity UI QuestTrackers now have options to show description instead of name and to show completed entry text.
    • Unity UI: Added Wheel2 dialogue UI prefab; added UnityUIColorText component to change button text color when hovered.
    • articy:draft: Properties and features on dialogues are now converted.
     
  40. RealAspireGames

    RealAspireGames

    Joined:
    Dec 24, 2013
    Posts:
    265
    Hey @TonyLi

    Quick question! I want an NPC to play an animation and walk towards and waypoint when a quest is complete! Is there a way that Lua scripting can help me achieve this with dialog system?

    Thanks!
     
  41. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @godofwarfare115 - Even easier; just use a sequence. That's the short answer.

    The long answer is that the actual sequence depends on what you want to do. For example, say you end a quest by talking to an NPC. The NPC uses legacy animation. You want the NPC to walk to a TransporterPad and beam away. On the NPC's dialogue entry, use a sequence like this:

    LookAt(TransporterPad);
    Animation(Walk);
    MoveTo(TransporterPad,3);
    Animation(Idle)@3;
    SetActive(BeamupParticleEffect)@3;
    MoveTo(Surface of Planet)@4

    This sequence makes the speaker (the NPC) face the transporter pad and walk to it. At the 3-second mark, the NPC idles, and a particle effect starts. At the 4-second mark, the NPC moves immediately to the GameObject "Surface of Planet".

    Sequences are text to make them quick to write while you're writing dialogue. If you prefer to use an interactive visual editor to design sequences, you can use uSequencer, Cinema Director, Animator Timeline Editor, etc., and start them with a single sequencer command (e.g., uSeq(My uSequencer Sequence)). You can even mix and match within the same sequence.

    If the quest ends outside of a conversation, you can use a Sequence Trigger component or manually call DialogueManager.PlaySequence().

    If you need to do something that the built-in sequencer commands don't do, such as set up and run a NavMeshAgent, you can write a custom sequencer command. The Dialogue System includes a very simple template that you just fill in with your own code.

    Or you can register a C# method with Lua and call it wherever you want. Since this is a C# method, you can do anything you want it to do in code.
     
  42. NioFox

    NioFox

    Joined:
    Dec 28, 2012
    Posts:
    65
    Can I reference Variables with the SetPortrait() sequencer command?

    I'm trying to setup a generic trader dialog tree, swapping the name and portrait appropriately.
    The actor name override works great, but I need something similar for portrait.
    So what I did was add a generic Trader actor and gave it multiple portraits which I'd like to select based on a variable I setup called TraderPicID.

    SetPortrait works fine if I use a hard number, like so: SetPortrat(Trader, pic=2)
    But I'm not sure how to substitute the variable.
     
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @NioFox - The SetPortrait() sequencer command doesn't currently do this, but it's a great idea. I'll give some thought to the best way to provide this functionality, probably just allowing "pic=x" to refer to a variable if it's not a number (e.g., pic=TraderPicID).

    In the meantime, you can set the actor's portrait texture manually. Add an OnConversationStart() method to your trader:
    Code (csharp):
    1. using UnityEngine;
    2. using PixelCrushers.DialogueSystem;
    3.  
    4. public class OverrideActorPortrait : MonoBehaviour {
    5.  
    6.     public string actorName;
    7.     public Texture2D portrait;
    8.  
    9.     void OnConversationStart(Transform actor) {
    10.         DialogueManager.Instance.SetActorPortraitTexture(actorName, portrait);
    11.     }
    12. }
     
    NioFox likes this.
  44. NioFox

    NioFox

    Joined:
    Dec 28, 2012
    Posts:
    65
    This looks like it'll work great for now.
    Later I would like to make use of the [pic=#] tags to change expressions though. I think that's a pretty nice feature and I'll definitely be using it for non-generic characters!
     
  45. NioFox

    NioFox

    Joined:
    Dec 28, 2012
    Posts:
    65
    At the outset I was actually looking for some kind of "SubstituteActor()" functionality. Something to allow me to change out the default named actor in the database's conversation for another named actor. I figured this would eliminate the need for separate overrides. Kind of an ActorOverride I guess?
     
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    This feature is already written and tested, and it'll be in the next release (v1.5.2). You'll be able to use [pic=#] or [pic=varName] tags inside dialogue text, and SetPortrait(actor,pic=#) or SetPortrait(actor,pic=varName) in sequences.

    This is a little more difficult. The Dialogue System uses Chat Mapper's data model. I selected this data model because professionals have been using Chat Mapper for years, and it's battle-proven. But it does assume that the actor IDs assigned to each dialogue entry are set at design time and don't change at runtime. I'll have to give it some thought to come up with a graceful way of substituting actors. Off the top of my head, I may just expand the Override Actor Name component to allow it to optionally reference a different portrait.
     
    NioFox likes this.
  47. NioFox

    NioFox

    Joined:
    Dec 28, 2012
    Posts:
    65
    Thanks for the consideration, and great system so far by the way.
    Your response time to queries like this is also pretty amazing!
    Keep up the good work :)
     
  48. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Happy to help!

    Unfortunately for response times, I'm going to be out of town Saturday and Sunday. If you post here or email tony (at) pixelcrushers.com, I'll reply first thing Monday morning!
     
  49. Elzbach

    Elzbach

    Joined:
    Dec 5, 2014
    Posts:
    29
    I'm having an issue with multiple NPCs and barks. Everything is set up correctly except for when I use the wizard to identify the NPCs, so the barks actually run when activated. In the wizard I set up an NPC with the correct dialogue database and it works when it is activated, however if I go to another NPC that I set up with the wizard earlier, the bark does not run and I get "! NullReferenceException: Object reference not set to an instance of an object". So it seems you can't have multiple NPCs set up by the NPC wizard? How do I have working dialogues with multiple NPCs in a single scene?
     
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Elzbach - Could you please send an example project to tony (at) pixelcrushers.com so I can recreate the problem? Please feel free to record and send a video or written steps if you prefer. I've found a potential issue, but I want to make sure it addresses the problem you've reported. I'll PM you FTP instructions in case the project is too big for email.

    In the meantime, can you inspect the NPCs and select their conversations from the Bark Trigger drop-down menu? Does this get the NPCs working?