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,694
    Hi Licarell, perhaps in the future. Many developers use Chat Mapper and articy:draft, and I feel it's very important to keep everything compatible with those authoring tools, too. For now, developers can use battle-tested node-based systems like PlayMaker to wire things together. If you have any suggestions for additional PlayMaker or plyGame actions, please let me know!
     
  2. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    I agree Tony should focus on Dialogue System first.
    I would be great if the Conversation Node View can highlight the current node and see the variables while the Unity Editor is playing, just like Mecanim.
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    That's a great idea! Especially seeing the variables. I'll look into this.
     
  4. Alarconte

    Alarconte

    Joined:
    Jan 8, 2014
    Posts:
    32
    Hi again!

    I congrat you again for your fantastic asset you have here.

    In bold the straight questions, for fast reading.

    First:

    I'm triying to do this;
    -That during all the conversation with one conversant, you only see his portrait, and you see it all the time (there is no moment during a conversation when you don't see the portrait of your interlocutor).

    After scanning all forum and looking over the online documentation, I thought that Set Portrait (maybe at the beginning of the conversation) will save me the day... I tried using SetPortrait at the first and second dialogue entry, and in EVERY entry (I mean, "SetPortrait(Player, texturename_here)"). After trials, I think that I only need to use it once.

    The result is, the portrait of the actor changes forever (until I use another Set Portrait in another conversation, that's fine..) but big problem; The change in the actor portrait occurs after the actual conversation ends.

    So I talk with conversant 1, Set player portrait to conversant 1, and I don't see the player portrait. If I talk again with conversant 1 I see the player portrait correctly (conversant 1 portrait), and if I talk with conversant 2, when player talks, I see the portrait of conversant 1. And then, next conversation, I will see the portrait of conversant 2 if I talk to conversant 1. (So It's cleary that SetPortrait affects after conversation).

    This, in documentation,
    • As of version 1.2.4, this command takes visual effect immediately instead of waiting until the next subtitle.
    make me think that SetPortrait have to work in his intended way, and not with my problematic. I'm using an nGUI dialogueGUI (and It works perfect). Maybe that the problem of refresh with SetProtrait? If is that, anyway to fix it?
    Any other tip?

    Or, Can I circumvent the problem making that during all conversation is seeing only and all the time the NPC portrait, via script without too much effort?

    SECOND:

    Following the tips in last page of the thread, I set a input player name. I'm a bit lost to change the name of the player that you can see in conversations; I tried this (the part I guess don't work well is underlined:

    public void MySubmitFunction ()
    {
    Debug.Log("I typed: " + UIInput.current.value);
    // UIInput.current.value = null;
    DialogueLua.SetVariable ("PlayerName", UIInput.current.value);

    DialogueManager.MasterDatabase.name.Replace ("Player", UIInput.current.value);

    input.SetActive (false);
    }

    The Lua variable in conversations work; but the player name as PC name in GUI shows as "(" instead the variable.
    How is the correct way to set it? thanks.


    Lots of thanks!
     
    Last edited: Jul 5, 2014
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694

    Hi Alarconte, thanks! If you want to show the conversant's main portrait image, you don't need to use SetPortrait(). Just assign your UITexture control(s) to the NGUIDialogueUI's "Npc Subtitle > Portrait Image" and "Response Menu > Subtitle Reminder > Portrait Image" fields. It will automatically use the main portrait image assigned to the actor in the dialogue database:



    If you want to change the portrait for a single dialogue entry, use the [pic=#] tag, where # is the portrait number for the actor in the dialogue database. Side note: After v1.3.0 was released, I discovered that I introduced a bug when I changed the appearance of the +/- buttons for portraits. The "-" button doesn't work, so you can't delete portrait images in v1.3.0. I'll be submitting v1.3.1 very soon. If you're in a pinch, you can edit the actor manually in the inspector view.

    If you want to change the portrait permanently, use the SetPortrait() sequencer command like you described. If you're using v1.2.4 or higher, it will set the image immediately. (Check Dialogue System/_README.txt for your version number.) You can even set it multiple times during a single dialogue entry, such as:

    • SetPortrait(sad)@1; SetPortrait(surprised)@1.5; SetPortrait(happy)@3

    Assuming that a Resources folder has textures named "sad", "surprised", and "happy", the sequence above will show them in order during the dialogue entry.

    You only need to set it once. From that point on, the actor will use this texture until you use another SetPortrait() command.

    However, if you have enabled PC subtitles, then when the PC's line is being displayed the PC portrait image will be shown. If you haven't assigned a PC image, no image will be shown. Once the conversation returns to the NPC, the NPC's portrait will be shown. To change the behavior, you can create a subclass of NGUIDialogueUI and override ShowSubtitle(), or you can use the technique described below:

    You can add a script to the conversant that implements OnConversationStart(). Add a UITexture as a child of your Dialogue Panel. Do not assign it to the NGUIDialogueUI's NPC Portrait Image field. In your script, manually set the UITexture's Texture property to the image that you want to use. Since the UITexture is not assigned to any specific NGUIDialogueUI fields, the NGUIDialogueUI will leave it as-is.


    If you want to use this name inside dialogue text, you can set a variable and then use a [lua] or [var] tag. For example:
    Code (csharp):
    1. DialogueLua.SetVariable("PlayerName", UIInput.current.value);
    • Dialogue Text: Hello, [var=PlayerName]!

    If you want to use the name for the PC's portrait name, you have to do something different. PC subtitles and portrait names are disabled by default. If you've enabled them (via Dialogue Manager > Subtitle Settings > Show PC Subtitles During Line), the Dialogue System will show the name of the player's game object. (For any participant in a conversation, it will use the name of the game object. This allows you to re-use the same conversation for many participants, such as shopkeepers in different villages.)

    To change this, you can either rename the game object or add an Override Actor Name script (Dialogue System > Component > Supplemental > Override Actor Name) and set its OverrideName field.
     
  6. Alarconte

    Alarconte

    Joined:
    Jan 8, 2014
    Posts:
    32
    the problem is that I use 1.30 version (installed in new project), but my sequences, one of them for example; SetPortrait(Player, Kori1), only change the portrait after the conversation (you can see the change in next conversation), not immediately.


    About the name, I changed gameobject name by script, and works good. Just hope doesn't create problems to another assets.
     
    Last edited: Jul 5, 2014
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    I'll look into this and post an example here.

    I only suggested changing the GameObject's name as a quick solution. If you prefer, add an Override Actor Name to the player instead. For example, if you attach this script to the player, it will set the player's name to "New Player Name" in conversations, and you can leave the GameObject's name untouched.
    Code (csharp):
    1. using UnityEngine;
    2. using PixelCrushers.DialogueSystem;
    3.  
    4. public class SetPlayerName : MonoBehaviour {
    5.  
    6.     void Start () {
    7.         OverrideActorName overrideActorName = GetComponent<OverrideActorName>() ?? gameObject.AddComponent<OverrideActorName>();
    8.         overrideActorName.overrideName = "New Player Name";
    9.     }
    10. }
     
  8. Alarconte

    Alarconte

    Joined:
    Jan 8, 2014
    Posts:
    32
    So I only need to figure how to write this:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using PixelCrushers.DialogueSystem;
    4.  
    5. public class AAL_OverrideName : MonoBehaviour {
    6.  
    7.  
    8.     //private string newName;
    9.     private OverrideActorName overrideActorName;
    10.  
    11.     // Use this for initialization
    12.     void Start () {
    13.         overrideActorName = GetComponent<OverrideActorName>() ?? gameObject.AddComponent<OverrideActorName>();
    14.     }
    15.    
    16.     // Update is called once per frame
    17.     void Update () {
    18.  
    19.        
    20.         overrideActorName.overrideName = "" + DialogueLua.GetVariable("PlayerName");
    21.     }
    22. }
    23.  
    (I determine in runtime the Lua variable in other script, and work)
    DialogueLua.SetVariable ("PlayerName", UIInput.current.value);
     
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    That should work. You might as well do this:
    Code (csharp):
    1. overrideActorName.overrideName = DialogueLua.GetVariable("PlayerName");
    It's the same thing as:
    Code (csharp):
    1. overrideActorName.overrideName= "" + DialogueLua.GetVariable("PlayerName");
    And setting it every frame in Update might be overkill. Perhaps you only need to set it after your other script has called DiaogueLua.SetVariable("PlayerName", UIInput.current.value) and after loading a saved game.
     
  10. Alarconte

    Alarconte

    Joined:
    Jan 8, 2014
    Posts:
    32
    Set in a function called when the player defines the name, I worked around

    overrideActorName.overrideName= "" + DialogueLua.GetVariable("PlayerName")

    and

    overrideActorName.overrideName = DialogueLua.GetVariable("PlayerName");

    but, the result is not the value of the varible, but the variable itself.

    I scripted;

    Debug.Log("Player Name Variable Value is " + DialogueLua.GetVariable("PlayerName"));

    Console told me

    "Player Name Variable Value is PixelCrushers.DialogueSystem.Lua+Result"

    And in game, the PC Name of Dialogue shows "PixelCrushers.DialogueSystem.Lua+Result". (The same result when I tried other different strategies before...
     
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi Alarconte, try this:
    Code (csharp):
    1. overrideActorName.overrideName = DialogueLua.GetVariable("PlayerName").AsString;
    The Lua.Run() and DialogueLua.XXX() methods return a Lua.Result struct to provide a layer of abstraction between the Dialogue System and the underlying Lua implementation. You can get a specific type from the struct by add "AsString", "AsInt", "AsFloat", etc., to the end.
     
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Version 1.3.1 has been submitted to the Asset Store and is available now on the customer download site! (PM me your invoice number for access.)


    Version 1.3.1:
    • Dialogue Editor improvements:
      • Added: Sort assets by name or ID.
      • Added: Automatically sync assets from other databases.
      • Added: Checkboxes in Merge utility to merge only specific types (actors, items, etc.).
    • Added: Sequencer syntax command(...)->Message(X) to send sequencer messages when a command finishes.
    • Added: Sequencer command SetPortrait(actorName, pic=x) syntax to use an actor's built-in portraits.
    • Added: DialogueManager.SetPortrait() method.
    • Fixed: SetPortrait() sequencer command wasn't applying to subsequent dialogue entries in current conversation.
    • Fixed: Couldn't delete portrait textures in Dialogue Editor.
    • Fixed: Bug where items/quests weren't being added to master database in AddDatabase().
    • Improved: Range Trigger now supports 2D.
    • (NGUI) Added Always Keep Focus checkbox on NGUITextFieldUI.
    • (PlayMaker): Added Set Portrait action
    • (plyGame): Added Set Portrait block

    Coming Soon:
    • More-automated process for adding voiceover.
    • Common API for converters, and CSV import/export.
    • Localized asset names.
    • Active Dialogue Editor display at runtime.
    • And more!
     
  13. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    In "Coming Soon" of your latest post, I see there is no more spreadsheet support mentioned.
    I agree for this change because I think CSV, Excel or even Google Spreadsheet is basically the same, they are all table with rows and column. So, I think CSV is simple enough as an example.
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Thanks, I agree. Excel and/or Google Sheets might come later, but CSV should be a good starting point. The last item, "And more!", includes a lot of other items. I'm implementing them as fast as I can. :)
     
  15. hugo-tguerra

    hugo-tguerra

    Joined:
    Jul 7, 2013
    Posts:
    13
    Hi. I've been watching the tutorial videos trying to decide if this is something I want to purchase and I have a few questions:

    Response menu: Is it possible to display the entire conversation and not just the final response?

    Using Daikon Forge, how would I display that entire conversation in seperate buttons or other clickable elements? Is there anyway to store the conversation in an array or using the included db to load the data into daikon forge?

    Is it possible to store variables in a response? Can I do it in chatmapper?

    I know these are a lot of questions so I thank you in advance for the patience!

    Cheers
     
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi hugo.tguerra, yes. The prefab UIs included with the Dialogue System don't do this because they're designed to work like Mass Effect, Skyrim, and The Walking Dead. Instead of using the prefabs, you can write a short script that implements the IDialogueUI methods to display the entire conversation. The Dialogue System includes a template to get you started. You only need to fill in the specific code to do what you want. The important point is that the UI is decoupled from the database. You can swap in whatever UI you want to use, as long as it implements the IDialogueUI interface methods, and the database will work with it. Or, if you want to use one of the prefab UIs, you can add a script similar to the included ConversationLogger that adds each entry to a scrolling chat window, for example.

    In scripts, you can access dialogue databases, which contain conversations. You can iterate through the conversation's dialogue entries to fill in DF-GUI buttons. I'm not sure exactly what you have in mind. If you intend to display all the branches in the conversation tree, your code would be responsible for positioning them, drawing connection arrows, etc. In any case, however you want to do it, all of the data about conversations is available to your scripts.

    Yes to both questions. There are three places where you can use variables:
    1. Read variables in the text of a dialogue entry. Example: "You're [var=Age] years old? You look so much younger!"
    2. Read variables in a dialogue entry's Conditions. Example: Variable["Age"] > 20
    3. Read/write variables in a dialogue entry's Script. Example: Variable["Choice"] = "Eva"
    You can also access these variables in scripts, PlayMaker, or plyGame.

    You can do all of this in Chat Mapper, too. In fact, the design of these features comes directly from Chat Mapper. If you can write it in Chat Mapper, the Dialogue System can run it.
     
  17. hugo-tguerra

    hugo-tguerra

    Joined:
    Jul 7, 2013
    Posts:
    13
    Hi!

    Thanks for the fast response. I think ConversationLogger might just be what I'm looking for. That's exactly what I'm trying to make into buttons with DF-GUI. A conversation log with only the chosen branches displayed.

    I know next to nothing of coding and I have limited assistance on that, so I'm trying to use the least amount of code possible by using Assets.

    I want to convert the conversations into buttons so I can compare variables with an "inventory".

    Would it be possible to hide branch starting responses and trigger them from another source? i.e. Press an item in the inventory and it would start a new branch with the NPC telling the player about this?

    I don't know if chat mapper has any features to do something like this: An additional branch that can appear at any time called from an external source. I really liked something with a node based structure like that.

    Any idea on how I could achieve this?

    I can deal with some basic coding, if necessary and can learn more.
     
    Last edited: Jul 7, 2014
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    This will require a little bit of coding, but the Dialogue System part should be very simple. The DF-GUI part shouldn't be too difficult either. I can help out if you get stuck. In Chat Mapper, you can define and set variables and test conversations in the simulator, but of course you can't test DF-GUI buttons from within Chat Mapper. You'll have to import your Chat Mapper project into the Dialogue System to run it in Unity for that. Please keep in mind that importing requires Chat Mapper Indie or Chat Mapper Commercial; you can't import from Chat Mapper Free.

    Yes. In Chat Mapper, you can define links between different conversations. The Dialogue System supports this. You don't need to do any coding for this.
     
  19. hugo-tguerra

    hugo-tguerra

    Joined:
    Jul 7, 2013
    Posts:
    13
    Sorry for the mess above, I chose to totally rephrase my question last minute. But your answer was very helpful, thanks!
     
  20. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Happy to help! If you're unsure about the purchase, you could download the free version of Chat Mapper and play around with the ideas. You can't do everything in Chat Mapper alone (e.g., no DF-GUI buttons), but you can test branches and switching between different conversations. You might just want to put each interrogation in one conversation, though, so you can see everything on the same page. Also, Chat Mapper isn't required to use the Dialogue System. You can use articy:draft, the Neverwinter Nights toolset, or the built-in editor. But I really like Chat Mapper, and it may be the perfect tool for what you want to do.
     
  21. hugo-tguerra

    hugo-tguerra

    Joined:
    Jul 7, 2013
    Posts:
    13
    Hey again. I've downloaded Chat Mapper to get a hang on the mechanics. Can the built-in editor do everything Chat Mapper can when used with your asset? We have a small budget at the moment and want to proceed with caution in these early steps.

    Also, how could I call a response from another source like from an inventory item. i.e.: ask about an item by clicking in it or having a response like "I would like to ask you about something" and then point to an inventory item. Doing that with the ["Var"] method would turn messy really quickly. Maybe running a new conversation when pressing the inventory item?

    About the conversation log displayed in buttons what kind of script would I have to add to a response so the button can do something specific to that response?

    i.e.

    Player: "Hi"
    NPC: "Hello"
    Player: "How's it going?"
    NPC: "I should go"
    Player: "..."

    When you toggle the "I should go response" a sad violin tune plays, while the button is toggled. I'm sure if the response had a unique ID the button could listen to or a local var, it could just check if violinPlay = true, right?

    Thanks for indulging me in all of this, I've spent days looking at possible solutions, so I have to be sure and also convince my "progamming advisor" this is the right choice for us.
     
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    The runtime engine can do everything that Chat Mapper offers. The in-Unity editor can do everything except link a dialogue entry in one conversation to an entry in another conversation. I haven't decided on a good way to present that in the editor interface.

    I suggest defining a dialogue entry for each topic, and add a condition. The Dialogue System will only show the dialogue entry if the condition is true. For example:

    • Player: "I would like to ask you about something."
      • NPC: "What do you want to know?"
        • Player: "Do you like bagels?" [Condition: inventory contains Cream Cheese]
        • Player: "We found a suicide note." [Condition: inventory contains Suspicious Note]
        • Player: "Where were you at midnight?"
        • Player: "Never mind."
    If the player's inventory contains Cream Cheese but not Suspicious Note, it will show all of the entries above except "We found a suicide note." If you don't want to use variables defined in Chat Mapper, you can register your own C# function with the Dialogue System and use that inside conditions.

    If you don't know the items ahead of time, you could (1) use variables to fill in blanks, or (2) get your programmer to build conversations dynamically at runtime.

    That's an easy one. It's an integral part of the Dialogue System's design. Every dialogue entry can have a short cutscene sequence. There are lots of built-in sequencer commands, and you can also define your own. The dialogue entry would look something like:

    Dialogue Entry:
    • Speaker: NPC
    • Dialogue Text: "I should go."
    • Sequence: Audio(SadViolin)
    Or you could get fancier, such as:
    • Sequence: Audio(SadViolin); Animation(LookAtWindow)@2; SetActive(Lightning)@2.5


    No problem at all. The Dialogue System is quite versatile, but it's not going to be a perfect fit for everything. Please feel free to point your programming advisor to the online manual if he wants to get a feel for the API.
     
  23. hugo-tguerra

    hugo-tguerra

    Joined:
    Jul 7, 2013
    Posts:
    13
    There's a possibility of having several inventory items for the NPC to comment and it wouldn't be user friendly to give them a 10+ list of options to choose. I was looking for a way to, by selecting "what do you know about..." being able to run some script or something that, by selecting the proper inventory item, would call the correct conversation that has the player and npc talking about that inventory item.

    And could I call a c# script the same way? The thing is, I would also need to access that functionality a few responses later if needed.

    "I should go."
    "Wait don't go"
    "I have plans"

    We could be already in this stage of the conversation but it would still be possible to interact with the "I should go response". Hence my need of converting a log to buttons. If I could do it without the buttons, I would go without them easily.

    My explanation has been a bit confusing I know so here's a more explanatory image with what I'm trying to put into words.

    https://dl.dropboxusercontent.com/u/4859803/dialogSystem.jpg

    Not that easy to pull off without code, I imagine. We already got playmaker but I doubt it would be much help in this.

    Cheers
     
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi hugo.tguerra, this is all do-able. But, like you said, it will require a little code. Fortunately the Dialogue System provides a lot of hooks for your own code. Text input fields were added after the fact, for example. It wouldn't be too difficult to add an inventory selector to your UI. I can help you and your programmer set it up when you get to that point.
     
  25. hugo-tguerra

    hugo-tguerra

    Joined:
    Jul 7, 2013
    Posts:
    13
    I've been talking to a friend and what he told me would be best, would be to use tags in the responses and every one of them would be parsed and added to a multidimensional array.

    i.e.

    Player: "Hi"
    NPC: "Hello"
    Player: "How would you like your bagel?"
    NPC: "I don't like bagels." [likeBagel]
    Player: "..."

    A parser would then send the text to a column of the array and the tag to another.
    The first column would be displayed as text and the second would be stored as a hidden value in the buttons.

    A script would then listen to the click or toggle of a button and set a variable as the tag in the button.

    Then it would just need to run something if a certain tag is true, I guess.

    Just need to figure out how to send and parse that information into an array.
     
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    The Dialogue System provides most of this functionality without having to write any code. I'll send you a short proof of concept later today.
     
  27. hrvat

    hrvat

    Joined:
    Mar 12, 2013
    Posts:
    42
    Hey there! I an issue

    First, I'm watching
    and I want to add the OVRCameraController from the Oculus prefabs to Sequencer Camera, but I can't it only accepts a prefab which is the camera or a camera. How can I resolve this using two cameras?

    I want to make a cutscene just like the Feature Demo

    thanks
     
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi hrvat, that's a good question. I have a headset on order, but Oculus won't be shipping it until September. I understand the problem: OVRCameraController is a wrapper for two Cameras, but the sequencer currently assumes that it only needs to control one camera. I'll look into the best way to handle this and try to include a solution in the next release.
     
  29. hugo-tguerra

    hugo-tguerra

    Joined:
    Jul 7, 2013
    Posts:
    13
    Thanks! :) I'll be waiting, then.
     
  30. hrvat

    hrvat

    Joined:
    Mar 12, 2013
    Posts:
    42
    Thanks for answering, but I might not have the opportunity to wait so long for the next release :( Bad news. Is there any way we can work around this?

    regards,
    Jaime
     
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694

    I'll try to get you a patch later today. I'll PM you the download link.
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Jaime, I just PM'ed you the download link.

    This patch is also available to all Dialogue System customers on the Pixel Crushers download page. PM me your invoice number if you need access.

    On the Dialogue Manager object, set Display Settings > Camera Settings > Alternate Camera Object to your OVRCameraController object. This must be an object in your scene, not a prefab. I tested this using a GameObject that contains two children: a left camera and a right camera. I assigned the parent object to Alternate Camera Object. When Oculus ships my headset, I'll test it with that, too.
     
  33. hrvat

    hrvat

    Joined:
    Mar 12, 2013
    Posts:
    42
    Thanks, I'll take a look at it!
     
  34. hrvat

    hrvat

    Joined:
    Mar 12, 2013
    Posts:
    42
    I have another issue, the scene I'm using is: inside third party support > Daikon Forge GUI > Example > Key Triggers

    For some reason, when I go to the gameobject Dialogue Manager and type inside Default Sequence - None(); it stills (the camera) does the change of position when the player encounters private hart, I have tried also to put other sequences inside this *Camera(Wide); Animation(Reload); Animation(Fire)@2; required Camera(Closeup, listener)@3.5* and others alike.

    I don't want the camera to change positions at all, that's why I have tried other commands to see which works, but I can't make it work in any other way.

    What can I do?
     
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi Jaime, remember that each dialogue entry may also have its own Sequence that overrides the Dialogue Manager's Default Sequence. This is the case for Private Hart's first line. If you delete this entry's Sequence, and reset the Dialogue Manager's Default Sequence to None() or Delay({{end}}), it will leave the camera alone for that entry. Some other entries also have their own Sequences, too, so you'll have to delete those if you want to go through the entire conversation without touching the camera.
     
    Last edited: Jul 11, 2014
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Version 1.3.1 is now available on the Unity Asset Store!

    A small patch is available on the Pixel Crushers customer download site. If you need access, please PM me your invoice number. The patch includes:

    • Support for non-Camera objects (e.g., Oculus OVRCameraController) for the sequencer camera.
    • BarkTrigger set to OnTriggerEnter now barks to the target object if assigned; otherwise it barks to the object that entered the trigger as in previous versions.
    • AnimatorTrigger() sequencer command now finds Animator in children just like the other AnimatorXXX() commands.
     
  37. hrvat

    hrvat

    Joined:
    Mar 12, 2013
    Posts:
    42
    I finally got time to test the Package, it works really nice.

    Thanks again :)
     
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Were there any issues with the Oculus VR headset?
     
  39. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    Is there a better way to use a SPRITE instead of a TEXTURE, when making the Dialogue GUI?

    I followed the tutorial to make my own GUI, using Labels with an image for the character's portraits. However, it doesn't let me use Sprites. Just textures.

    This is especially important in a 2D game, because my Sprites are only 17x16, while my textures HAVE to be in a POT2 (or else you can get really bad pixel distortion). But because I have to use a 32x32 texture, the positioning is all off and I have to use offsets. Not a big deal, but I would prefer to just be able to do "TopCenter - TopCenter" instead of having to figure out the correct offset every time.

    Thanks!
     
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi CarterG81, can you add transparent space to your sprites to pad them to 32x32? If you're already doing this, then you should be able to set the GUI Label's Scaled Rect to Top Center - Top Center and set the (X,Y) offsets to (-8,-8) or whatever is appropriate to position it the way you want.

    Are you using animated images as described here?
     
  41. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    That works fine, and it's what I'm currently doing. If it were a Sprite though, I could simply select the rectangle of just the 17x16 character using the Unity Sprite Editor (Sprite - Multiple), so I don't have to calculate the offset. Really though, it's not a big deal at all.


    ----------------------------------------

    I have been working all day to get the Dialogue System working with my setup. I have a few real questions, trying to figure this out.



    My Problem: When I start the conversation, it renders only either PC Subtitle or NPC Subtitle. While the one is talking, the other disappears.

    So it starts up with ONLY "NPC Subtitle" and its dialogue. Once they are finished talking, it disappears and "PC Subtitle" appears.



    Here is a gif of what it is currently doing:

    Example2.gif




    What I am trying to do: I am trying to have a conversation, where one person will talk, and their text will do the typewriter effect until done. Once it is done, it will STAY displayed for the player to read it. Then the other person will talk (typewriter effect) while the former dialogue is still there.

    Then when someone talks, their old text disappears and new text is displayed. A back-and-forth conversation without any GUI disappearing.


    Here is a gif, crudely drawn to show what I am trying to achieve.

    Example1.gif
    I have absolutely no idea what I need to do to achieve this. What options to check/uncheck, to keep the GUI from disappearing.





    ----------------

    Extra Information, if it helps


    This game's dialogue system is a lot closer to a JRPG (where the people talk and talk and talk, until the player eventually makes a choice or gameplay resumes).


    My Dialogue System GUI Root is setup looking like this:

    DialogueSystem.png

    There are five windows. The big one (top left, black shirt Captain) is the Player's text and dialogue choice panel. The big one on the right (darker skin, Admiral Akmar) is the NPC the player is conversating with.

    The three below, are Additional conversation members who do nothing more than interject, sharing their opinion, or saying dialogue after some text. They should not display at all until they have something to say, and then the player should click a button (Continue) to get rid of them.


    Here is what my Dialogue UI / GUI Root looks like.

    Hierarchy.png



    For now, I am not messing with the extra three at the bottom. One step at a time.
     
    Last edited: Jul 13, 2014
  42. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    A second question,

    As you can see in the hierarchy, I have the three extra "CREW# Subtitle" GUI's.

    Right now, I have 3 Actors in my Conversation. PLAYER, NPC, and CREW1.

    Whenever I change the actors to be the Player/Crew1 talking to each other, it still uses the "NPC Subtitle" at the top right.

    How do I change it to where whenever the CREW1 actor is speaking, he uses the "CREW1 Subtitle" GUI instead of the "NPC Subtitle" GUI?
     
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi CarterG81, try setting it up like this:
    1. Create a fullscreen panel under GUI Root named Dialogue Panel. Move all of your controls under this panel. Assign it to Dialogue/Panel.
    2. Leave PC Subtitle, PC Subtitle/Dialogue Box, and PC Subtitle/Portrait Box unassigned to any fields in your UnityDialogueUI. When GUI controls are unassigned, UnityDialogueUI won't touch them. They'll always be visible whenever their parent panel (i.e., Dialogue Panel) is visible.
    3. Likewise, leave NPC Subtitle, NPC Subtitle/Dialogue Box, and NPC Subtitle/Portrait Box unassigned.
    4. Assign PC Subtitle/Portrait Box/Portrait Image to Dialogue/Pc Subtitle/Portrait Image and Response Menu/Pc Image.
    5. Assign NPC Subtitle/Portrait Box/Portrait Image to Dialogue/Npc Subtitle/Portrait Image and Response Menu/Subtitle Reminder/Portrait Image.
    6. Assign PC Subtitle/Dialogue Box/Subtitle Line to Dialogue/Pc Subtitle/Line.
    7. Assign NPC Subtitle/Dialogue Box/Subtitle Line to Dialogue/Npc Subtitle/Line.
    8. Make a copy of NPC Subtitle/Dialogue Box/Subtitle Line named Subtitle Line Reminder, and remove the typewriter effect. Assign it to Response Menu/Subtitle Reminder/Line.

    The final setup should look similar to this:




    This should take care of the issue you described. This setup bypasses the default behavior of the UI, which works more like Mass Effect or The Walking Dead.

    I'm going to look into sprites for the new Unity GUI that's supposed to be introduced in Unity 4.6.

    For the three additional members, you'll have to do a little scripting to add this extra functionality. Other developers have done the same thing, though; it's not a lot of code. Briefly, similarly to what the example recipes do, define a subclass of UnityDialogueUI that overrides the ShowSubtitle() method. If the subtitle is spoken by one of those three extra conversation members, display it down there. Otherwise just use the base method.
     
    CarterG81 likes this.
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    If you override ShowSubtitle() like I described above, it should redirect CREW1's lines to the CREW1 box.
     
    CarterG81 likes this.
  45. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    Thank you very, very much.
     
  46. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    I tried your method, and it works perfectly to ALWAYS display the NPC's dialogue. Great. However, the Player's dialogue disappears whenever the NPC speaks.

    If I check "Show PCSubtitles During Line" then the Player's text renders with the typewriter effect, while the NPC's dialogue disappears entirely. After the Player's dialogue is done and the NPC speaks, the player's disappears again.

    If I uncheck "Show PCSubtitles During Line" then it ALWAYS displays the NPC's dialogue, but the Player's disappears as I said.


    I always have checked "Show NPCSubtitles During Line" and "Show NPCSubtitles WIth Responses" so the NPC text always stays.

    Ultimately, I would like the player to make a short explanation choice, like "Intimidate." and it results in the "PCSubtitle During Line" to be the actual dialogue, writing out like a typewriter, then staying there as the Alien talks, back and forth.
     
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    I see what you mean. I'll put together a little example that addresses this and post it here in a bit.
     
  48. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Please take a look at this example scene. TestDialogueUI is a subclass of UnityDialogueUI. It overrides ShowSubtitle() to display the subtitle in the correct area:
    • PC box if the line is spoken by the player,
    • NPC box if the line is spoken by the NPC assigned as the conversation's conversant,
    • Crew1 box otherwise. (You can change this logic of course.)
    It also overrides HideSubtitle() to do nothing (i.e., not hide any subtitles). The dialogue UI doesn't use NPC Subtitle Reminder at all since the original NPC Subtitle never gets hidden.

    It also overrides ShowResponses() to hide the PC subtitle before showing the response menu, since they occupy the same GUI area.

    Finally, it manually sets the portrait images instead of letting UnityDialogueUI manage them. This ensures that they're never hidden.

    If you notice any issues, please let me know. I'm logging off for the day, but I'll check in the morning.
     
    Last edited: Jul 13, 2014
    CarterG81 likes this.
  49. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    Thank you again. You go above and beyond helping us. For that, I am very grateful :)

    rofl @ dialogue in examples too, lmao
     
  50. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    99% working :)

    The only thing that doesn't work when I incorporated that example, is that after the first initiate NPC response, the typewriter effect stops working.

    I will look into why, if I can figure it out.


    edit: I couldn't figure out how to play the typewriter effect, so I simply activated the trigger in the new TestDialogueUI script.

    Code (csharp):
    1. public GameObject scriptGO;
    2. else if (subtitle.speakerInfo.transform == DialogueManager.CurrentConversant) {  
    3. scriptGO.GetComponent<TypewriterEffect>().OnEnable();
    It works though, as you can see here:

     
    Last edited: Jul 13, 2014