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
    Hi @Darkkingdom - Please set the Dialogue Manager's Debug Level to Info. This will log Lua activity to the Console view. When you reload your game, you should see a lot of text in the console, starting with this entry:
    Code (console):
    1. Dialogue System: Lua(Actor = {}; Item = {}; Quest = Item; Location = {}; Conversation = {}; Variable = {}; Variable["Alert"] = "")
    2. UnityEngine.Debug:Log(Object)
    3. PixelCrushers.DialogueSystem.Lua:RunRaw(String, Boolean, Boolean)
    4. PixelCrushers.DialogueSystem.Lua:Run(String, Boolean, Boolean)
    5. PixelCrushers.DialogueSystem.Lua:Run(String, Boolean)
    6. PixelCrushers.DialogueSystem.DialogueLua:InitializeChatMapperVariables()
    7. PixelCrushers.DialogueSystem.DatabaseManager:Add(DialogueDatabase)
    8. PixelCrushers.DialogueSystem.DatabaseManager:ResetToDefaultDatabase()
    9. PixelCrushers.DialogueSystem.DatabaseManager:Reset(DatabaseResetOptions)
    10. PixelCrushers.DialogueSystem.DialogueSystemController:ResetDatabase(DatabaseResetOptions)
    11. PixelCrushers.DialogueSystem.DialogueManager:ResetDatabase(DatabaseResetOptions)
    If you don't see this, make sure the code that calls DialogueManager.ResetDatabase() is actually running.

    If you do see it, then look below it. Is one of your scripts perhaps reloading your saved state from somewhere else?

    Please feel free to send an example project to tony (at) pixelcrushers.com. I'll be happy to take a look.
     
  2. Darkkingdom

    Darkkingdom

    Joined:
    Sep 2, 2014
    Posts:
    81
    Hey tony thanks again for the fast reply :)

    The code is running but I just see this:


    There is nothing like PixelCrushers.DialogueSystem.Lua:RunRaw(String, Boolean, Boolean) etc
    .And I currenty don't have a save system so I don't think thats the problem^^

    Is the code how I reset the DB the right way?
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Darkkingdom - That screenshot shows that the Lua environment is correctly being reset to the initial values that you defined in your dialogue database. (The "Lua:RunRaw" etc. text is the stack trace, which is shown at the bottom of the Console view. To see it, click on one of the lines in Console and look at the bottom of the view. The stack trace shows you the order of methods that were called to result finally in the low-level call to Lua:RunRaw.)

    The problem may be the order in which you're loading the level and resetting the database. Can you reset the database (call DialogueManager.ResetDatabase) before reloading the level?

    If that doesn't help, what version of Unity are you using, and are you using any other integration packages such as RFPS Support or UFPS Support?
     
  4. Darkkingdom

    Darkkingdom

    Joined:
    Sep 2, 2014
    Posts:
    81
    Hey Tony :)

    okay I tried it in every order and even ingame with a input button but it seems like DialogueManager.ResetDatabase has no effect :(
    I'm using Unity 4.6.5 and nope I don't have such a package^^
    Maybe there is another way to reset the DB without DialogueManager.ResetDatabase?^^
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Darkkingdom - Can you explain in more detail what you want to do?

    The lines you posted ("Dialogue System: Lua(Actor = {}; Item = {}; Quest = Item; Location = {}; Conversation = {};...") show that you're correctly resetting the Dialogue System's Lua environment at some point. The "KilltheGiant" quest's state is being reset to "unassigned".

    Is the problem the quest tracker HUD? What's happening to indicate that the data isn't being reset?
     
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Dialogue System 1.5.3 Beta 1 Available

    Beta release 1 of the Dialogue System for Unity 1.5.3 is available on the Pixel Crushers customer download site. The final release will be submitted on Thursday. If you need access to the download site, please PM me your Unity Asset Store invoice number.

    This release introduces some minor changes. Please note:
    • Minimum Unity version is now Unity 4.6.5.
    • When upgrading to 1.5.3, delete your old Dialogue System folder first, or at least delete these two subfolders: Prefabs/Unity Dialogue UIs and Scripts/Supplemental/UI.
      (As always, back up your project before upgrading assets.)
    Documentation: Dialogue System 1.5.3b1 Manual

    The final release will also introduce support for Opsive's Third Person Controller.

    Changes in 1.5.3:

    Core:

    • Added: Player Default Sequence (optional).
    • Added: Sequencer commands SetContinueMode(true|false) and SetVariable(variableName,value).
    • Added: Dialogue Manager > Display Settings > Input Settings > Include Invalid Entries checkbox; UnityDialogueUI and UnityUIDialogueUI show invalid entries as noninteractive.
    • Improved: Dialogue Manager Wizard validates that dialogue UI is valid and automatically adds Canvas if assigning a Unity UI Dialogue UI.
    • Improved: Sequencer command syntax now accepts whitespace between command and parentheses.
    • Improved: UnityUIDialogueUI can now specify transition animations for NPC/PC Subtitle panels & Response Menu panel.
    • Improved: Added Show Touch Screen Keyboard checkbox to UnityUITextFieldUI.
    • Improved: Added continue button to JRPG2 UI(legacy Unity GUI).
    • Improved: These components how automatically update quest tracker HUD: Condition Observer, Quest Trigger, Lua Trigger, Set Quest State On Dialogue Event, Lua On Dialogue Event.
    • Improved: Quest Trigger now allows you to set quest entry (subtask) states.
    • Changed: If switching to a new Dialogue Manager in another scene that uses the same initial database, retains the existing Lua environment.
    • Changed: These sequencer commands now use Lerp instead of Slerp: LiveCamera(), LookAt(), MoveTo(), Zoom2D().
    • Fixed: Continue Button mode "Not Before Response Menu" showed continue button if response menu had only 1 item.
    • Fixed: Localized text table import & export now handles embedded carriage returns (), unusual line break formats.
    • Fixed: Removed deprecated method warnings in editor code in Unity 5.
    • Fixed: Conflict that prevented Windows Store & WP8 builds.

    Third Party Support:
    • articy:draft:
      • Converter updated to handle articy:draft 2.4.
      • Added support for properties IsItem, IsQuest.
    • Aurora/Neverwinter Nights Toolset: Special handling for Hungarian characters that Aurora Toolset doesn't export properly.
    • CSV Converter: Fixed conversion bug caused by exporting from applications that fill out extra fields on all lines.
    • ICode: ICodeVariableTrigger now automatically updates quest tracker HUD.
    • PlayMaker:
      • Expanded Dialogue System Load Level action with more options.
      • Added Level Will Be Unloaded action.
    • Realistic FPS Prefab:
      • Updated for RFPS 1.22 and for S-Inventory 1.25 integration.
      • DialogueSystemOnPickUpItem now automatically updates quest tracker HUD.
      • Added PersistentSmoothMouseLook.
    • RPG Kit:
      • Updated Dialogue Manager prefab's dialogue UI to scale better in different screen sizes.
      • Barker prefab now uses Unity UI.
    • S-Inventory:
      • Updated for S-Inventory 1.25.
      • Fixed an errant warning with ItemGroups.
     
  7. Bogu-94

    Bogu-94

    Joined:
    Dec 11, 2013
    Posts:
    58
    Still figuring out how to use sequencer.
    Tried to use the command "SendMessage". but the Debug.Log isn't called.
    What am I doing wrong here?

    I need to set the Interacting state to en/dis Player Control, Pause enemy movement, etc


    the Manager object has only WorldManager.cs component

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class WorldManager : MonoBehaviour {
    5.     public static WorldManager instance;
    6.  
    7.     public GameObject player;
    8.  
    9.     WorldCharacterMovement playerMovement;
    10.     WorldInteraction playerInteraction;
    11.  
    12.     void Awake()
    13.     {
    14.         instance = this;
    15.         playerMovement = player.GetComponent<WorldCharacterMovement>();
    16.         playerInteraction = player.GetComponent<WorldInteraction>();
    17.     }
    18.  
    19.     public void StartInteraction()
    20.     {
    21.         Debug.Log("Start Interaction");
    22.         playerMovement.Interacting(true);
    23.         playerInteraction.StartInteraction();
    24.     }
    25.  
    26.     public void EndInteraction()
    27.     {
    28.         Debug.Log("End Interaction");
    29.         playerMovement.Interacting(false);
    30.         playerInteraction.EndInteraction();
    31.     }
    32. }
    33.  
     
  8. TonyLi

    TonyLi

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

    The SendMessage() sequencer command takes three arguments:

    SendMessage( message, parameter, GameObject )

    Try this:
    Code (sequencer):
    1. SendMessage(StartInteraction,,Manager)
    Note the two commas between "StartInteraction" and "Manager". This indicates a blank parameter, which means StartInteraction() is called without any parameters. If the SendMessage() sequencer command only has two arguments, it will send the message to the current speaker (null in this case).

    You may find it helpful to temporarily set the Dialogue Manager's Debug Level to Info. When it gets to the SendMessage() sequencer command, it will report what GameObject it's sending the message to.

    If that doesn't address the issue by itself, let's check a couple things:

    1. Is Karia a participant in the conversation? To confirm, you can set the Dialogue Manager's Debug Level to Info. This will log a line like:

    Dialogue System: Starting conversation X with actor=Y and conversant=Karia

    2. Is the Sequence Trigger firing at the end of the conversation? If not, does the Condition section have any conditions that block it from firing?

    Side note: If you're using the default camera angles (i.e., you've left the Dialogue Manager's Camera Angles field unassigned), the closeup camera angle name is "Closeup" (lowercase 'u'), not "CloseUp".
     
  9. Bogu-94

    Bogu-94

    Joined:
    Dec 11, 2013
    Posts:
    58
    thanks. it's working
    when it's stated as optional in the doc, I think there's an override function that takes 2 args.

    I have my own camera angles btw
     
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Thanks for pointing that out. I'll clarify it in the manual.
     
  11. Bogu-94

    Bogu-94

    Joined:
    Dec 11, 2013
    Posts:
    58
    Can I "push" some string into a dialogue without setting it up in the conversation?

    I'm using the Quest Description as a progress Tracker like some oldschool rpgs.
    so when you load the game and have no idea what to to, press some button and the quest description pops.
    "Looks like there's nothing more to do here. Let's go to the next village."

    my current approach is using a single dialogue that shows on button press
    Code (CSharp):
    1. [lua(Quest["CurrentQuest"].Description)]
    but the drawback is, when I tried to do something like this
    Code (CSharp):
    1. "We should kill [lua(Variable["QuestItemRemaining"])] more wolves"
    the dialogue shows as-is, without converting the lua into number.
     
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @johanesnw - Is there a typo in the [lua(...)] tag?

    For variables in the Variable[] table, you can use the [var=varName] tag for a simpler syntax. For example:
    Code (dialogue):
    1. "We should kill [var=QuestItemRemaining] more wolves
    If that doesn't help, can you please post a screenshot of your dialogue entry's Inspector view?
     
  13. Bogu-94

    Bogu-94

    Joined:
    Dec 11, 2013
    Posts:
    58
    thanks again Tony... it works with [var=...]

    I checked many times, and to make sure there's no typo I even copy from this and change the variable.
    but if you find it working, maybe it's just my head start making things :p
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @johanesnw - I'm glad the [var=] tag is working for you. I'll check the [lua] tag later today. If I notice any caveats, I'll post here. If you end up using [lua] elsewhere and encounter any problems, please take a screenshot and post it here.
     
  15. Bogu-94

    Bogu-94

    Joined:
    Dec 11, 2013
    Posts:
    58
    Does Sequencer Command "Fade()" only uses Main Camera (not Sequencer Camera)?
    I wrote something like this. btw I set many inactive cameras in the scene to activate at certain cutscene (so I'm not using the Camera Angles for this)

    SendMessage(StartInteraction,,Manager); //Send this on Sequence Start
    Fade(out,1,#000000); //Fading out the Main Camera (works even the Sequencer Camera is null)
    SetActive(Main Camera,false)@1; SetActive(Cutscene1,true)@1; //Swap the Active Camera
    ChangeCam(Cutscene1)@1; //Custom Command: Change Sequencer Camera to Cutscene1
    Fade(in,1,#000000)@1; //Fading in the Cutscene1 Camera (skipped)
    AnimatorFloat(Speed,1,Leona,10); MoveTo(Move1,Leona,10); //Moving the Character to destined position for 10 secs
    Fade(out,1,#000000)@10; //Fading out the Cutscene1 Camera. (skipped)
    SetActive(Main Camera,true)@11;SetActive(Cutscene1,false)@11; //Swap the Active Camera
    Fade(in,1,#000000)@11; //Fading in the Main Camera (works even it's not the Sequencer Camera)
    SendMessage(EndInteraction,,Manager)@10; //Send this on Sequence End

    I've already set the cutscene cameras tag to MainCamera, if it really change things.
    to make things clear I've captured the video to show what I'm trying to achieve (just a test tho)
    https://www.dropbox.com/s/1g2t954l3tfhykh/sequence.avi?dl=0
    there should be Cutscene1 camera fading in 0:05 and 0:14
     
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @johanesnw - Fade() uses a GUITexture that covers the whole screen. GUITextures appear on any camera that has a GUILayer component. You may need to add a GUILayer to your other camera(s).
     
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Ian Hamilton wrote a good article for Gamasutra: "How to do subtitles well"

    It's worth reading for some excellent tips for subtitle text layout, breaking up lines, and more.
     
  18. TonyLi

    TonyLi

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

    The Dialogue System for Unity 1.5.3 is now officially available on the Pixel Crushers customer download site. If you need access to the download site, please PM me your Unity Asset Store invoice number. It should be available on the Unity Asset Store in a few days.

    This release introduces some minor changes. Please note:
    • Minimum Unity version is now Unity 4.6.5.
    • When upgrading to 1.5.3, delete your old Dialogue System folder first, or at least delete these two subfolders: Prefabs/Unity Dialogue UIs and Scripts/Supplemental/UI.
      (As always, back up your project before upgrading assets.)

    It also adds support for Opsive's excellent Third Person Controller.


    Version 1.5.3

    Core:

    • Added: Player Default Sequence (optional).
    • Added: Sequencer commands SetContinueMode(true|false) and SetVariable(variableName,value).
    • Added: Dialogue Manager > Display Settings > Input Settings > Include Invalid Entries checkbox; UnityDialogueUI and UnityUIDialogueUI show invalid entries as noninteractive.
    • Improved: Dialogue Manager Wizard validates that dialogue UI is valid and automatically adds Canvas if assigning a Unity UI Dialogue UI.
    • Improved: Sequencer command syntax now accepts whitespace between command and parentheses.
    • Improved: UnityUIDialogueUI can now specify transition animations for NPC/PC Subtitle panels & Response Menu panel.
    • Improved: Added Show Touch Screen Keyboard checkbox to UnityUITextFieldUI.
    • Improved: Added continue button to JRPG2 UI(legacy Unity GUI).
    • Improved: These components how automatically update quest tracker HUD: Condition Observer, Quest Trigger, Lua Trigger, Set Quest State On Dialogue Event, Lua On Dialogue Event.
    • Improved: Quest Trigger now allows you to set quest entry (subtask) states.
    • Changed: If switching to a new Dialogue Manager in another scene that uses the same initial database, retains the existing Lua environment.
    • Changed: These sequencer commands now use Lerp instead of Slerp: LiveCamera(), LookAt(), MoveTo(), Zoom2D().
    • Fixed: Continue Button mode "Not Before Response Menu" showed continue button if response menu had only 1 item.
    • Fixed: Localized text table import & export now handles embedded carriage returns (), unusual line break formats.
    • Fixed: Removed deprecated method warnings in editor code in Unity 5.
    • Fixed: Conflict that prevented Windows Store & WP8 builds.

    Third Party Support:
    • articy:draft:
      • Converter updated to handle articy:draft 2.4.
      • Added support for properties IsItem, IsQuest.
    • Aurora/Neverwinter Nights Toolset: Special handling for Hungarian characters that Aurora Toolset doesn't export properly.
    • CSV Converter: Fixed conversion bug caused by exporting from applications that fill out extra fields on all lines.
    • ICode: ICodeVariableTrigger now automatically updates quest tracker HUD.
    • PlayMaker:
      • Expanded Dialogue System Load Level action with more options.
      • Added Level Will Be Unloaded action.
    • Realistic FPS Prefab:
      • Updated for RFPS 1.22 and for S-Inventory 1.25 integration.
      • DialogueSystemOnPickUpItem now automatically updates quest tracker HUD.
      • Added PersistentSmoothMouseLook.
    • RPG Kit:
      • Updated Dialogue Manager prefab's dialogue UI to scale better in different screen sizes.
      • Barker prefab now uses Unity UI.
    • S-Inventory:
      • Updated for S-Inventory 1.25.
      • Fixed an errant warning with ItemGroups.
    • Third Person Controller: Added support.
     
    opsive likes this.
  19. Udin89

    Udin89

    Joined:
    Jul 19, 2015
    Posts:
    15
    Hi all, i'm new in this forum but very interested about your asset
    In this asset, can I set/modify the NPC's dialogue box in-game to show a video file?
     
  20. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Udin89 - Yes. In fact, another team was working on a Tex Murphy-style adventure game with prerecorded video, which sounds similar to what you're asking about. The Dialogue System doesn't have any specific built-in video functionality, but each dialogue entry (line in a conversation) has a Sequence field that you can use to activate GameObjects, call script methods, and more. You can use sequences to tell your video component to play a video.
     
  21. Udin89

    Udin89

    Joined:
    Jul 19, 2015
    Posts:
    15
    I see...
    If i buy it, is this asset can be modified so the dialogue box has a function to 'call' a video or picture file (format : jpg) from my server? What programming language do i need for it (modify)?

    Thanks for your reply before after
     
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Udin89 - The short answer is yes, you can modify it to show a video or picture, and you can use any language.

    The SendMessage() sequencer command lets you use any programming language. You can also write your own custom sequencer command using C# (complete source code is provided) or override the dialogue UI to add extra functionality using C#.

    The Dialogue System is modular. The UI (all the visible/audible/input stuff) is completely separate from the data modules. You can also replace the UI module with your own, and the rest of the Dialogue System will work with it.

    I'll be happy to elaborate if you can provide more specific details on what you want to do. For example, do you want to show the same video/picture every time a specific character speaks, or is there a separate video/picture for each line of dialogue? Is it built into the game or retrieved at runtime from a web server or other source?
     
  23. Udin89

    Udin89

    Joined:
    Jul 19, 2015
    Posts:
    15
    Ok, so I want to create a "MMORPG" for educate people about Math and Science subject. NPC's dialogue box for this games takes an important role as quiz provider (which is contain mathematical symbol and equation in dialogue box or random picture from my database that contains problems to solve), to show experiment video/picture, and quest. What must I do to custom or can I request to custom this asset for my project?

    Thank you.
     
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    There are many ways you could do this. Here is a simple way. Let's assume we're working with pictures first. You can extend the same design to videos and other content.

    1. In your dialogue UI, create a UI Image named "Content".

    2. Let's say your dialogue database contains this conversation:
    • [Entry 1] Dialogue Text: "What is this shape?"
      • [Entry 2] Menu Text: "Triangle"
      • [Entry 3] Menu Text: "Square"
      • [Entry 4] Menu Text: "Pentagon"
    3. In entry 1, set the Sequence to this: SendMessage(ShowPicture, Triangle, Content)

    4. Store the picture "Triangle.png" in a Resources folder.

    5. Add this script to the "Content" GameObject:

    Code (csharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3.  
    4. public class ContentHandler : MonoBehaviour {
    5.  
    6.     public void ShowPicture(string pictureName) {
    7.         GetComponent<Image>().overrideSprite = Resources.Load(pictureName) as Sprite;
    8.     }
    9. }
     
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Dialogue System 1.5.3 Unity 4.x Download Link Fixed

    On the Pixel Crushers customer download site, the download for Unity 4.x was incorrectly pointing to the 5.x version. It's been fixed now.
     
  26. Ramsdal

    Ramsdal

    Joined:
    Oct 18, 2013
    Posts:
    251
    Hi @TonyLi I have looking a bit around for a built in way to reference the Sequencer camera that is created when initiating a Conversation. As it is now a copy of my main camera is created for the conversation and placed as a child of the Dialogue System Controller, I then reference that by getting the child object, but that cannot be the smart way! ;)

    I am changing the layer mask of the Sequencer Camera, and it is working but I would like to know the proper way to reference the copy of the main camera? And yes Camera.Main gets the (now) disabled Main Camera :)

    Also want to take the chance to prise the system. It is awesome as I have also stated in my review!
     
  27. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Ramsdal - During conversations, the Dialogue Manager adds a Sequencer component. This component has properties Sequencer.SequencerCamera and Sequencer.SequencerCameraTransform. To get the sequencer camera:
    Code (csharp):
    1. Camera mySequencerCamera = DialogueManager.Instance.GetComponent<Sequencer>().SequencerCamera;
    If you're not using a standard Camera -- for example, if you're using the Oculus VR rig, which is a complex GameObject structure with multiple cameras -- you can use the Sequencer.SequencerCameraTransform property to get the GameObject's transform instead.

    Outside of conversations, DialogueManager.PlaySequence() returns a Sequencer.
     
    Ramsdal likes this.
  28. Ramsdal

    Ramsdal

    Joined:
    Oct 18, 2013
    Posts:
    251
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Updates Available to NGUI Support, Realistic FPS Prefab Support

    The Dialogue System Extras page (http://www.pixelcrushers.com/dialogue-system-extras/) has updated support packages for NGUI and Realistic FPS Prefab
     
  30. mda54092

    mda54092

    Joined:
    Feb 3, 2014
    Posts:
    3
    I have not been able to get the new Unity-Oculus implementation to work with conversations. I see solutions for the old OVR cameras, but has anyone tried the default camera that can now render stereographically?
     
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @mda54092 - I'll look at the default camera this week and update the OVR example scene.
     
  32. Ramsdal

    Ramsdal

    Joined:
    Oct 18, 2013
    Posts:
    251
    Hi @TonyLi ,

    I am having some issue with my project, when importing Dialogue System and trying the demos it comes with this (attacthed image). When I load a blank project and import Dialogue System there is no problem, it works as intended. So the fault must be somewhere in my project.

    For the record I have tried to delete Dialogue System, shutdown unity, open and import again - with same result.

    Do you happen to know what is going wrong with my project?
     

    Attached Files:

  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Ramsdal - Please temporarily switch your project's Asset Serialization mode to Mixed, as shown in the screenshot below:

    You can switch back to a different serialization mode immediately after importing.

    This is a known issue with Unity's switch to a 64-bit editor in Unity 5. It only affects demo scenes and prefabs. Some scenes and prefabs that were created in Unity 4 use 32-bit numbers that Unity 5 doesn't import correctly unless it's in Mixed mode. The Dialogue System still supports many Unity 4.6 users. When the Dialogue System drops Unity 4 support in the future, I'll rebuild the scenes in Unity 5 so users will be able to import the demo scenes in any serialization mode.
     
    Last edited: Jul 24, 2015
    Ramsdal likes this.
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Dialogue System 1.5.3 Available on Asset Store

    Version 1.5.3 is now live on the Unity Asset Store with a huge list of improvements!

    UPGRADE NOTE: If upgrading, please delete your old Dialogue System folder first.

    To better support Unity UI (now that the minimum Unity version is 4.6.5), the Unity UI support files were moved into more logical locations. In some cases, Unity 5 gets confused about the new location. Importing into a fresh Dialogue System folder bypasses this issue.
     
  35. Ramsdal

    Ramsdal

    Joined:
    Oct 18, 2013
    Posts:
    251
    @TonyLi Thanks for the quick reply, I ended up trying to copy Dialogue System files (the ones that I importet to a blank project) to my own project and then it worked. So obviously it must be something during the import, nice with an explanation :)

    Thans again! Super quick support!
     
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Happy to help! :)
     
  37. Emre_U

    Emre_U

    Joined:
    Jan 27, 2015
    Posts:
    49
    Hi Tony,

    I have some variables in Lua where I added from wizard created Database, as long as I am in the same scene everything persists and working wonderful. But even though I checked Don't Destroy On Load + Allow only one instance boxes when I return to the level all variables are reset to their original values. I tried to use GameSaver + Level manager and what not but I must say I probably failed on their usage(Though I had thought I shouldn't need them as Lua should live with dialogue manager between scenes, looks like it dies :p).

    What I am trying to achive : I have to visit and speak with 3 men ( Each results a new level loading also each changes a lua bool to true). After each convo I come back to main navigation scene. At the end when my 3rd lua bool is true I want to check the last man ( who will check 3 lua variables as condition to trigger)

    I did play with this beautiful product before but then I had used singleton pattern and DialogueLua.SetVariable("hasBox", true); variables from singleton. Though I am pretty sure there is a much easier way. Please show me the way

    P.S: I checked the youtube channel too but couldn't find a save & load tutorial video.
     
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Emre_U - You're correct -- you don't need GameSaver or LevelManager. Do you perhaps have another script or component that is resetting the Lua environment? If you set the Dialogue Manager's Debug Level to Info, it will log this line (and many others) to the Console:
    Code (console):
    1. Dialogue System: Lua(Actor = {}; Item = {}; Quest = Item; Location = {}; Conversation = {}; Variable = {}; Variable["Alert"] = "")
    When you change levels, you should not see that line again. If you see it again, it means something is resetting the Lua environment.

    Examine the scenes in Examples/Save Load Example. As a test, I removed all of the save/load stuff (LevelManager on Dialogue Manager, Game Saver Terminal). I hopped back and forth between the Airlock and Server Room, and the Lua environment persisted. Then as another test I added another Dialogue Manager to the Server Room (the secondary scene), and the Dialogue Manager in the primary scene carried over correctly.

    If that doesn't help, please feel free to email an example project to tony (at) pixelcrushers.com. If it's too big for email, send me an email to let me know so I can give you FTP access.
     
    Emre_U likes this.
  39. Emre_U

    Emre_U

    Joined:
    Jan 27, 2015
    Posts:
    49
    It is working now! I removed anything looks unnecessary. I had to still find a way to save / load but this game is like 10mins long. I can live without it. I have to study from demo scene. But I also would appreciate a video tutorial when u have time.
     
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Emre_U - I'm glad it's working now! I'll try to record a short save/load video tutorial this weekend.
     
  41. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,157


    Is there a way to get the drop down menu that shows the conversations in a database in my own scripts easily? Right now I'm manually typing them out and that's a little cumbersome.
     
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Murgilod - Add the [ConversationPopup] attribute:
    Code (csharp):
    1. using UnityEngine;
    2. using PixelCrushers.DialogueSystem;
    3.  
    4. public class TestConvPopup : MonoBehaviour {
    5.  
    6.     [ConversationPopup]
    7.     public string conversation;
    8. }
    This uses the dialogue database assigned to the Dialogue Manager. Since this is an attribute, you don't need a custom editor script.

    If you need to specify a different database, you'll need a custom editor script. Call EditorTools.DrawReferenceDatabase() in your editor script as described in the Custom Property Drawers section of the manual.
     
  43. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,157
    Oh, that was super easy! Okay, one last thing and I should be set. How do I check if a conversation is active from code? For instance, I want to pause NPC movement and character movement if they enter a conversation with an NPC. I know this is a default behaviour with the normal setup, but I need to override that for a couple reasons.
     
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Murgilod - The property DialogueManager.IsConversationActive tells you if a conversation is active.

    You can also add a script with OnConversationStart and OnConversationEnd methods to the Dialogue Manager or the actor or conversant of the conversation:
    Code (csharp):
    1. public ExampleMovementScript : MonoBehaviour {
    2.  
    3.     private bool allowMovement = true;
    4.  
    5.     void Update() {
    6.         if (allowMovement) {
    7.             // your movement code.
    8.         }
    9.     }
    10.  
    11.     void OnConversationStart(Transform actor) {
    12.         allowMovement = false;
    13.     }
    14.  
    15.     void OnConversationEnd(Transform actor) {
    16.         allowMovement = true;
    17.     }
    18. }
    But it's probably easier to simply add a Set Component Enabled On Dialogue Event component that disables your movement script(s) during conversations.
     
  45. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,157
    Alright, this is all working out so far and I really hate to take up so much of your time, but I've run into another problem. I'm trying to send OnUse from a script and I know I have to use SendMessage, but when I use
    Code (CSharp):
    1. this.SendMessage("OnUse");
    I get this error:

    What other parameter am I supposed to send with OnUse? It seems any string will do, which is odd.
     
    Last edited: Jul 26, 2015
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Send the transform of whoever "used" the trigger, usually the player. ConversationTrigger will set this as the 'speaker' transform in sequences. For example, if the bartender has a sequence: LookAt(speaker), it will end up looking at the player.

    This is a bit of an annoying change in more recent versions of Unity. ConversationTrigger has multiple overloaded OnUse methods, including a parameterless one. But SendMessage now latches onto the longer versions that accept a transform or a string, so you need to pass a non-null parameter.
     
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Save System Tutorial

    A short video tutorial on persisting data across scene changes and implementing saved games:



    All Dialogue System tutorials are available on the Dialogue System Tutorials page.
     
    Emre_U and BackwoodsGaming like this.
  48. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Support for Opsive's Third Person Controller

    Yesterday Opsive released version 1.0 of their Third Person Controller. Its API changed slightly from the beta version, requiring a change to the Dialogue System's TPC support package. I plan to make an updated support package available later today or tomorrow, with the addition of saving and loading TPC data.
     
    BackwoodsGaming likes this.
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    You can download an updated support package for Opsive's Third Person Controller here:


    This package works with Third Person Controller 1.0 and introduces new Lua functions tpcRemoveItem() and tpcRemoveAllItems(). Documentation is here.

    Saving and loading is in development and should be in the next update, along with a more comprehensive demo scene.
     
  50. Anderz

    Anderz

    Joined:
    Dec 5, 2013
    Posts:
    24
    Hello Tony, we have a bit of a problem currently in that we are unable to get the portrait image of an Actor out of Dialogue System using Playmaker. We use Actor info in lots of places in our game outside of conversations, such as populating uGUI character data sheets dynamically. For strings, floats and bools, we're able to do this easily within playmaker using "Get Lua", saving the value as a variable, then printing it in the UI. But how do we get the portrait image using a similar process so we can print it into a uGUI sprite?