Search Unity

[70% OFF - FLASH DEAL] 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,706
    On the dialogue entry node, tick Add Response Menu Sequence. Then put "GotoEntry(17)@5" in the new Response Menu Sequence field.

    The regular Sequence plays when showing the Dialogue Text. The Response Menu Sequence plays afterward, when showing the response menu.
     
  2. LOLinc

    LOLinc

    Joined:
    Nov 18, 2013
    Posts:
    28
    Hi (again)

    I was wondering how to play a specific bark by ID? The "Bark Trigger" lets me choose conversation and if the barks should be played random, sequential or by first valid. But sometimes I need to play a specific bark. Since all bark-nodes has ID's I imagine it is possible - I just can't figure out how.. So any guidance on how I can make the bark/conversation trigger/starter play a specific node using its ID will be much appreciated!

    Cheers
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Hi @LOLinc. - One way is to use a Dialogue System Trigger instead of a Bark Trigger:
    1. In the Dialogue System Trigger's Run Lua Code section, set a variable -- for example, call it barkID. If you add barkID as a Number variable in your dialogue database, you can select it from the Lua wizard's dropdown menu so you don't actually have to type any Lua code.

    2. In your bark conversation, set the Conditions field of all of your dialogue entries to only play if barkID is the correct ID number. For example, for dialogue entry 23, the Conditions field should be:

      Variable["barkID"] == 23

      You can once again use the Lua wizard if you don't want to type any Lua code.

    Or, better yet, consider using something other than ID numbers for Conditions. This is just my opinion, but ID numbers aren't intuitive to me. They're great for how the Dialogue System uses them internally, but when I'm writing dialogue I prefer to use conditions that are more "human readable." For example, if you're using the UniStorm integration in 1.5.6.1, you can base the conditions on the current temperature or time of day. It really depends on your needs, though.

    BTW, in the Dialogue System Trigger, actions are executed in this order (copied straight from the manual):
    1. Set Quest State
    2. Run Lua Code
    3. Play Sequence
    4. Show Alert
    5. Send Messages
    6. Bark
    7. Start Conversation
    If an action section is not defined (for example, if the Start Conversation section's Conversation field is blank), that section is skipped.
     
  4. LOLinc

    LOLinc

    Joined:
    Nov 18, 2013
    Posts:
    28
    Thank you for your quick reply @TonyLi !

    Setting the lua condition was also a possibility from the bark-trigger and seem to work, so I ended up doing that :)
    It would be cool with a editor option in the drop-down menu (along with random, sequential and first valid), but then again, setting this lua condition does do the trick!
    The new UniStorm integration features sounds really cool and something I would love to utilize in another project, but for my current project I simply need some basic triggers to play some narrator lines at certain points in my level, hence they are not "typical human" barks. At some areas the narrator lines are picked random, but at other areas I need the narrator to say specific nodes/barks at the specific locations.
    Anyway, your answer solved my problem - thank you very much :)

    Cheers
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    It was UFPS. There's now an updated support package on the Extras page. You can also download it here: UFPS_Support_2015-10-13.unitypackage

    If you're still having any issues with "Damage", please let me know which script/component is complaining, and what version of Unity you're using. Thanks!

    Hi @LOLinc. - Happy to help! I'll put a dropdown for bark IDs under consideration.
     
  6. LOLinc

    LOLinc

    Joined:
    Nov 18, 2013
    Posts:
    28
    Thanks again! But I am afraid was too quick there - at a closer look It does not work as intended:
    Only "Variable["barkID"] == 0" works (the start node, linking to the next valid). When I set the condition as Variable["barkID"] == 1 (or 2) it does not work. nothing happens/triggers.
    I can't put a finger on where the problem originates, any ideas?
    Cheers
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Hi @LOLinc. - Switch to the Dialogue System Trigger component, and set Variable["barkID"] = 2 in the Lua Code section. You'll know it's the right section if the Lua wizard generates the text with a single equals sign instead of a double equals sign. A single equals sign assigns a value -- in this case, assigning the value 2 to barkID so the bark conversation can check it.

    Your screenshot shows the Condition section of the Bark Trigger. This section specifies the conditions that must already be true for the Bark Trigger to fire in the first place. For what you want to do, you don't need to specify any conditions.
     
  8. LOLinc

    LOLinc

    Joined:
    Nov 18, 2013
    Posts:
    28
    Thanks for clarifying that, yet, I still don't have any luck with getting it to work.
    I switched to the Dialogue System Trigger, but the lua wizard still generates a condition with two equals (==).
    If i delete an equal sign so there only is one (Variable["barkID"] = 2), Unity throws me syntax errors when colliding with the trigger.

    But even if it worked, the Dialogue System Trigger does not allow me to choose a specific conversation (only a database) and it does not allow for specifying a UI barker, so i don't think it will do the trick either way?
     
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Hi @LOLinc. - Try this:
    1. Under the Condition foldout, set Lua Conditions > Size to 0.
    2. Close the Condition foldout.
    3. Open the Action foldout.
    4. Under the Action foldout, set Run Lua Code to Variable["barkID"] = 2.
    5. Also under the Action foldout, set the bark settings under the Bark section.
     
  10. jburfield

    jburfield

    Joined:
    Aug 19, 2015
    Posts:
    8
    Hello,

    Is there a way to change the normalized Y value of the GUI Root for the Sci-fi legacy dialogue object at runtime through c# script?

    I want to move the NPC subtitles when the text is hard to read due to the text color and the current environment.

    Thanks.
     
  11. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    That cleared that up. As you say, minor but annoying. Every error I eliminate aids in troubleshooting later. And I learned something. Thanks.

    That was already there. I also added it the Default Character Sequence field right below it. It was blank. Now the arms go away. Better, but I'm still inside the character's head. LOL Looking at the back of her eyeballs...

    Hmmm, I saw that in the docs, and wonder, can I use that to play a sound when the player completes a quest, or is there some better way to do it, say within the Alert message?

    That would be great. I will be patient with that one...

    Thanks for outlining some options. I will have some more poking around to do. So my question is, what is an efficient method for playing a sound when the user completes a quest?

    Thanks!
    Mark
     
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Hi @jburfield - Yes. GUIRoot is a subclass of GUIControl,which is in the PixelCrushers.DialogueSystem.UnityGUI namespace, so it has a scaledRect property. (<-- All those links are to the API reference.) You can change scaledRect whenever you want. To make it take effect visually, call GUIRoot's ManualRefresh() method. Or, if you're changing a sub-control and not the entire root, call that control's Refresh() property. This will also recompute a property rect, which is the actual pixel rect that the control occupies within its parent control.

    Alternatively, if you just want to offset the control by some amount of pixels, you can just set the control's Offset property. For example, here's the SlideEffect script. It changes Offset in a coroutine to slide a control onscreen from one of the sides. Offset was just added as a convenience for those who don't want to fiddle with the entire ScaledRect.

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. namespace PixelCrushers.DialogueSystem.UnityGUI {
    5.  
    6.     /// <summary>
    7.     /// Applies a slide effect to the GUI control, making it slide onscreen from a direction.
    8.     /// </summary>
    9.     [AddComponentMenu("Dialogue System/UI/Unity GUI/Controls/Effects/Slide Effect (Unity GUI)")]
    10.     public class SlideEffect : GUIEffect {
    11.  
    12.         /// <summary>
    13.         /// Directions that the effect can slide from.
    14.         /// </summary>
    15.         public enum SlideDirection {
    16.             FromBottom,
    17.             FromTop,
    18.             FromLeft,
    19.             FromRight
    20.         }
    21.    
    22.         /// <summary>
    23.         /// The direction to slide from.
    24.         /// </summary>
    25.         public SlideDirection direction;
    26.    
    27.         /// <summary>
    28.         /// The duration over which to animate the slide.
    29.         /// </summary>
    30.         public float duration = 0.3f;
    31.    
    32.         private GUIControl control = null;
    33.    
    34.         /// <summary>
    35.         /// Play the slide effect.
    36.         /// </summary>
    37.         public override IEnumerator Play() {
    38.             control = GetComponent<GUIControl>();
    39.             if (control == null) yield break;
    40.             control.visible = false;
    41.             Rect rect = control.scaledRect.GetPixelRect();
    42.             float startTime = DialogueTime.time;
    43.             float endTime = startTime + duration;
    44.             while (DialogueTime.time < endTime) {
    45.                 float elapsed = DialogueTime.time - startTime;
    46.                 float progress = Mathf.Clamp(elapsed / duration, 0, 1);
    47.                 switch (direction) {
    48.                 case SlideDirection.FromBottom:
    49.                     control.Offset = new Vector2(0, (1 - progress) * (Screen.height - rect.y));
    50.                     break;
    51.                 case SlideDirection.FromTop:
    52.                     control.Offset = new Vector2(0, -(1 - progress) * (rect.y + rect.height));
    53.                     break;
    54.                 case SlideDirection.FromLeft:
    55.                     control.Offset = new Vector2(-(1 - progress) * (rect.x + rect.width), 0);
    56.                     break;
    57.                 case SlideDirection.FromRight:
    58.                     control.Offset = new Vector2((1 - progress) * (Screen.width - rect.x), 0);
    59.                     break;
    60.                 }
    61.                 control.visible = true;
    62.                 control.Refresh();
    63.                 yield return null;
    64.             }
    65.             control.Offset = Vector2.zero;
    66.             control.visible = true;
    67.             control.Refresh();
    68.         }
    69.     }
    70. }

    This has me stumped. Would you mind posting your Dialogue Manager GameObject's inspector, with the Camera Settings section expanded? Also please feel free to send an example project to tony (at) pixelcrushers.com. I'll be happy to take a look.

    First make sure the Camera Settings > Sequencer Camera field is unassigned. You only need to assign this if you want to activate and control a different camera during conversations -- for example, a "conversation" camera with heavy depth of field blur so only the participants are in focus.

    BTW, if you leave Default Player Sequence blank (the field below Default Sequence), it will use the value of Default Sequence.

    Could your conversation be using some Camera() commands in dialogue entry nodes' Sequence fields?

    Another tip - You can temporarily set the Dialogue Manager's Debug Level to Info. This will log a lot of info to the Console view, but you can skim through it for any lines that start with something like: "Dialogue System: Sequencer:...". Likely culprits would be anything with "Dialogue System: Sequencer: Camera()...".

    Long story short: As long as you don't have any Camera() commands in your conversation's dialogue entry nodes or in the Default Sequence, the Dialogue System should leave your camera untouched.

    If you use a Dialogue System Trigger to complete a quest (for example, OnTriggerEnter), expand the Action > Play Sequence section and set the sequence to something like:

    Audio(mySound)

    where mySound is a file inside a Resources folder. You can have as many Resources folders as you want in your project:
    • Quests/
      • Sounds/
        • Resources/
          • mySound
    • Combat/
      • Sounds/
        • Resources/
    • Lipsync/
      • Fred/
        • Resources/
      • Barney/
        • Resources/, etc.
    and you can also use subfolders inside any Resources folder:
    • Resources/
      • Quests/
        • mySound
      • Combat/, etc.
    In this case, you'd include the subfolder path in the Audio() command:

    Audio(Quests/mySound)

    Unity has a nice component-based design, so if you want to compose the activity out of separate components instead of using Dialogue System Trigger, you can add a Quest Trigger and a Sequence Trigger that fire on the same condition.

    If you complete the quest in a conversation, just use the Audio(mySound) command in the dialogue entry's Sequence field. One thing to be aware of with dialogue entries: they're shown for the duration of the sequence. That's why the default sequence is Delay({{end}}). This make the sequence simply delay long enough for the player to read the text. In practice, for that dialogue entry you'll probably want to set Sequence to something like:

    Audio(mySound); Delay({{end}})



    Regarding the Damage issue, at what point does the error occur? Do you know which script or component it's happening on?
     
  13. LOLinc

    LOLinc

    Joined:
    Nov 18, 2013
    Posts:
    28
    A-ha! Now it works a charm. Thank you so much :)
    Cheers
     
    hopeful likes this.
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Happy to help!
     
  15. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    Wow. This is freakin' awesome. Making this must have been an incredible amount of work.
    Tip o' the hat.

    The damage issue is a 'known problem' with the latest vp_FPplayerDamageHandler. I've had to work-around it since it no longer passed "damage" but "Damage" instead. Changing that one letter to caps in the script causes a ton of errors that stop the game from loading. Vision Punk is aware, but they don't seem too worried, since it only impacts none VP tools like RAIN-AI. VP has their own AI add-on, so little motivation to adapt it I guess. Maybe in a later version. <fingers=crossed>

    Mark
     
  16. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    484
    Sure. https://onedrive.live.com/redir?resid=A9EE87E68033BEB9!9906&authkey=!AJlOAgUpr2uo5bs&v=3&ithint=photo,PNG

    Here are her eyeballs. Funny, just noticed that it only happens with the MainMenu Window... When I choose Quest Log, she changes to 3rd person view, which is ok. Hmmmm.
    https://onedrive.live.com/redir?resid=A9EE87E68033BEB9!9905&authkey=!ABXzvMGXtO0F6NY&v=3&ithint=photo,PNG

    I wonder if she is moving into 3rd P-View, but the menu loads and stops all activity as the camera is pulling back, and stops inside her head....
     
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Hmm, your Dialogue Manager setup looks good, so I wonder if maybe some other script is causing the issue. Does it happen when you start a conversation with an NPC? Otherwise maybe it's getting triggered by the Escape key.

    That's a very Halloween-themed screenshot you linked. At least you're in good company with games like Assassin's Creed: ;)


    If nothing else, please feel free to send me an example project. If you need a place to upload it, let me know. I'll check back here first thing in the morning.


    BTW, if the UFPS "Damage" thing is causing any issues with your use of the Dialogue System, please let me know where it's breaking down. I'll get it fixed for you.
     
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Dialogue System 1.5.6.1 Patch 2015-10-14 Available

    A small patch is available on the Pixel Crushers customer download site. It updates the Selector component with the option of showing a "too far" alert message and/or invoking a custom event if the player tries to use a target that's out of range. It also updates the articy:draft converter to convert custom "Script" template properties to dialogue entry Script fields. (articy:draft users can still continue to put scripts in Pins and Instructions, too.) If you need access, please PM me your Asset Store invoice number.
     
  19. EpicIndustries

    EpicIndustries

    Joined:
    Sep 28, 2014
    Posts:
    32
    Hi there,

    Hopefully this is a quick one; at runtime the dialogue system seems to be creating a camera called "Sequencer Camera" which even includes an audio listener. My default sequence doesn't contain any camera commands or anything.

    I was wondering if there is anyway to stop this camera being created because it's affecting my game's performance. Currently as a hacky work around I'm just searching for the Game Object at runtime and deleting it myself, but that feels a bit dirty :)

    Many thanks!
     
  20. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Hi @EpicIndustries - Inspect your Dialogue Manager GameObject. If the Display Settings > Camera Settings > Sequencer Camera or Alternate Camera Object fields are assigned, unassign them. If that doesn't fix it, please let me know.
     
  21. EpicIndustries

    EpicIndustries

    Joined:
    Sep 28, 2014
    Posts:
    32
    They are both unassigned already, however if I actually assign my main camera, then the "Sequence Camera" no longer gets created at runtime, so I can remove my hack.

    That actually does solve my problem, but it's a bit strange that it's being created in the first place isn't it?

    Cheers
     
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Aha, thanks for posting that info. Your scene doesn't have a MainCamera. In this case, the Dialogue System creates a temporary one so it's ready to use in case it encounters any Camera() sequencer commands. We don't want to just grab any old camera in the scene because we don't know what it's being used for.

    In the next release, it'll log a warning message if it can't find a MainCamera.

    The solution is to do what you're doing or to tag a camera as MainCamera.
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Version 1.5.6.1 is now live on the Asset Store!

    An optional patch is also available on the Pixel Crushers customer download site. (PM me your Asset Store invoice number if you need access.) It contains:
    • Selector: optional alert message/event when trying to use a target out of range.
    • articy:draft Converter: Handles custom "Script" fields.
    • UFPS: Fixed cursor hiding in UFPS 1.5.0+.
     
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    The Pixel Crushers customer download site has an updated Unity UI support package. It adds a Queue Alerts checkbox to Unity UI Dialogue UI to show alert messages in sequence instead of new alerts immediately replacing old ones. It also has some improved handling for transition animations (e.g., fade panels in/out). PM me your Asset Store invoice number if you need access! :)
     
    hopeful likes this.
  25. EpicIndustries

    EpicIndustries

    Joined:
    Sep 28, 2014
    Posts:
    32
    I see. Upon adding the "Main Camera" tag to my camera (Something I was actually unaware of in Unity!) the issue is also resolved!

    Thanks so much for your prompt and helpful advice!
     
  26. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
    Apologies for the late reply, but grad school waits for no man! Anyway--see the attached image:

    DialogResponse.JPG

    This is what I have. Unfortunately, when I click "Play," (just to be absolutely clear, the Dialog Manager GameObject has a Conversation Trigger that triggers "On Start" and plays that dialog, with no assigned Actors or Conversants), I first get the "Hello!" dialog, it pauses for five seconds, then moves to the "What? Nothing to Say?" dialog, with no choice to pick anything in between.

    Any idea what could be the issue? Could it be the lacking Actor/Conversant assignment in the trigger, or something else?
     
  27. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Hi @EternalAmbiguity - Try removing the link arrow between "Hello!" and "What? Nothing to say?"

    The Dialogue System always gives preference to NPC lines. Since there's a link between these two, it will show "Hello!" and then always follow the NPC link to "What? Nothing to say?" instead of presenting a menu of player responses.

    By removing the link, it will show "Hello!" and then show a player response menu with the linked blue (player) nodes. If the player doesn't choose after 5 seconds, the GotoEntry() sequencer command will jump to entry 17 even though it's not linked.
     
    EternalAmbiguity likes this.
  28. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
    And it is solved. Many thanks.
     
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Glad to help!
     
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Hi @Tinjaw - Thanks for trying out the Dialogue System for Unity! Yes, many of the early, introductory tutorials are due for updates. I'm going to update them as soon as possible, starting with the quick start and overview tutorials. Most of the content is still the same, but there are a few superficial differences in menu names, and those early tutorials don't cover some of the newer features in the Dialogue System. (Also the sound quality was lousy in the earliest videos; later ones are much better.)

    In the meantime, I recommend following the 5-Minute Ultra-Quick Start Guide. It's also available as a PDF file in the main Assets/Dialogue System folder. And if you have any questions or get stuck on anything, please post here or email me directly at tony (at) pixelcrushers.com. I'll be happy to help!
     
  31. vivalavida

    vivalavida

    Joined:
    Feb 26, 2014
    Posts:
    85
    Hi TonyLi ,
    Newbie here, I'm using Rewired Input System, wanted to know which script is to be modified to take input.
    Couldn't find the .cs script for the Dialogue System Controller.
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Hi @vivalavida - The Dialogue System for Unity has a lot of source code. (Most of it's editor code, so it's not included in your builds.) To speed up compilation times, much of it is provided as a precompiled DLL, with the source code in a unitypackage in Assets/Dialogue System/Scripts. The How to Unpack the Source Code page explains how to import it.

    However, you don't need to do this. The Dialogue System is GUI system-independent. It provides a UI implementation for Unity UI in Assets/Dialogue System/Scripts/Supplemental/UI. This is separate from the source code unitypackage to make it easy for you to access.

    The only exceptions are the Cancel and Cancel Conversation input fields that you can set on the Dialogue Manager. If you're using Rewired, just set them to "None", and implement cancellation in Rewired if you want to.
     
    vivalavida likes this.
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Bolt Riley - Indie Prize Awards Winner

    Congratulations to Bolt Riley's Adventure Mob!

    Bolt Riley took the prizes for Best Game Audio and Best In Show: Audience Choice!



    Pre-order your copy of Bolt Riley here.

    Oded put together a nice post on his typical day of Chat Mapper - Dialogue System for Unity - Adventure Creator workflow here.
     
  34. Tinjaw

    Tinjaw

    Joined:
    Jan 9, 2014
    Posts:
    518
    Does Dialogue System for Unity work with the free version of Chat Mapper?

     
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Sorry, no. The free version of Chat Mapper doesn't have any export functionality. But you can download the free version and try it out to see if you prefer writing dialogue in Chat Mapper versus the Dialogue System's built-in editor. Chat Mapper is dedicated to writing dialogue, so it has a lot of nice advanced editing features. The one drawback of Chat Mapper is that it doesn't have a built-in editor for quests, so you'll edit them in the Items section.

    Other options are articy:draft (also a paid product) and the Neverwinter Nights 1 or 2 editors (which you can get for cheap on GoG).
     
  36. TopThreat

    TopThreat

    Joined:
    Aug 7, 2012
    Posts:
    136
    Hi, has anyone created an ingame journal where there is a notification icon on the screen when a message is added to the journal and then a button can be pressed to open it? I can imagine this may be something that many people would like to add to their projects.
     
  37. LOLinc

    LOLinc

    Joined:
    Nov 18, 2013
    Posts:
    28
    Greetings good people!

    I was wondering if there is a way not to reset a game object with a "Bark On Idle" component on it?
    I have a gameOBJ that barks through a bunch of barks sequentially, but every time the scene is loaded the sequential barking is reset, so that it starts from the top again instead of continuing to what ever bark that would be next in line from before the scene was (re)loaded.
    I tried different things, for example having the game object not being destroyed on loading the next, but the result was the same. I also tried making the barking gameOBJ a child of the Dialogue Manger so that it would not be destroyed and carried to the next scene, but upon loading the next scene, the "bark on idle" was reset just to start from the begging just the same... Any ideas?
    Thanks.

    Cheers
     
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Hi @LeeAllen - Sounds like a good idea! If you tackle this and want specific pointers regarding Dialogue System integration, let me know. You could register a Lua function to add messages to the journal. This way authors can add messages using conversations by using the Lua function in a dialogue entry's Script field.

    He @LOLinc. - There are two ways to do this:

    1. Just tie it into the Dialogue System's persistent data / save system.

    Bark On Idle and Bark Trigger are persistent data components. When they receive messages to record their state, they save the current bark index to the Lua field Actor["barkerName"].Bark_Index, where barkerName is the barker's GameObject name, or its Override Actor Name value if the barker has that component.

    Looking at the Feature Demo scene as an example, Sergeant Graves barks. If you save the game and skim through the save data logged to the Console, you should see something along the lines of:

    Actor["Sergeant_Graves"] = { Bark_Index=3, etc. }

    Bark_Index is recorded into Lua when saving a game. If your Dialogue Manager GameObject also has a Level Manager component, you can change levels using LevelManager.LoadLevel(). For example:
    Code (csharp):
    1. FindObjectOfType<LevelManager>().LoadLevel("Airlock");
    LevelManager.LoadLevel() tells the old scene to record its persistent data before changing to the new level.

    If you don't use a Level Manager, you can manually record the data before changing scenes by calling this static function:
    Code (csharp):
    1. PersistentDataManager.Record();

    2. Or, instead of using the built-in data persistence, you can use a Lua variable to keep track of which line to bark next. Use the Conditions and Script fields on each dialogue entry in your bark conversation.

    For example, say you define a Lua Number variable named "nextLine" with an initial value of 0. Set up your conversation like this:

    • START
      • "Where did you come from?" (Conditions: nextLine==0. Script: nextLine=1)
      • "Where did you go?" (Conditions: nextLine==1. Script: nextLine=2)
      • "Where did you come from," (Conditions: nextLine==2. Script: nextLine=3)
      • "Cotton-Eye Joe?" (Conditions: nextLine==3. Script: nextLine=4)
    (If I must have that song stuck in my head all day for some reason, I'm going to doom you all to the same fate. ;))

    I used shorthand for the Conditions and Script fields. They'll really look more like this:

    Conditions: Variable["nextLine"] == 0
     
  39. TopThreat

    TopThreat

    Joined:
    Aug 7, 2012
    Posts:
    136
    Hi Toni,

    (Re: Journal) - I looked at everything and it is beyond my skill level to make anything other than a hackish mess. If you were to sell something like this I would definitely buy it from you though :)

    Thanks,

    Lee
     
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    When I have a chance (after Quest Machine ships), I'll work on this as a free add-on for the Dialogue System. In the meantime, I plan to publish a free menu system add-on tomorrow after I get some final testing feedback. It's based on Unity's Game Jam Menu Template but adds slot-based saving and loading, ability to resume from the last save point, and access to the quest log window.
     
    hopeful and BackwoodsGaming like this.
  41. TopThreat

    TopThreat

    Joined:
    Aug 7, 2012
    Posts:
    136
    Wow thank you!!! Also, I look forward to Quest Machine. You make the best assets on the store!
     
  42. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
    I did make a personal journal the player can write in...but I don't think that's what's being talked about here (and it's not where it needs to be yet either).

    Anyway, I have a question. I'm given to understand that you can go from Chat Mapper to Unity, but can you go from Unity to Chat Mapper? For my first conversation I just went with the dialog editor in Unity, but if I want to send it to a friend who might do some voice work for me, I imagine a Chat Mapper file would be much more straightforward than them having to get Unity and buy the asset and open it there. Is it possible?
     
    Last edited: Oct 23, 2015
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Hi @EternalAmbiguity - Yes, see the Exporting XML to Chat Mapper documentation. The initial setup is very particular because you have to prepare a template Chat Mapper project with all the fields in your dialogue database. Steps are detailed in the documentation, and the exporter will tell you all the fields you need to define. But then you can import and export between the two as much as you want. Note that you need a paid version of Chat Mapper (Indie or Pro) to import and export. Chat Mapper can also export to Excel format and screenplay document format. Excel is a good format for voice work.

    If this is only for voice work, also consider using the Dialogue System's Voiceover Script CSV format. Instructions are here. This creates a spreadsheet that you can import into Excel, Google Sheets, etc. It also exports entrytags, which are useful if you have a lot of dialogue. If you use entrytags, ask your friend to name each audio file according to the entrytag.
     
  44. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
    Great, thanks. I'll take a look at that "Voiceover Script."
     
  45. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Dialogue System Menu Template

    The Dialogue System Extras page now has a menu template. It's based on Unity's Game Jam Menu Template and adds these features:
    • Save & load games into multiple slots
    • Continue from the last saved game
    • Access the quest log window
    It's designed to be dropped into your start scene. It works out of the box. Like the Game Jam Menu Template, you can customize the layout and textures however you want, and also hook in your own events.

    It's free, and it requires the Dialogue System for Unity and Unity's Game Jam Menu Template.

    See also: Documentation.
     
    BackwoodsGaming and hopeful like this.
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Dialogue System for Unity 1.5.6.1 Patch 2015-10-23 Available

    A patch for 1.5.6.1 is available on the Pixel Crushers customer download site. Please PM me your Asset Store invoice number for access.

    The patch contains:
    • [2015-10-23] Dialogue Editor Copy Conversation menu item renames additional copies as “…Copy 1”, “Copy 2”, etc. and leaves original node positions intact.
    • [2015-10-23] articy:draft Converter now properly handles articy 2.4’s portrait image filename changes.
    • [2015-10-17] New “Queue Alerts” checkbox added to Unity UI Dialogue UI to allow alerts to show in sequence instead of new alerts replacing old ones. Also includes some improvements to the way animation (e.g., fade in/out) is handled.
    • [2015-10-17] Selector only uses target if button is released on the same target on which it was clicked down.
    • [2015-10-14] Selector can now show an alert message and invoke a custom event when trying to use something that’s too far.
    • [2015-10-14] articy:draft Converter: If a dialogue fragment has a custom template property “Script”, it’s converted to a dialogue entry’s Script field.
    • [2015-10-14] UFPS: Fixed cursor hiding in UFPS 1.5.0+.
     
  47. Mr-Nixon

    Mr-Nixon

    Joined:
    Mar 30, 2013
    Posts:
    140
    Hi guys,

    Cold you help me: I need to set one of the NPC reply to be chosen randomly. How can I do that?

    I.e. (like it would be in NWN, where RND is the Condition with 1,2,3 cases, and 3 is the range of RND):

    PLAYER: Who’s there?
    NPC (RND 3of3): Get up, Commander. Quickly. You are in a critical state.
    NPC (RND 2of3): Get up, Commander! Don’t close your eyes!
    NPC (RND 1of3): Get up, Commander! You need to get up!
     
  48. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Hi @Mr.Nixon - You can use Lua's math.random function. Somewhere earlier in the conversation, use the function to record a random value. In the screenshot below, I set a Lua variable rnd in the START node:



    Then, at least two nodes later, add your conditions that check the value of rnd:



    You have to have at least one node between the Script and the Conditions in this case because nodes evaluate one level ahead. When the conversation is preparing to play "Who's there?", it will evaluate the links to the three gray nodes below it before running any Script that's on "Who's there?". (It has to do this to determine how to handle continue buttons and response menus.) If you were to set rnd in the "Who's there?" node, it would be too late. The Conditions on the three gray nodes below it would have already been evaluated beforehand.
     
  49. Mr-Nixon

    Mr-Nixon

    Joined:
    Mar 30, 2013
    Posts:
    140
    Thanks, TonyLi!
    That is the super fast support.

    May I ask another 2 questions concerned displaying default scene for dialogues testing?



    1. How can set off the typewriting view and effect so that the final screen above displays instantly (without forcing me to press ESC every-time)?

    2. Where can I set the resolution for the image of NPC to be displayed here (by default it scales such as you see above).
     
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Hi @Mr.Nixon - To turn off the typewriter effect, locate the NPC Subtitle Line and disable the Unity UI Typewriter Effect component. If you're using the default Dialogue Manager prefab, it's Dialogue Manager/Canvas/Generic Unity UI Dialogue UI/Dialogue Panel/NPC Subtitle Panel/NPC Subtitle Line.

    In the "Wake up, Commander!" dialogue entry node, the Sequence field is probably blank. This means it will use the Dialogue Manager's Camera Settings > Default Sequence. This is initially set to: Delay({{end}}), which delays for a duration based on the length of the text. You can adjust this duration in the Dialogue Manager's Subtitle Settings section.

    If you want all dialogue entries to immediately proceed to the next stage, set Default Sequence to: None()

    However, this means that if an NPC speaks two lines in a row, it will skip the first line and immediately move to the second line. To fix this, you can change the first dialogue entry's Sequence to Delay({{end}}). Or you can leave the Default Sequence at its initial value, and set specific dialogue entry sequences to None().

    Finally, check the Dialogue Manager's Continue Button mode. Try setting it to Never.

    It's in the Unity UI layout. Inspect Generic Unity UI Dialogue UI/Dialogue Panel/NPC Reminder Panel/NPC Reminder Portrait Image. Increase the Layout Element's Preferred Width and Preferred Height. If you haven't worked much with Unity UI yet, Unity's UI tutorials are very helpful.