Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

[RELEASED] Dialogue System for Unity - easy conversations, quests, and more!

Discussion in 'Assets and Asset Store' started by TonyLi, Oct 12, 2013.

  1. Antigono

    Antigono

    Joined:
    Oct 20, 2013
    Posts:
    63
    Thanks for the reply, it is very clear now.
    Only I will have to look when a NPC is "talking" to execute the animation.

    thanks
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    Hi Antigono, I forgot to mention that barks also use dialogue entries, so they can have sequences, too.

    If you have any troubles setting up the animation, let me know how I can help.
     
  3. DieHappyGames

    DieHappyGames

    Joined:
    Feb 24, 2014
    Posts:
    44
    My bad luck that I gave the Once not carrying over as an example, because I'm having widespread issues with data not carrying over from scene to scene. Some more examples:
    - I have an endtable that you can search and acquire a key (which sets Variable["hasKey"] = true) but when I leave the scene and come back, it's false again.
    - I have an Actor with a series of barks that play out sequentially and I would think/hope that the Dialogue Manager remembers that position, but when I leave the scene and come back, the series starts again from the beginning.
    - On that same actor, once you've heard the last bark in the series, it disables itself (via the sequence SetEnabled(BarkTrigger, false, Picture Frame)) but if you leave the scene and come back, the barks start all over again.

    From all of these, it seems like the singleton nature of the Dialogue Manager isn't working / I'm not handling it properly. To test, I removed the Dialogue Manager from Scene2 and tracked the "hasKey" variable. Sure enough, it starts out false, becomes true when I acquire the key, and the true value carries over into Scene2, but when I return to Scene1, it's false again.

    It could be something else I'm missing, but it seems like in a normal singleton design, when the level loads (upon returning to Scene1), the Dialogue Manager in the Hierarchy should see that a version of itself (the original) already exists and destroy itself. Instead, the original Dialogue Manager (the one that knows "hasKey" is now true) is the one that's seeing an instance of Dialogue Manager already exists, and destroys itself instead, thus leaving a Dialogue Manager full of default values instead of the ones I wanted to carry over.

    Is there something I'm missing? Is the problem that the Dialogue Manager needs to never exist in the Hierarchy in the first place, but rather be instantiated when the game starts? Please help - between this and problems with Puppet2D, yesterday was 14hrs of frustration yielding zero results, and I can't handle another day of beating my head against the wall :confused:

    PS - for what it's worth, your documentation, tutorials, and support are waaaaaay better than Puppet2D ;)
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    Hi Dave, I've been putting together the dialogue databases and related assets for the multiple databases, multiple scenes video tutorial. I'm recording it today. I'll make sure it includes everything you described above.

    Actors with sequential barks don't currently remember their barks when they're reloaded. It's easy enough to retain this info, though, so I'll also try to get a patch out today that does that. Alternatively, you could sequence your barks by using a Lua variable, like the Three NPCs Bark example scene.
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    Dialogue System patch 1.1.9d is now available on the customer download site. You can import it over any version of 1.1.9[.x]. It adds:
    • New: Continue Button Fast Forward (two-stage typewriter effect skipahead) for Unity GUI.
    • Improved: Bark triggers now record current bark index in Lua (for sequential barkers).
    • Fixed: Gamepad navigation of Unity Dialogue UIs.
    • Fixed: Dialogue Manager loads conversations with incorrect IDs more robustly.
    • Fixed: Dialogue Manager > Allow Only One Instance destroys duplicates immediately so they can’t affect Lua.
    • Fixed: Custom sequencer cameras weren’t destroying themselves properly.

    Changes from 1.1.9c:
    • Sequentially-barking NPCs can remember their bark position between scene changes.
    • The Dialogue Manager object now works like a traditional singleton. (Duplicates were modifying Lua with their assigned database before destroying themselves.)

    DieHappyGames Dave, the changes in 1.1.9d and the tutorial below should address your issues with scene changes and saving/loading. If you come across any other issues or suggestions for enhancement, please let me know!

    [HR][/HR]

    Multiple Database Tutorial
    [video=youtube_share;lG-k10t3Dz4]http://youtu.be/lG-k10t3Dz4

    Assets for tutorial:
    http://pixelcrushers.com/dialogue_s...le_Databases_Tutorial_Assets_1_0.unitypackage
     
    Last edited: Mar 14, 2014
  6. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    I think someone mentioned in a review that he was using this asset for Inventory and a Shop system, but I don't see any such info in the documentation...

    Can you clarify if an Inventory and Shop system is built into the product, and does it work with In App Purchases? Thank you!
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    Hi eridani, no, these aren't built in. The Dialogue System is designed solely to provide AAA dialogue to your game. But a quick glance at the features will show you how much is required to do it right -- UIs; cutscenes for animation, audio, and camerawork; Lua for conditions, branching, and persistent data; QTEs; a quest system (since quests are often tied closely to dialogue); NPC relationships; importers for Chat Mapper, articy, and NWN; and more. It's already a huge product, with tens of thousands of lines of code and a large library of documentation and tutorials.

    A big focus is on integration support to make it as easy as possible to fit in with the other parts of your project. Some developers use Dialogue System features such as the open Lua environment to implement their inventory and shop systems. In fact, this is what's done in the included integration packages for Ultimate FPS, Realistics FPS, and plyGame (UniRPG 2)

    For inventory systems, you might look at Basic Inventory or Sleek Inventory. If you have any questions about getting them working with the Dialogue System, I can help. Just email me at tony (at) pixelcrushers (dot) com, PM me, or post on this forum thread any time.

    For in-app purchases, at this point in Unity's development it really depends on your platform. There are a lot products on the Asset Store. You should be able to find something that meets your requirements -- and again I can help with Dialogue System integration whenever necessary.
     
  8. dreamlarp

    dreamlarp

    Joined:
    Apr 22, 2011
    Posts:
    854
    @eridani

    We looked into this also just to see the extent that this app can be used. It can be done but as he said you would need to work with the lua commands, global variables and the ui system. You would only do this if you where using something like the UFPS kit witch does not have these features. But to save you a huge amount of time you might want to buy one of the inventory kits.
     
  9. Epictickle

    Epictickle

    Joined:
    Aug 12, 2012
    Posts:
    431
    I want to buy this.. But first a couple of questions:

    1. Will this package easily integrate with the KGFMapSystem? In short, all I want it to do is activate a minimap marker on my map system when a quest is started. I could do this myself, no problem, just asking if it would be possible to get some out-of-the box KGFMapSystem love.

    2. Does this dialogue system support audio? I'm planning on implementing full facial animations with audio into my dialogue system and it would be wonderful if this system could trigger animations and audio.

    3. Does this system have NPC-NPC dialogue love? Meaning, will NPC's be able to talk and interact with each-other. If one npc says something mean or disrespectful to another NPC can I trigger an event for the unloved NPC to kick the other one in the face? Or, if I have some bandit on the road asking a random NPC to pay a bullcrap passage fee, and the npc refuse, can I trigger said kick-in-face animation?

    Then, my final question, would it be possible to throw up a simple free forum on your website? I mean, I like you and all, you're a good dude.. And I could always use the mono-e-mono support form... But I can be pretty damn annoying at times, and sometimes it's just faster to get support and love from the community, especially when it comes to hurdles that they have already been through themselves.

    OOH, and cheez-its.... Could deffo use some cheez-it's right about now...
     
    Last edited: Mar 14, 2014
  10. Alarconte

    Alarconte

    Joined:
    Jan 8, 2014
    Posts:
    32
    I have some problems triggering barks, (to no see the barks from unlimited distance)

    BarkTrigger only has OnTriggerEnter, not OnTriggerStay; And thats what I need 'cause there has to work like Bark On Idle (multiple different barks over tiem)

    I know I can use Range Trigger with Bark On Idle, But I just don't know how to make work Range Trigger. I can set up the Bark On Idle as components in Range Trigger, but just that doesn't seem to work cause I don't know where to put the Range Trigger script.

    has to be Range Trigger a separate gameobject with a Trigger Collider?
    has to be in the Barker NPC with a Trigger Collider as for BarkTrigger?

    I'm trying different solutions but for the moment...

    I don't see a Trigger option in Bark On Idle (In documentation exists); It's not a 1.1.7 feature?
    (don't want to update right now if not needed)

    Thanks.
     
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    Hi, Epictickle, I'm a KGFMapSystem user myself, so I'll take a look into this. If anyone wants to do this kind of thing themselves, it's simply a matter of listening for OnQuestTrackingEnabled() messages.

    Yes, absolutely! I'll paste this from the FAQ:

    How do I add voice acting?

    The Dialogue System was originally developed for a voice-acted RPG, so support for voice acting is a core design feature. The Dialogue System doesn't analyze audio or generate lip sync animation. Use a tool such as FaceFX, iClone, or Mixamo's FacePlus for that. In the Dialogue System, you can associate a cutscene sequence with every line of dialogue. (If you're using localization, you can associate sequences for each language, too.)

    If you're using FaceFX's XML curves, just use the FaceFX() command.

    If you're using FacePlus, iClone, or another tool to generate FBX animations, how you use them in cutscene sequences depends on how you set up your avatar. Some developers set up a Humanoid Mecanim rig for the body and leave the face under Legacy animation control. In this case, use the Voice() sequencer command, which plays a legacy animation clip in conjunction with an audio (voiceover) file. Other developers put the face under Mecanim control, too, in which case you'll have an animation layer for the head. Simply use one of the many Mecanim sequencer commands, such as AnimatorPlay() or AnimatorTrigger(), to start the facial animation, and Audio() to start the voiceover audio.​

    Yes. You can have conversations with any number of actors, and the PC doesn't necessarily have to be involved. Conversations don't have to tie up the camera and controls, so they can happen in the background as the PC walks by, like the ambient conversations on The Citadel in Mass Effect. The Dialogue System also comes with a relationship and status system (the same one that's in Chat Mapper) so you can track and modify how NPCs feel about each other.

    To kick an NPC in the face, you'd use a cutscene sequence. Every dialogue entry (that is, a bark or a line in a conversation) can have an associated cutscene sequence.

    A lot of Dialogue System users subscribe to this Unity forum thread. I get instant notification of posts, and I try to reply as soon as possible. If you don't mind subscribing and posting here, you can get input from other users, and your questions may help them, too! You can also email me any time at tony (at) pixelcrushers (dot) com.

    Save some for me! :)

    Hi Alarconte, I recommend using Bark On Idle and Range Trigger. Bark On Idle doesn't have a trigger property because time is the trigger. When the random time interval occurs, the bark is triggered.

    Range Trigger uses a trigger collider. Since your NPC probably already has a collider, you should put Range Trigger on a child game object. Add a SphereCollider to this object, tick Is Trigger, and set the radius to the maximum distance that the NPC should bark. Then set the properties of Range Trigger to point to the NPC's Bark On Idle component.
     
  12. Epictickle

    Epictickle

    Joined:
    Aug 12, 2012
    Posts:
    431
    Thank you for your awesome, detailed answer!

    I shall buy this when I get my paycheck... After I get some cheez-its, of course. xP
     
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    You gotta have your priorities, after all! :)
     
  14. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Hi Tony, thanks for the quick response. Is there any reason you mentioned those specific inventory systems over more highly rated (and cheaper) inventory systems such as SquareBite Inventory or RPG Inventory C#? Are there integration issues with inventory systems other than the ones you mentioned? Thanks again!
     
  15. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    @dreamlarp

    Thanks dreamlarp. Do you have any experience integrating this system with an inventory system together with UFPS? Does UFPS at least have some basic inventory management of different weapons and ammunition types built in?
     
  16. dreamlarp

    dreamlarp

    Joined:
    Apr 22, 2011
    Posts:
    854
    I do. I wanted to see how many systems can be made with the dialog system and UFPS. If you watch the tutorial on making menu's it will give you a grasp on using the UI and lua. The ui choices can get values and save values.

    Extend that and you can make inventory, advancement systems or even a market system. Game are all values just think on the commands in the lua system and how they change values. With global variables you can pass these along to the character on any level. By the choices you make you can upgrade the characters damage, hit points ect.. Or even give and take from inventory.

    Just think it through to what you are looking to make and learn his system well. His tutorials alone should give you tons of ideas.
     
    Last edited: Mar 15, 2014
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    No reason. I just picked some randomly out of a Google search. SquareBite and RPG Inventory should be fine, too.

    Like dreamlarp writes (thanks, dreamlarp!), it's just a matter of writing a simple bridge script that synchronizes the inventory system's data with the Lua environment. Then your conversations can check the Lua environment to see what's in the inventory, and make changes to the Lua environment that get reflected back into the inventory. The guts of the bridges for UFPS and Realistic FPS Prefab amount to about 10 lines of code, with additional code to handle error cases and other niceties. If you run into any questions, I'm happy to provide assistance.
     
  18. DieHappyGames

    DieHappyGames

    Joined:
    Feb 24, 2014
    Posts:
    44
    Hey Tony, I'm still having problems getting my data to carry over properly. I can see when I activate something that barks, it's tracking the bark index, but then when I move into a different scene, I get a slew of errors relating to pretty much anything from the previous scene that has barks associated with it. Here's one such example:
    Dialogue System: Lua code 'Actor["Window"].Bark_Index = 0' threw exception '[string "chunk"]:1: attempt to index field 'Window' (a nil value)'

    Do I have to do something special to make so that the PersistentDataManager.Record(); recognizes the current bark state of all those interactables, or is there a component that needs to be attached to each of those barking gameobjects? I had thought that the idea was for the DialogueManager to be the mastermind keeping track of all that info, and then it simply traveled from scene to scene. What am I missing...?

    EDIT: In case it's relevant, the SetEnabled quality isn't carrying over either. On my picture frame interactable, there are 6 sequential barks that in theory the index of which should be remembered when you leave the scene and come back, but also, attached to the last line in the series is a sequence: SetEnabled(BarkTrigger, false, Picture Frame), which would permanently disable future barks. If I'm following the logic correctly, even if my bark index isn't carrying over properly, it's a separate issue that the SetEnabled state is returning to true upon returning to the scene. If that doesn't make sense, let me know and I'll email along with the project files.
     
    Last edited: Mar 15, 2014
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    Hi Dave, these are two separate issues. I'll address them individually.

    The error above means there isn't an actor named "Window" in the Lua Actor[] table. I have a few questions:
    • When you change scenes, are you removing any dialogue databases?
    • Do any dialogue databases contain an actor named "Window"? Which one? Is it being removed or added around the time of the error?
    • If this isn't the name you intended, what's the name of the actor in the dialogue database?
    • And the name of the GameObject? Is it an object in the new or old scene?
    • Are you using the Override Actor Name component?
    • What version of the Dialogue System are you using?
    • Which scene(s) contain Dialogue Manager objects? (Only the first instance will stick around; the others will destroy themselves immediately in Awake().)
    Sorry about bombarding you with questions. I think they'll help get you a resolution as quickly as possible by minimizing back-and-forth exchanges.

    You don't have to do anything special. Since you're savvy about Unity stuff in general, I'll describe how this part works under the hood. Maybe it'll shed some light.
    1. PersistentDataManager.Record() sends the message "OnRecordPersistentData" to every GameObject in the scene.
    2. BarkTrigger and BarkOnIdle handle the message by getting the actor name and then recording the bark index using the Lua command:
      Code (csharp):
      1. Actor["<actorname>"].Bark_Index = <index>
      If the GameObject or a child has an OverrideActorName component, it uses the name defined in that component. Otherwise it uses the name of the GameObject itself as the actor name.

    You're right. It's a separate issue. SetEnabled(BarkTrigger, false, Picture Frame) is equivalent to this C# code:
    Code (csharp):
    1. GameObject.Find("Picture Frame").GetComponent<BarkTrigger>().enabled = false;
    The sequencer command does more error checking, but that's the guts. Just as the code above isn't persistent across scene changes, the effect of the sequencer command isn't either. If you want it to be disabled when you return to the scene, you could set a Lua variable, and then run a sequence with trigger OnStart to set various components enabled or disabled. Or you could do that entirely outside the Lua/sequencer framework -- for example using C# code like above.

    Another approach is to put the BarkTrigger on a child object, and use the SetActive() sequencer command to disable that object. Then you can add a PersistentActiveData component to the main Picture Frame object, and set a condition on the child object.

    Please feel free to email the project files, or a download link, to tony (at) pixelcrushers (dot) com. I'll be happy to take a look.
     
  20. DieHappyGames

    DieHappyGames

    Joined:
    Feb 24, 2014
    Posts:
    44
    Will send a much longer reply soon, once I've thoroughly troubleshot based one the info you gave me, but before I forget: I would think you'd NOT want it to use the OverrideActorName but always go off of the "source" Actor used in the database. I presume two main uses of the OverrideActorName: where the database contains multiple Actors that are ostensibly the same person (ie. Bill_Good and Bill_Evil in the database, but that the player sees only as "Bill"); and instances where the dev needs and Actor name for obvious reasons, but doesn't want the player to see a name in conversation, perhaps because the player is interacting with an inanimate object, so the OverrideActorName is assigned a blankspace, rather than it looking like they're conversing with the coffee table, or what-have-you.

    Maybe I'm splitting hairs and none of this matters for how you've built it under the hood, but from the look of the "Actor["<actorname>"].Bark_Index = <index>" I would think that this function would break when dealing with duplicate actor names, regardless of whether it's in the database or the OverrideActorName...?
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    That's an interesting use case. I'm sure we can make it work, even if it requires a small update. The Dialogue System normally attempts to use the GameObject name, which allows multiple characters to share the same conversation (e.g., different shopkeepers using the same shopkeeper conversation). But sometimes the GameObject name isn't a valid actor name. For example, when you instantiate an enemy, the GameObject might be named "Enemy(Clone)". In this case, you'd use OverrideActorName to set the name to "Enemy".

    But totally I see your point, too, and I'll plan to make it easy to do in the next update.

    Right. Generally speaking, you shouldn't have duplicate actor names in the same database (or in the same set of loaded databases). In a sci-fi game, you can have an actor named "Enemy" on Planet X in database 1, and another actor named "Enemy" on Planet Y in database 2, since they presumably won't be loaded at the same time.
     
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    Last edited: Mar 17, 2014
  23. DieHappyGames

    DieHappyGames

    Joined:
    Feb 24, 2014
    Posts:
    44
    Okay, so for simplicity sake in troubleshooting, I disabled all conversants barkers apart from one: the one that has 6 sequential barks, with a sequence added to the last line, which disable's the bark trigger. I only have the one Dialogue Manager, one database (which the manager has set as the initial database) and just to avoid any possible complications, I've made sure that the gameobject and actor are both named PictureFrame.

    When I hit play, I listen to the first three barks and can see in the console that it's tracking the index. When I move to level2, the one error I get is:
    Dialogue System: Lua code 'Actor["Interaction_Indicator"].Bark_Index = 0' threw exception '[string "chunk"]:1: attempt to index field 'Interaction_Indicator' (a nil value)'

    Interaction Indicator is the gameobject attached to my player that's used for a few different things, including at one point as a custom-set conversant for barks in the pulldown, so that the bark lines would appear over the Player's head, rather than the centerpoint of the object with the trigger, but I've since then undone all of that as part of troubleshooting this, so for the life of me I don't know why that error is showing up. Regardless, to fix it, I went into the database and ADDED an actor "Interaction_Indicator", which makes the error go away, but the barks still don't save/restore as expected: after listening to the first three, I move to level2 then back to level1, and activate the picture frame, expecting it to bark the 4th line, but it's back to the beginning... :(

    I should be using the latest version, since it's tracking the bark index (1.1.9d I think) and the object that barks only exists in level1. One last detail, as if it wasn't weird enough already, I tried using the Lua console to track the bark index and upon returning to level 1, the console gives the correct value (either 2 or 3, I forget which) so you would expect that everything is working properly and when I activate the picture frame it would give the next bark in line, but it still goes back to the beginning...
     
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    Hi Dave, please try this example:
    View attachment $Sequential_Bark_Level_Persistence_2014-03-16_1130.unitypackage
    It contains two scenes (level1 level2) and an NPC named PictureFrame that barks "one", "two", "three", "four", "five". (It's actually the Sergeant Graves model; I used the levels from the multiple database tutorial as a base.) You may need to add level1 level2 to your build settings. Maybe this example contains a difference that will shed some light on the issue. When you start, the door to level2 is behind you. Make PictureFrame bark a couple times, go to level2 and back, and bark PictureFrame again. He should resume where he left off.


    This suggests that there's a BarkOnIdle or BarkTrigger component on Interaction Indicator. In the next release, OnRecord/ApplyPersistentData() doesn't attempt to set/get the bark index if the trigger is disabled. I don't think that will help in this case, though, since you say the entire GameObject is deactivated.

    Please set the Dialogue Manager's Debug Level to Info temporarily and reproduce the issue. You should see lines similar to this:
    Code (csharp):
    1.  
    2. // Dialogue System: Recording persistent data.
    3. // Dialogue System: Lua(Actor["PictureFrame"].Bark_Index = 2)
    4. //
    5. // Dialogue System: Applying persistent data from Lua environment.
    6. // Dialogue System: Lua(return Actor["PictureFrame"].Bark_Index)
    7. // barkHistory.index: 2
    8.  
    Although, from what you describe, I suspect that last line will be "barkHistory.index: 0". Also, if you want to send me an example project that demonstrates the issue, I can take a look at it.
     
  25. DieHappyGames

    DieHappyGames

    Joined:
    Feb 24, 2014
    Posts:
    44
    That's the weird part: Interaction Indicator contains nothing but a Transform and Sprite Renderer component and there are no script that add any other components to it :p
     
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    I bet it's set as the Conversant for a BarkTrigger. If the Conversant object is set, it uses that GameObject instead of the BarkTrigger's GameObject. This allows you to put a BarkTrigger anywhere -- for example on a trigger collider at the top of the basement stairs, which tells the serial killer NPC (the conversant) to bark to the detective "Don't go down there!"
     
  27. DieHappyGames

    DieHappyGames

    Joined:
    Feb 24, 2014
    Posts:
    44
    That would definitely explain it. Since I've been using DS to prototype a 2D adventure game, I've been using the bark system as a way for the player to inspect objects, and in the case of things like searchable containers, effectively "converse" with them. I've been creating Actors in the database for things like "picture frame" and "end table" for which the conversations/barks are made, and then on the gameobject with the bark component, I'll manually set the conversant in the pulldown menu to the Interaction Indicator, which is just an object parented above the player's head, so that the bark lines will appear there rather than in the middle of the object being investigated.

    If I could make a small feature request, it would be great if either the Bark Trigger or the Bark UI (whichever makes more sense) had a field for offsetting the position of the bark. Or instead of offsetting the bark position relative to the x,y,z of the object it's attached to, it could be an override position field that accepted a Transform - this would obviously be ideal for my use case, since I could just drag the Interaction Indicator onto that spot, but I'm not fussy - if float value offsets for x,y,z makes the most sense for mass-application, then go that route.
     
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    That's a good idea. Currently, it looks for a CharacterController or CapsuleCollider and positions the bark above it. I'll leave that as the fallback and add an optional transform that you can set for the position.

    Also -- and this is undocumented simply because I forgot to add a menu item and document it -- if you manually add a UnityBarkUIOnGUI to your barker, you can already specify an x,y,z offset. I'll add a menu item. The UnityBarkUI component adds one of these at runtime if it doesn't already exist.
     
    Last edited: Mar 16, 2014
  29. DieHappyGames

    DieHappyGames

    Joined:
    Feb 24, 2014
    Posts:
    44
    Thanks for your help, Tony - it's working now. Just a note on the way the BarkIndex currently tracks... I noticed that when I sequence of bark lines returns to the first line, the Index continues to climb, rather than resetting to 0, such that a given Bark line 3 of 6 in a series could have an index value of 2, 8, 14, 20, 26, etc to infinity. This would break developers' other scripts that depend on being able to check a given actor's current bark index for various applications. Maybe this was the only way you were able to do it, or you have plans for refining it, or maybe you deliberately chose this way for a reason I haven't considered, but just thought I'd point it out.

    I'll never stop saying it: thanks again for your diligent dedication to supporting your product - I may still only be in the prototyping phase, but it's been the most worthwhile expense in my game's development thus far. :)
     
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    Thanks; it's my pleasure! I want to see every customer's project succeed, and I'm grateful for your feedback and suggestions, which help make the Dialogue System better for everyone! My thinking on the bark index was that every time the NPC barks, it evaluates the current conditions of the dialogue entries. The list of valid entries could be longer or shorter each time. I didn't want to reset to 0 in case the next bark had a longer list of entries. But I agree that it's too confusing. In the next release, every time an NPC barks sequentially, it wraps based on the current number of valid entries. It also exposes a new property, BarkIndex, if you really want to set it to something higher manually, or if you want to read the value.
     
  31. DieHappyGames

    DieHappyGames

    Joined:
    Feb 24, 2014
    Posts:
    44
    Looking for clarification: to what extent (if any) can you use Chatmapper as your main dialogue writing tool, but still tweak things using the built-in dialogue editor? Is that really asking for trouble and if one is going to use Chatmapper then it must be used exclusively for any changes and then reimported via the tool?
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    The next major release (1.2.0) will include export to Chat Mapper, so you'll be able to go back and forth. In 1.1.9.1 (being released today) and earlier, if you tweak a database in the built-in editor, there's no automated way to bring those changes back into Chat Mapper. But you could always have some databases set aside for editing in the built-in editor and others using Chat Mapper if you're using multiple databases. Apart from the issue of bringing changes back into Chat Mapper, there's no problem tweaking a database that was converted from Chat Mapper. I do it all the time.
     
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    The Dialogue System for Unity version 1.1.9.1 is now available on the customer download page! If you need access (or if you'd like the 10% discount code for Chat Mapper), please PM me your invoice number. It should be available on the Unity Asset Store in 5-9 days.

    This release wraps up a handful of tweaks and bug fixes since 1.1.9. It also adds KGFMapSystem support. KGFMapSystem is a AAA-quality map system, and using it with the Dialogue System is very easy. The plyGame API changed in 2.0.9 beta, so this release also has an update for plyGame users.

    Version 1.1.9.1:
    • New: KGFMapSystem integration, KGFMapIcon() sequencer command.
    • New: Increment On Destroy script (useful for kill/gather quests).
    • Improved: Added Unity Dialogue UI Continue Button Fast Forward.
    • Improved: Bark triggers now record current bark index in Lua (for sequential barkers).
    • Improved: Added property to override position of NPC barks in Unity GUI NGUI (DFGUI TK2D already do this).
    • Changed: Bark index for sequential barks now wraps to zero at end of list of lines.
    • Fixed: DialogueManager > Allow Only One Instance now destroys duplicates immediately so they can't affect the Lua environment.
    • Fixed: Custom sequencer cameras weren't destroying themselves properly.
    • Fixed: Gamepad navigation bug.
    • (plyGame) Updated plyGame support package to handle changes in plyGame 2.0.9 beta.
     
  34. DieHappyGames

    DieHappyGames

    Joined:
    Feb 24, 2014
    Posts:
    44
    Big surprise: me again. Just wanted to share a recommendation after having watched the Quest tutorial. Don't know how tricky this would be to implement, and it doesn't have much relevance to my own project, but would probably be very useful to others: it would be very handy if the "Add Quest Entry" button, in addition to adding fields for the Entry state and description, added a "script" field in which the dev can add lua that will fire once when the Entry State goes from unassigned to active. It's purely an efficiency/organization thing, since often there are certain things that you consistently want to have happen when the stage advances (such as awarding XP or displaying an alert message) but various things in your game that can cause the stage to advance. Just a thought, from how I've seen stage systems work in other toolsets, like the GECK / Creation Kit.
     
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    Another great suggestion! I've added it to the list for 1.2.0.
     
  36. Alarconte

    Alarconte

    Joined:
    Jan 8, 2014
    Posts:
    32
    After I get in work with dialogs again, I found that (doing exactly as you told), the RangeTrigger is working as a TriggerOnEnter (or something), not TriggerStay ; When I enter the trigger the Barks work 1 time, and deactivates. I have to exit the trigger and enter again to see a new bark :/
     
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    Hi Alarconte, are you using BarkOnIdle or BarkTrigger? If you're using BarkTrigger, what is the trigger set to (e.g., OnUse)?

    Here's how RangeTrigger works:
    • Assign one or more GameObjects or components (e.g., BarkOnIdle) to RangeTrigger.
    • When RangeTrigger receives the OnTriggerEnter message, it activates these GameObjects and components.
    • When RangeTrigger received the OnTriggerExit message, it deactivated them.
    That's it. It's a very simple script. The source code is in Dialogue System/Scripts/Supplemental/Utility/RangeTrigger.cs.

    If you're using BarkOnIdle, then it should enable the BarkOnIdle component when you enter the trigger collider. BarkOnIdle should keep barking on whatever interval you've specified, until you leave the trigger collider.
     
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    I forgot to mention earlier that developers can already register their own C# methods with Quest State Observers. These methods get called when the quest state or quest entry state changes. In 1.2.0, when editing a quest in the Dialogue Editor, the Script and Entry_#_Script fields will automatically register those C# methods so you don't need to call QuestLog.AddQuestStateObserver() yourself.
     
  39. Alarconte

    Alarconte

    Joined:
    Jan 8, 2014
    Posts:
    32
    Yet, it actually works wrong. I'm using BarkOnIdle, the RangeTrigger activate the components and deactivate them, but after the first bark. I have to reenter de RangeTrigger collider.
     
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    Hi Alarconte, please take a look at this example scene: View attachment $Range_Trigger_Example.unitypackage
    $RangeTrigger.jpg
    I put a RangeTrigger around Sergeant Graves. The boundary is a semi-transparent sphere. When you cross into the boundary, Sergeant Graves repeatedly will bark every 1-2 seconds. When you leave the boundary, he'll stop.

    Do you want the NPC to keep barking even after the player leaves the RangeTrigger? If yes, then instead of a RangeTrigger I recommend this:
    1. Remove the RangeTrigger.
    2. Add a SequenceTrigger triggered by OnTriggerEnter.
    3. In the sequence, use SetEnabled() to enable the BarkOnIdle component. Example: SetEnabled(BarkOnIdle, true, Sergeant Graves)
     
  41. EDarkness

    EDarkness

    Joined:
    Feb 1, 2013
    Posts:
    506
    I have a couple of questions that you may be able to help me with.

    1. I want to have a trigger for when someone steps in an area, a specific NPC barks something. I figure this can be done, but I'm not sure what is the best way to do it.

    2. What's the best way to have two characters have a conversation via barks? So if a player steps into an area, another NPC in the area will strike up a conversation with them via barks.

    Thanks in advance.
     
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    Hi EDarkness, use a Bark Trigger. You can put it on any trigger collider. It doesn't have to be on the NPC itself. Assign the NPC to the Conversant field.

    • If you want two NPCs to have a conversation, you can run it as a conversation using a Conversation Trigger. So long as the dialogue entries' sequences don't control the camera, the player can continue to walk around and listen in. If you want the PC to be able to interrupt and start his own conversation, you'll want to stop the NPC-NPC conversation manually. The Dialogue System allows only one active conversation at a time; otherwise it would be chaos. :)
    • You can also use barks like the "Three NPCs Bark" example scene. The first NPC bark can be triggered by a Bark Trigger set to OnTriggerEnter. Subsequent barks can be triggered by Bark On Dialogue Event set to OnBarkEnd. As in the "Three NPCs Bark" example, you can use a Lua variable to keep track of which line to say next.
    • To bark at the PC, you can use bark triggers like the item above. The PC can respond by starting a conversation, or by "using" the NPC (e.g., with the Selector component) which could run a bark on the PC itself.
    • By stringing together triggers, you can also do a combination of any of the above.
     
  43. EDarkness

    EDarkness

    Joined:
    Feb 1, 2013
    Posts:
    506
    The issue I have is I want the PC to bark back. So basically, the NPC barks at the PC and the PC barks back. Ultimately, it's a quick exchange, but for some reason it isn't working. The first bark shows up on the NPC, but subsequent barks don't show up...even on the original NPC. What would I need to do to get this working?
     
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    Hi EDarkness, please try out this scene: View attachment $PC_NPC_Barks_Example.unitypackage

    On the Player and Sergeant Graves, I added a child object named Bark AI.

    On Sergeant Graves, it has a Bark Trigger and a Bark On Dialogue Event trigger.

    The Bark Trigger is set to OnTriggerEnter. It starts the bark exchange.

    Bark On Dialogue Event is set to OnBark. The On End section (meaning when it receives an OnBarkEnd message) is set to:
    • Condition > Accepted Game Objects: Player (i.e., only do this if the player just barked)
    • Speaker: Sergeant Graves, Listener: Player.
    • Conversation: PC-NPC Barks
    On the Player, there's only a Bark On Dialogue Event, set to:
    • Condition - Accepted Game Objects: Sergeant Graves (i.e., only do this if Sergeant Graves just barked)
    • Speaker: Player, Listener: Sergeant Graves
    • Conversation: PC-NPC Barks
    The dialogue database has a conversation named "PC-NPC Barks". The database defines a variable named barkLine that keeps track of which line to bark. These are used in the conditions on the lines in "PC-NPC Barks". You could just as easily make this a field in Actor["Sergeant Graves"] to tie it to a specific NPC. And this isn't the only way to do it, of course; it's up to how you want to handle which lines to show -- maybe checking the status of the weather, or how the war is going, etc.

    One gotcha is that barks are pulled from lines assigned to NPCs. So when you write your bark conversations, just use the NPC for all of the lines, even the ones spoken by the PC. In the next release, 1.2.0, you can assign the Player to bark lines. But this is really just a superficial issue.

    This is very similar to the way the Three NPCs Bark example works. The Bark Example between Private Hart and Sergeant Graves (one folder higher in the examples folders) uses two separate conversations, one for Hart and another for Graves. There are cases where you might want to do this, but I think it's generally easier to see the entire bark exchange in one conversation.
     
  45. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    A Dialogue System customer had a question about integrating with Realistic FPS Prefab. This short video tutorial demonstrates how to do it.
    [video=youtube_share;-WkokL4iBL8]http://youtu.be/-WkokL4iBL8
     
  46. EDarkness

    EDarkness

    Joined:
    Feb 1, 2013
    Posts:
    506
    Hmmm... Is there any way you can make this easier? Seems like a whole lot of work to do. I figured doing a simple bark conversation would be extremely easy, but there is basically no way this can easily work in my game...at least not without modifying your scripts. The way things are loaded in and out means that the BarkOnDialogueEvent scripts never have the PC's transform unless I add it or modify the script to add it in. Works great for the demo scene since all of the objects are there, but not the case in my own scene.

    If there was some way to pass them the PC's transform or let the script know that the PC is receiver of the bark that would be great. I can modify the code, but I'd prefer not to.

    *EDIT:* This is a lot more complicated than I was expecting. I didn't want to spend this much time messing around with this. Anyway, I got at least one character to bark, but he barks all of the lines and I have to leave the trigger area and come back for the conversation to advance. What could I be doing wrong? Mine looks the same as yours, so I'm confused as to why it's not working.
     
    Last edited: Mar 21, 2014
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    Just leave the property blank. It'll use the PC's transform automatically. Prompted by your earlier post, in 1.2.0 I've expanded the documentation on triggers, which was lacking detail. If a transform isn't specified in BarkTrigger or BarkOnDialogueEvent, it uses the transform of the triggering object. So if it's triggered by OnTriggerEnter, the actor is set to the object that entered the trigger collider. If it's triggered by OnUse, the actor is set to the object that sent the OnUse message. If it's triggered by OnBarkEnd, the actor is set to the actor that just finished barking.

    My example uses BarkTrigger (OnTriggerEnter) to start the barks, and then BarkOnDialogueEvent (OnBarkEnd) on both characters to handle the remaining barks. There's a condition on the BarkDialogueEvent so each character knows when to bark, since both the barker and the listener get OnBarkEnd messages.

    When you say that the character barks all of the lines, do you mean he says them all at once, rather than back and forth with the other character?

    What would be your ideal workflow for setting this up? I'll admit that when I first designed barks the intent was for one-off lines like "Hi! Nice weather, eh?" and "Cover me! I'm going in!". Developers, being an incredibly creative lot, are using sequences of barks for all kinds of things beyond the original intent. If there's a way I can make it easier to set up, I'll implement it.

    Also, please keep in mind that if you do want to write your own bark triggering/flow mechanism, the Dialogue System is nicely compartmentalized. Just call BarkController.Bark(); you can keep the same bark UI and everything else bark-related, and just replace the triggering stuff.
     
    Last edited: Mar 21, 2014
  48. EDarkness

    EDarkness

    Joined:
    Feb 1, 2013
    Posts:
    506
    Sounds good. I wasn't sure how that worked.


    I have mine setup the same way, and it still doesn't work like it's supposed to. I wonder if it's my database entry. Gonna play with that a bit. Also, does it matter where the trigger is? I have the trigger as a floor panel that the PC steps on, which triggers barks for the NPC in front.


    What happens is that the PC steps on the trigger plate, then the bark pops up over the head of the NPC. Everything stops until I step on the trigger plate again, which displays the next line on the NPC...not the PC. Rinse and repeat. The bark never shows up over the head of the PC for some reason.


    All I want is for conversations to be easily selected as simple bark conversations or as standard conversations. Not sure how you can make this work behind the scenes, but I would be grateful if it was done in a simpler way.

    I'll play around with this a bit today to see if I can make it work. Thanks for the help.
     
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    It sounds like the best solution is to run the conversation using the characters' bark UIs instead of the dialogue UI.

    This way, you just write a regular conversation and avoid that whole complicated chain of one-off barks. You can override the UI for any conversation. I'll put together an implementation of IDialogueUI today that uses the characters' bark UIs and put it on the customer download page. I'll include an example scene.
     
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    Okay, patch 1.1.9.1a is on the customer download page. Customers can import it on top of their existing 1.1.9.1 Dialogue System folder. This is an interim patch. The documentation hasn't been updated yet. It includes
    • New: BarkDialogueUI and Bark Conversation example scene.
    • Improved: Bark lines can now also come from PC dialogue entries.
    • New: Export to Chat Mapper XML (alpha feature)
    • Changed: Added Trackable field. Set to allow/disallow tracking. Continue to use Track to enable/disable tracking.
    In Examples/Bark Example/Bark Conversation, there's an example scene that runs a conversation using bark UIs.