Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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,670
    Sorry about that. In this version, the ShowSubtitle() method resets the typewriter effect. The typewriter effect starts when the object is enabled. Since we weren't hiding it, it was getting disabled and re-enabled. Now ShowSubtitle() manually hides it and immediately shows it again to trigger OnEnable.
     
    CarterG81 likes this.
  2. hrvat

    hrvat

    Joined:
    Mar 12, 2013
    Posts:
    42
    Hey there!

    We haven't encountered problems with both the dialogue system and the headset working at the same time.

    Thanks again
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Great to hear! Thank you for letting me know!
     
  4. Alarconte

    Alarconte

    Joined:
    Jan 8, 2014
    Posts:
    32
    There is a way to call Override Dialogue UI from Playmaker? My "cutscenes" are made with a Dialogue UI different than the normal, and are executed via Playmaker, If there isn't, will be easy to script the custom action? (I can't check the code right now, don't have a dialogue system seat in the office)
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi Alarconte, you don't need Playmaker for this. Just add an Override Dialogue UI component to the conversant. If you only want to use it on the conversant in certain situations, add it to a child object and set that object active when you want to use it.
     
  6. wx3labs

    wx3labs

    Joined:
    Apr 5, 2014
    Posts:
    77
    The documentation on using with NGUI says:

    1. Create a GameObject with an NGUI Dialogue UI component by selecting the menu item Window > Dialogue System > Components > UI > NGUI > Dialogue UI.
    I don't see NGUI listed under UI and there doesn't seem to be a component with that name if I try to add it manually.
     
  7. wx3labs

    wx3labs

    Joined:
    Apr 5, 2014
    Posts:
    77
    Nevermind, I see that I had to extract it from the appropriate third party support package.
     
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Sounds like you have it working now! If you run into any issues, please post here, PM me, or email me at tony (at) pixelcrushers.com.
     
  9. wx3labs

    wx3labs

    Joined:
    Apr 5, 2014
    Posts:
    77
    Thanks, a question and maybe a bug(?):

    1. I want to keep the NPC text on screen until the player makes a selection. I have both "Show NPCSubtitles during line" and "Show NPCSubtitles With Responses" checked. But the text disappears as soon as the player response options are shown. How do I keep the NPC text visible?

    2. In the NGUIResponseButton component, SetColor changes both the nguiLabel.color and nguiButton.defaultColor to the currentColor. This makes the button's label and background the same color after hovering over it.
     
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi wx3labs, I just PM'ed you access information to the download site where you can download an NGUI support patch that should address your concerns.

    The default behavior, as you've noted, is similar to games like Mass Effect in that only one set of subtitles is visible at a time. When you import the patch, look in the NGUI support Examples folder. You'll find a subfolder named Dual Subtitle Example. It contains a new subclass of NGUIDialogueUI called DualSubtitleNGUIDialogueUI. Just drag this onto your NGUDialogueUI component to replace it. Your existing NGUIDialogueUI settings will remain intact. The subfolder also includes an example scene.

    The patch also adds two checkboxes to NGUIResponseButton: setButtonColor and setLabelColor. You can untick the one that you don't want to change. The SetColor() method is also now virtual so you can override its behavior in a subclass if you want.
     
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Several people have contacted me about RPG Kit 2.1 support. I'm working on it and hope to have a patch available within 2 days.
     
  12. treshold

    treshold

    Joined:
    Nov 9, 2013
    Posts:
    225
    Heh I was gonna post same thing about 2.1 support. Sounds great that it is already in the way. RPG kit 2.1 has integrated Zeranos mecanim AI, will those actions be available same time or maybe later?

    thanks for amazin product :)
     
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi treshold, thanks! The first step will be an immediate patch to make the support package work with RPG Kit 2.1 by replacing references to the old AI scripts. A more comprehensive package, with additional support for AI for Mecanim actions, will be in the next full release.
     
  14. hike1

    hike1

    Joined:
    Sep 6, 2009
    Posts:
    401
    Getting this with plygame 2.18

    Assets/Dialogue System/Third Party Support/plyGame/Scripts/Events/EventHandler_DialogueSystem.cs(124,36): error CS1061: Type `plyBloxKit.plyBlox' does not contain a definition for `SetTempVarValue' and no extension method `SetTempVarValue' of type `plyBloxKit.plyBlox' could be found (are you missing a using directive or an assembly reference?)
     
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi Terry, I'm working on this support package, too. I'll post updated support packages for plyGame and RPG Kit as soon as possible.
     
  16. wx3labs

    wx3labs

    Joined:
    Apr 5, 2014
    Posts:
    77
    Does the search function of the documentation need to be re-indexed? I find that a lot of things I search for come up empty, even if it definitely is documented. E.g, "RandomElement" has no matches, but it's in the documentation.

    Might save some simple support questions.
     
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi wx3labs, that's a good idea! A quirk of the documentation tool (Doxygen) is that it only indexes source code. (In this case C# code.) RandomElement is a Lua function that's only documented in the user manual part and not the source code part. I'll set up a custom search engine to allow users to search the user manual, too.
     
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Updated support packages for UFPS (now including a UFPS Mobile-Addon example) and plyGame v2.1.8 are available on the Pixel Crushers customer download page. If you need access please PM me your invoice number.

    An updated support package for RPG Kit 2.1 is in the works.
     
  19. Ash-Blue

    Ash-Blue

    Joined:
    Aug 18, 2013
    Posts:
    102
    On the sci-fi demo (1st on the website) password entry appears to be broken. On a Mac if that makes any difference. Runs fine on the actual demo files though.

    Can you provide a more detailed explanation in the docs on how to use "IsDialogueEntryValid Delegate." I need to check some complicated external decision data from an API for conversations, but having trouble figuring out exactly how to implement this. As the example is a bit vague for me.
     
    Last edited: Jul 19, 2014
  20. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi Ash Blue, thanks for letting me know about the Mac webplayer issue. It's a Return key/Enter key issue. I'll fix it and update the website.

    Here's a real world example of 'IsDialogueEntryValid". It's in a subclass of UnityDialogueUI, but you could put it anywhere. This class just happened to be a good place for this developer.
    • The Start() method registers the delegate IsSpeakerNearby().
    • Whenever the Dialogue System considers using a dialogue entry, it calls this delegate. If it returns true, the entry is kept in consideration. If it returns false, the entry is rejected.
    • In this example, IsSpeakerNearby() examines the entry's Actor ID. If the actor isn't close enough to the player, it returns false. The functions to check distance aren't shown in this example.
    Code (csharp):
    1. public class MyDialogueUI : UnityDialogueUI {
    2.  
    3.     // In Start, set up the extra line-checking delegate (to make sure actors are nearby):
    4.     public override void Start () {
    5.         base.Start();
    6.         DialogueManager.IsDialogueEntryValid = IsSpeakerNearby;
    7.     }
    8.  
    9.     // This is an additional check on dialogue entries. If the actor isn't nearby, the entry is rejected:
    10.     public bool IsSpeakerNearby(DialogueEntry entry) {
    11.         if (entry == null) return false;
    12.      
    13.         // Always return true for the conversation's primary Actor and Conversant:
    14.         if (IsAPrimaryConversationActor(entry)) return true;
    15.      
    16.         // Now that we have the isActorNearby[] value, check it:
    17.         if (IsActorNearby(entry.ActorID)) {
    18.             return true;
    19.         } else {
    20.             if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: IsSpeakerNearby: actor {1} (ID {2}) is NOT nearby", DialogueDebug.Prefix, GetActorTag(entry.ActorID), entry.ActorID));
    21.             return false;
    22.         }
    23.     }
    24.  
    25. }
    Here's the definition of DialogueEntry.
     
  21. Ash-Blue

    Ash-Blue

    Joined:
    Aug 18, 2013
    Posts:
    102
    You sir are amazing! The rumors are true about how great Pixel Crushers is (5 star review coming your way).
     
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    On the advice of my lawyers, I deny everything. :) Anyway, glad I could help.
     
  23. Ash-Blue

    Ash-Blue

    Joined:
    Aug 18, 2013
    Posts:
    102
    One more quick question, continuing the conversation from a while back on advancing the dialogue tree, is it possible to call DialogueManager.Instance.SendMessage("OnConversationContinue"), but have it FastForward the typewriter effect on the first click if its still going, then on the second fully continue? Would be nice if I could send a variable on the end to optionally target the typewriter such as DialogueManager.Instance.SendMessage("OnConversationContinue", true)
     
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi, if you have a reference to the ContinueButtonFastForward script, you can just call OnFastForward():
    Code (csharp):
    1. myContinueButtonFastForward.OnFastForward();
    If you don't have a reference, use:
    Code (csharp):
    1. (DialogueManager.DialogueUI as MonoBehaviour).SendMessage("OnFastForward");
    This will fast forward the typewriter effect if it's still going, or continue if it's done. You can't send along a variable, but you could always save a value in some script or in the Lua environment.
     
  25. Gaviathan2

    Gaviathan2

    Joined:
    May 23, 2013
    Posts:
    13
    As someone has already mentioned,a more general search option on the documentation would be much appreciated.I've made a basic conversation with a cube.I'm not quite ready to start putting the quests together yet but I would like to set up a main menu with NGUI that also covers other menu options not included in the examples.Cosmetically I can do this with NGUI but I haven't got a clue how to go about making it a "Dialogue system" compatible menu as everytime I search the docs for something it comes up with results that don't even come close to what I'm looking for.I'm a terrible scripter and rely heavily on things like playmaker and NGUI so a search that only recognises code among all the info you have on that page is no good for people like me.I'm sure the system is super awesome but at the moment it's way out of my reach.
     
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi Gaviathan*, you don't need to do any scripting, even with PlayMaker, to set up a dialogue UI. I will certainly make it a priority to add a general search option. In the meantime, I suggest these topics:
    And load up some of the example scenes in Dialogue System/Third Party Support/NGUI Support/Examples and pick apart their UIs to see how they work. If you have any specific questions, you can always post here, PM me, or email me at tony (at) pixelcrushers.com any time.
     
  27. Gaviathan2

    Gaviathan2

    Joined:
    May 23, 2013
    Posts:
    13
    Ok,kool,I'll try that out when I wake up,tis 6:29 am not slept yet LOL Thanks for the suggestions :)
     
  28. Pauloxande

    Pauloxande

    Joined:
    Feb 8, 2014
    Posts:
    110
    Friends how do I make KGFMapIcon only appear when the mission is active
     
  29. Gaviathan2

    Gaviathan2

    Joined:
    May 23, 2013
    Posts:
    13
    If you use Playmaker use the Dialogue System action

    Get Quest State

    then use the KGF action

    KGFMapIconSetVisibility

    If you use code you'll have to wait for someone else :)
     
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    (Thanks, Gaviathan!)

    Pauloxande, you can also use the KGFMapIcon() sequencer command in conversations or sequences. Play the example scene in Dialogue System/Examples/KGFMapSystem/Example to see it in action.

    As an example, you can create two icons: one called "No_Icon" that doesn't have a texture, and another called "Mission_Icon" with your icon texture. Add these icons and a KGFMapIcons component to the mission object/NPC.

    When the mission turns active, use the "Mission_Icon". The example below is a dialogue entry:
    • Dialogue Text: "Yes, sir! We'll take that bunker!"
    • Script: Quest["Take_The_Bunker"].State = "active"
    • Sequence: KGFMapIcon(Mission_Icon, Bunker)
    When the mission is complete, use "No_Icon". The example below is a sequence. You could use a Quest Trigger and a Sequence Trigger, both set to OnTriggerEnter. The Sequence Trigger might run this sequence:
    • Sequence: KGFMapIcon(No_Icon, Bunker); SetActive(ExplosionEffect); Audio(Trumpet)

    If this doesn't cover your needs, let me know what your specific situation is. I can provide some suggestions.
     
  31. keyboardcowboy

    keyboardcowboy

    Joined:
    Feb 8, 2012
    Posts:
    75
    I've been looking over the documentation; I can't find an answer to my question.
    Is there a way to add color to text in a dialog such as a phrase or specific word in the text?
    Thanks
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi keyboardcowboy, use [em] tags. Define the colors in the Dialogue Editor on the Database tab under Emphasis Settings, or in Chat Mapper if you're using it. You can set color, bold, and/or italics. Then, on the Dialogue Manager object, tick Use Rich Text if you're using Unity GUI. Otherwise it will apply the first [em] tag to the whole line.
     
  33. keyboardcowboy

    keyboardcowboy

    Joined:
    Feb 8, 2012
    Posts:
    75
    Thanks Tony! I'll give that a go
     
  34. Pauloxande

    Pauloxande

    Joined:
    Feb 8, 2014
    Posts:
    110
    the example I'm using is KGFMapSystem Example Scene and I'm trying to do that when he sends Lieutenant West find the terminal, when the mission start icon appears and disappears when you touch the boxcolider
    I can only do that after changing the icon back on it, I did what you said
     
    Last edited: Jul 23, 2014
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi Pauloxande, in the example scene, the "Find Terminal Quest Trigger" box collider has a Quest Trigger component. Its trigger is set to OnTriggerEnter. When the player enters the trigger, it sets the "Find the Terminal" quest to "success".

    If you also want to change the icon, add a Sequence Trigger component. (Window > Dialogue System > Component > Triggers > Sequence Trigger.) Set the trigger to OnTriggerEnter. Use this Sequence:
    Code (csharp):
    1. KGFMapIcon(KGFMapIcon_dot_border,Lieutenant West)
     
  36. Pauloxande

    Pauloxande

    Joined:
    Feb 8, 2014
    Posts:
    110
    Almost that? he changes the icon of Lieutenant West, I wanted was when the mission starts the icon to appear in the terminal and when I play on the collider icon will disappear and appeared Feedback "terminal found"
     
  37. Pauloxande

    Pauloxande

    Joined:
    Feb 8, 2014
    Posts:
    110
    I finally did, I put the sequence "KGFMapIcon (KGFMapIcon_triangle, Find Terminal Quest Trigger)" in ternimal, and put Lieutenant West to appear when the trigger touched the icon disappeared
    I wanted to know how to flash it about 3 times and then stop?
     
    Last edited: Jul 23, 2014
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi Pauloxande, I'm glad it's working now! To make Lt. West's icon flash 3 times using a Sequence, try a sequence like this:
    Code (csharp):
    1. KGFMapIcon (KGFMapIcon_triangle, Lieutenant West);
    2. KGFMapIcon (KGFMapIcon_none, Lieutenant West)@0.2;
    3. KGFMapIcon (KGFMapIcon_triangle, Lieutenant West)@0.4;
    4. KGFMapIcon (KGFMapIcon_none, Lieutenant West)@0.6;
    5. KGFMapIcon (KGFMapIcon_triangle, Lieutenant West)@0.8;
    6. KGFMapIcon (KGFMapIcon_none, Lieutenant West)@1.0
    You must define a new icon on named KFGMapIcon_none first. This shows the triangle for 0.2 seconds, then hides it for 0.2 seconds. It leaves the icon off.

    I tested the Sequence below because Lt. West doesn't have a KGFMapIcon_none in the example scene:
    Code (csharp):
    1. Audio(Sounds/Explosion);
    2. KGFMapIcon(KGFMapIcon_dot_border, Lieutenant West);
    3. KGFMapIcon(KGFMapIcon_info, Lieutenant West)@0.2;
    4. KGFMapIcon(KGFMapIcon_dot_border, Lieutenant West)@0.4;
    5. KGFMapIcon(KGFMapIcon_info, Lieutenant West)@0.6;
    6. KGFMapIcon(KGFMapIcon_dot_border, Lieutenant West)@0.8;
    7. KGFMapIcon(KGFMapIcon_info, Lieutenant West)@1.0
     
    Last edited: Jul 23, 2014
  39. Pauloxande

    Pauloxande

    Joined:
    Feb 8, 2014
    Posts:
    110
    It worked! I was wondering how to make sound or effect.
    still did not get it.
    Another thing to do as when "ABANDON MISSION" the icon disappear too
     
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    To play an audio clip:
    1. Put the audio file in a Resources folder. It can be in a subfolder. For example, look in Assets/Dialogue System/Examples/Art/Resources/Sounds/.
    2. Use the sequencer command Audio() or AudioWait(). The AudioWait() command does not end the sequence until the audio clip is done playing.
    For example, there's an audio file named "Explosion" in Assets/Dialogue System/Examples/Art/Resources/Sounds/. You can play this in a Sequence using this sequencer command:
    Code (csharp):
    1. Audio(Sounds/Explosion)
    If you're pulling audio from the web instead, you can use the AudioWWW() sequencer command.

    If you have an associated legacy animation, you can play both at the same time using the Voice() command. This is normally used to play lipsync animation at the same time as voiceover audio.

    Good point. I'll work on this for the next version.
     
  41. Pauloxande

    Pauloxande

    Joined:
    Feb 8, 2014
    Posts:
    110
    Look at this! I put the sound folder but not play
     

    Attached Files:

  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    There is a typo in your Sequence. Change "1.Audio" to "Audio".

    If it still doesn't work after this, please set the Dialogue Manager's Debug Level to Info. This will log the name of the audio file it's trying to play.
     
  43. Pauloxande

    Pauloxande

    Joined:
    Feb 8, 2014
    Posts:
    110
    Friend you can tell me why this happens? I can no longer save.
    Another problem is that when you restart the "QUEST LOG" does not work.
     

    Attached Files:

  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi Pauloxande, you must define the actor "Private Hart TL" in your dialogue database. This reserves a slot in the Lua table for "Private Hart TL" to save his position data. In the next version of the Dialogue System, which I expect to publish tomorrow, you won't have to do this.

    What do you mean by "restart"? Stopping and restarting the Unity player? Or restarting the game using the in-game menu?

    What happens to the quest log when you restart? Does the window open? If it opens, does it contain the quests that you expect to see? I would assume that the quest window should be empty (no quests) when you restart the game because it resets all quest states.
     
  45. Pauloxande

    Pauloxande

    Joined:
    Feb 8, 2014
    Posts:
    110
    When tightening here
     

    Attached Files:

  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    I'll look into this and get back to you. It looks like you're using KGFMapSystem and UFPS. Is this correct?
     
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Pauloxande, thank you for reporting this. It's just an issue with the example script for the UFPS example. I fixed it in the upcoming version by adding this line to reset the dialogue database to its original state:
    Code (csharp):
    1. DialogueManager.ResetDatabase(DatabaseResetOptions.RevertToDefault);
     
  48. ronaldomoon

    ronaldomoon

    Joined:
    Jan 24, 2014
    Posts:
    87
    Tony,

    Can you help me out a bit with understanding how the Persistent Active Data component works? In my project I have several enemies, items, switches, etc. that need to either be enabled or disabled when loading a save, based on whether or not they were enabled when the game was saved. I'm trying to make an old-school (particularly Wolf3D & ROTT) inspired FPS and I can't have enemies and loot coming back after loading or doors/secret panels/etc that were open going back to being closed.

    I have insured that all of my objects get deactivated rather than destroyed, which I'm fairly sure is the correct way to go about it. For testing/prototyping purposes, I'm using your example main menu from the UFPS deep-integration example to save, load, and reset. I know that I need to add Persistent Active Data components to the objects whose state I wish to record/apply and make that same object the target in the Active Data component, but I am at a loss as to what to do next.

    I am assuming that I need to use a LUA condition but if so do I need to go into my database and manually add entries for each object? I'm willing to do it if that's the only way, but I think there is probably a much easier and cleaner way of going about it. I have looked through the LUA and save/load sections of the documentation but to be honest, quite a bit of it is over my head at the moment. If you could shed some light on this subject, or perhaps just give a basic example, I would greatly appreciate it.

    Thanks in advance and keep up the good work,
    Ron
     
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi Ron, instructions for this very topic will be in the next release's documentation. You don't need to manually add database entries. You do however need to choose a unique identifier for each object so the save/load system knows what object you're talking about.

    Here's a preview of the documentation:

    To save the state of multiple destructible objects, you can write your own script based on Scripts/Templates/PersistentDataTemplate.cs or use the Persistent Active Data component.

    To use Persistent Active Data to track multiple destructibles:
    1. Give each object a unique variable (for example, "Crate001", "Crate002", etc.). You don't have to define the variable in the dialogue database. The Increment On Destroy script (next step) will create the variable if it doesn't already exist.
    2. Add an Increment On Destroy component to each destructible object. Assign the variable name. When the object is destroyed, it will increment the value of this variable from 0 to 1.
    3. Add a Persistent Active Data component to each destructible object.
      • Set the target to the object.
      • Add a Lua condition that compares the value of the variable to 0. When the saved data is applied, if the value is 0 the object will be active. If the value is 1 the object will be inactive.
    Your object should look similar to this:
     
  50. ronaldomoon

    ronaldomoon

    Joined:
    Jan 24, 2014
    Posts:
    87
    Thanks for the quick reply, Tony. I added both of the components and put in the same values, with my object's unique name of course, but I'm still having problems. I save my game and any objects that hadn't been destroyed through picking up or killing were gone after loading. Is there anything I need to change in the Example Menu script?

    I'm going to try this out in a new, clean project with nothing but UFPS and Dialogue System installed and try again. There's a good chance that there's something I changed somewhere along the way that's causing the problem. I'll let you know if I get it working or not. Thanks again for the help.

    Edit: I just tried adding the two components to the pickups in your UFPS deep integration example scene and giving them all unique names and whatnot, in a project with nothing other than your product and UFPS (both are updated to the newest versions). I still had the same problem unfortunately. Saving and then loading makes all of the pickups disappear even if I didn't pick them up. :-(
     
    Last edited: Jul 25, 2014