Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

[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,774
    Hi Magicolo, you can do this as an effect or a subclass. It also depends on your GUI system -- e.g., Unity GUI, DF-GUI, NGUI, etc. -- as some GUI systems already come with several effects and features to do things like this.

    The Dialogue System comes with effects such as Fade, Slide, and Typewriter that you can attach to GUI objects. You can use one of those scripts as a template to write your own effect. I'm happy to provide help if you get stuck or have questions.

    You can also create a subclass of the dialogue UI class (e.g., UnityDialogueUI) if you want to do special processing before or after showing a subtitle, response menu, gameplay alert, etc. One team overrode ShowSubtitle() to dynamically change the subtitle's background image based on which NPC is speaking. Another overrode ShowResponses() to populate a scrolling list of responses rather than laying out each button individually on the screen. And another overrode the methods to kick off DF-GUI intro outro tweens that play expand and shrink animations.

    And if you just want to control the appearance of some dialogue text, such as changing the color, bold, or italic, you can use [em] tags.
     
    KWaldt likes this.
  2. BurningthumbStudios

    BurningthumbStudios

    Joined:
    Apr 28, 2008
    Posts:
    95
    Hey Guys,

    I'm having a problem with this. I want a conversation with the Player and two NPCs. But the dialog seems to "re-write" itself and the second NPC disappears from the conversation. Any idea about how to get a 3 person conversation to work ?
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Hi BurningThumb, where does the dialog "rewrite" itself? In the Dialogue Editor? (If so, are you using the node editor or the outline editor?) At runtime when the conversation is playing?
     
  4. dreamlarp

    dreamlarp

    Joined:
    Apr 22, 2011
    Posts:
    854
    We have been playing with the new update. The RPG 2 Kit and NGUI work great!!! Thanks TonyLi.
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Good to hear! If you have any additional feature requests for RPG Kit 2 integration, just let me know.
     
  6. Magicolo

    Magicolo

    Joined:
    May 8, 2014
    Posts:
    5


    Thanks for the tips. I've successfully integrated some custom effects by extending the GUIEffect class. I'd be willing to share my script for it to be available in the comunity scripts. Though, there might be some revision needed as I am not an experienced programmer.
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    That would be generous of you. If you don't mind posting them here or sending them to me, I could put them on the Pixel Crushers site for others to use.
     
  8. BurningthumbStudios

    BurningthumbStudios

    Joined:
    Apr 28, 2008
    Posts:
    95
    In the node editor. For example I have 3 Actors, Player, NPC1 and NPC2. I create a new conversation as follows:
    Player->NPC1, "Hi Guys"
    NPC1->Player, "Hi"
    NPC2->Player, "Hi"
    Player->NPC1, "What are you doing here?"
    NPC1->Player, "Just Chilling"
    NPC2->Player, "Having fun"

    It just gets messed up every time. Can you make such a simple 3 way conversation with this tool?

    Its like its not selecting newly created nodes. Also when I play the conversation, NPC1 is labeled as Player.

    OK, there are 2 bugs:

    1. When you create a new child node its not correctly selected in the editor.
    2. The first NPC is incorrectly identified as the player (not sure if it just a GUI bug).

    To work around the problems, after I create a new child I deselect and then select it. I also created a dummy NPC. So I have Player, Dummy, NPC1, NPC2, NPC3. So long as I never use the Dummy NPC it works.
     
    Last edited: May 9, 2014
  9. JohnSkyless

    JohnSkyless

    Joined:
    May 7, 2014
    Posts:
    2
    Hello!

    I'm having an issue properly bringing in my articy project to Unity. I have a feeling that the project in articy isn't set up right, and was wondering if there's a tutorial somewhere that shows how to properly set it up for Dialogue System since it -seems- to be set up correctly from a purely visual perspective. When I import it, all of the dialogue and actors are there, but all of the dialogue lines are orphaned. I feel like this is because there is not Conversant defined, and just the actor. I've included a picture for reference. Any help you would be able to give would be much appreciated. Thank you!

    $articy.png
     
  10. Magicolo

    Magicolo

    Joined:
    May 8, 2014
    Posts:
    5
    I trying to implement sizing animations using iTween, but I'm not sure where to get and set the size of the GUI elements. I've tried animating the FontSize, but because FontSize only takes integers as a size, the animation is not fluent.
     
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Hi BurningThumb, Your conversation should end up looking like this:
    $burning1.jpg

    The conversation properties should set the Actor=Player and Conversant=NPC1:
    $burning2.jpg

    For the Player lines, the dialogue entry properties should be:
    $burning3.jpg

    For NPC1's lines:
    $burning4.jpg

    And for NPC2's lines:
    $burning5.jpg

    Note that the first node coming off of START defaults to the Conversant (e.g., NPC1). In the screenshots above, I manually set it to Player to match the scenario you described.

    When you play a conversation, you can assign any characters to any role. The classic example is a generic villager or shopkeeper conversation. When the player talks to any shopkeeper in any town, you can use the same conversation, something like:

    SHOPKEEPER: "Hi! I'm [lua(Variable["Conversant"])]! Welcome to my shop."​

    In the dialogue database, if you've assigned the player as the Actor and NPC1 as the Conversant, make sure the trigger uses the same assignments.

    I'll be publishing a patch in a couple days that addresses some inconsistencies with selecting nodes. It should fix the issue you reported.
     
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Hi JohnSkyless, would you mind emailing a copy of the XML export, or preferably the articy:draft project, to tony (at) pixelcrushers (dot) com?

    What version of articy:draft are you using?

    Please also take a look at the example articy:draft project included in the Dialogue System in Assets/Dialogue System/Examples/Feature Demo/Articy Feature Demo. This folder contains a zip file that holds the original articy:draft project. It's an example of how to set up actors (entities) and conversations in articy.
     
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Hi Magicolo, the Unity GUI subsystem's controls use ScaledRects. Scaled rects allow you to specify anchors and sizes in pixels or normalized relative to the current screen resolution. If you change a GUIControl's scaled rect, set NeedToUpdateLayout = true to tell the GUI to recompute its actual screen rect in the next OnGUI call.

    The actual screen rect is stored in a traditional Rect named rect. Once you know it's been computed (after the first frame that it's visible), you could just iTween this rect if it's easier.
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Version 1.2.3 has been submitted to the Asset Store and is available for immediate download on the customer download site. If you need access, please PM me your invoice number.

    This version provides improvements to the Dialogue Editor and Unity GUI system. Controls can now have sound effects such as button clicks and hovers! But this release is primarily to provide updated integration packages for UFPS, RPG Kit, Adventure Creator, and plyGame, as well as introducing support for Game Logger.

    Version 1.2.3

    Dialogue Editor:
    • Added: Multiselect and drag or delete multiple nodes.
    • Added: Menu option to duplicate a dialogue entry.
    • Added: Import export templates.
    • Added: Apply Template button added to dialogue entry All Fields section.
    • Added: Copy paste dialogue entry fields.
    • Improved: When duplicating a node, the template is automatically applied to add any missing fields.
    • Improved: Clicking on stacked nodes selects the top one now.
    • Fixed: When creating a child node, the actor dropdowns now update to the new entry in the inspector.
    UIs Cutscenes:
    • Added: Configurable sounds for Unity GUI controls (e.g., button hover/clicked, typewriting effect).
    Third-Party Support:
    • (Game Logger) Integration support introduced in this version.
    • (UFPS) Updated for UFPS 1.4.7 and UFPS AI-Addon 1.4.7.
    • (plyGame): Now synchronizes Factions, Attributes, Skills, and Items to Lua.
    • (RPG Kit 2.0):
      - Added: Actor[].Class to Lua synchronization.
      - Added: Count parameter to Add/RemoveItem(itemName, count) sequencer commands.
      - Added: RPGKitOpenShop(), RPGKitOpenQuest() sequencer commands.
      - Added: ShopConversationAware drop-in replacement for Shop script.
    • (Adventure Creator):
      - Updated: For changes in Adventure Creator v1.32, including support for global local variables.
      - Updated: Example scene now includes a very simple quest.
      - Added: New "Run Lua" action.
     
  15. JohnSkyless

    JohnSkyless

    Joined:
    May 7, 2014
    Posts:
    2
    Thank you for the reply! I didn't realize that the example also had the sample articy project included, so I sent that over to the guy handling articy and he fixed the project to get it working correctly.
     
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    I'm glad it's working now! If it's convenient, could you please let me know what the issue was so I can add it to the FAQ? (And if you're busy actually working on your game now, don't worry about it! :))
     
  17. Mike-Lyman

    Mike-Lyman

    Joined:
    May 13, 2014
    Posts:
    2
    Hi Tony,

    Sorry if this has been answered already, but is it possible to run a script at the end of a conversation, based upon the choices the player made via their responses in the conversation?
    i.e. The player chooses to lie to an NPC during a conversation, so at the end of the conversation their "integrity" score is deducted by X points?
     
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Hi Mike, yes, you have your choice of solutions:
    1. Implement an OnConversationEnd() method in a script.Example:
      Code (csharp):
      1. void OnConversationEnd(Transform actor) {
      2.     playerStats.integrity -= DialogueLua.GetVariable("integityModifier");
      3. }
    2. In the last dialogue entry (or any entry for that matter), set a Lua variable in the Script field. Example:
      Code (csharp):
      1. Variable["integrity"] = Variable["integrity"] - 10
      Or register a C# function with Lua and call it in the Script field.
    3. In the last dialogue entry, call a custom sequencer command in the Sequence field. Example:
      Code (csharp):
      1. DeductIntegrity(9)
    The nice thing about #2 and #3 is that it's self-contained within the dialogue database.
     
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    If you've been waiting to update your installation of the Dialogue System for Unity directly from the Unity Asset Store, you can do it now! Version 1.2.3 is on the store.
     
  20. Mike-Lyman

    Mike-Lyman

    Joined:
    May 13, 2014
    Posts:
    2
    Tony,

    Thanks for the suggestions! Those options look great. Currently I am going with #1 but may move to #2 or #3 as I continue development.

    I have one other question, regarding the Conversation node view. If I make changes to a conversation in the editor and run the game, the changes don't take effect unless I close the Dialogue Editor window before running. This is really annoying because it causes me to lose my work if I forget to close the window each time, which is annoying in itself. Is there a better way to save changes to conversations?
     
  21. BurningthumbStudios

    BurningthumbStudios

    Joined:
    Apr 28, 2008
    Posts:
    95
    The latest update has fixed my issue with new child nodes not being properly selected!

    I have another issue with respect to actor portrait selection. Perhaps its because I am confused. I have two player portraits. PlayerHappy and PlayerSad. I have added both to the actor in the dialog database.

    $Screen Shot 2014-05-13 at 4.10.23 PM.png

    But I don't see any way to pick the portrait to display when the player speaks.

    I did find the Sequencer builtin SetPortrait, but it does not appear to take effect until the next conversation starts.

    $Screen Shot 2014-05-13 at 4.12.27 PM.png

    So my questions are:

    1. while I'm in a conversation, is there a way to change the player portrait that will be displayed the next time a line of dialog is displayed for the player?

    2. Is there some way to use the array of images I have assigned to the player to do that mid-conversation?

    3. What is the difference between the portrait array and the SetPortrait sequencer command?
     
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Hi Mike, sorry about that oversight. If you enable private messages or email me at tony (at) pixelcrushers.com, I'll be happy to send you access information for the customer download site where you can download a patch that fixes this.

    Also on the customer download site is a package of iTween effects for Unity GUI dialogue UIs written and generously donated by Dialogue System user magicolo. I'm told they're a work in progress, but even in their current state they add some nice "juice" to the appearance of dialogue UIs.
     
    Last edited: May 14, 2014
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Hi BurningThumb, portraits are a bit confusing because of their heritage from Chat Mapper. In Chat Mapper, you insert [pic=#] tags into the text. And you do the same thing in the Dialogue System, as described here. This changes the portrait image for the duration of that dialogue entry. So your dialogue entry might look like:

    Dialogue Text: [pic=2] Boy, I'm sad today....

    The SetPortrait() sequencer command is more useful to permanently change an actor's portrait, or to use an image that isn't in the actor's regular list of portrait images. But, as you wrote, the effect is delayed.

    Assigning an image mid-conversation is a great idea. I'll give some thought to changing SetPortrait() to do this. But for now it sounds like using the [pic=#] tag is the way to go for your purposes.
     
  24. BurningthumbStudios

    BurningthumbStudios

    Joined:
    Apr 28, 2008
    Posts:
    95
    I did try using [pic=#] but it does not seem to work. The displayed portrait does not change even when I include [pic=2] as the first part of the dialog entry.

    There is no console error, it just shows the original portrait.

    It seems so simple that I wonder if there is a bug in the current version of the package or if I have made some obvious error. Can you try it to confirm that its still working on the latest package?
     
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Sorry for the delay in responding, but I was testing this out thoroughly. Some things to check:

    On your dialogue UI script, make sure you've assigned your portrait image GUI control(s) to the Portrait Image field(s). If the dialogue UI doesn't know to use a GUI control for portrait images, it won't update the control with the correct portrait image.

    When the NPC is delivering a line, the NPC Portrait Image is shown.

    When the PC is delivering a line (only if Dialogue Manager > Show PC Subtitles During Line is ticked), the PC Portrait Image is shown.

    When the response menu is active:
    • If Response Menu > PC Image is assigned, it shows the PC portrait image.
    • If Response Menu > Subtitle Reminder > Portrait Image is assigned, it shows the NPC image - but Subtitle Reminder > Line must also be assigned. If you don't want to show a reminder of the line, just create an invisible control for it.
    The same rules apply for the PC/NPC Portrait Name fields.

    You can put [pic] tags anywhere in the Dialogue Text field.

    If you'd like to send an example unitypackage or project to tony (at) pixelcrushers.com, I'll be happy to take a look.
     
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    An updated support package for Adventure Creator 1.33b is now available for download on the Pixel Crushers customer download site. If you need access, please PM me your invoice number.

    This version has been thoroughly tested with Adventure Creator 1.33b. Up-to-date documentation is at: http://www.pixelcrushers.com/dialog.../integration.html#integrationAdventureCreator. (You may need to refresh your browser if you have an older cached copy.)
     
  27. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    The Adventure Creator Support package for Adventure Creator v1.33b has been rolled into a Dialogue System patch that's available on the customer download site. Please PM me your invoice number if you need access.

    Import this patch on top of your existing v1.2.3 installation. Contents:
    • Improved: The SetPortrait() sequencer command now takes immediate visual effect instead of waiting until the next dialogue entry.
    • Improved: Added special angle ‘original’ to the Camera() sequencer command. This is the original pre-conversation camera position.
    • Improved: When reconverting databases from third party authoring tools, the Dialogue Editor now automatically updates, too.
    • Fixed: The Dialogue Editor correctly saves changes to the open dialogue database when switching between edit and play mode in Unity.
    • Includes the updated support package for Adventure Creator v1.33b+ built 2014-05-15.
     
  28. vladimirdlc

    vladimirdlc

    Joined:
    Jan 26, 2013
    Posts:
    19
    I am making a 2d game using this plugin and ngui for handling the conversations.

    Does anyone have an idea of how to present the conversations in a similar way to the barks, with the dialog displaying above each interlocutor game object?

    I'm trying to make conversations but displaying them in speech bubbles instead of on a fixed position.
     
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Hi vladimirdlc, use this script (NGUIDialogueBarkUI.cs):
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System;
    4. using System.Collections;
    5. using System.Collections.Generic;
    6.  
    7. namespace PixelCrushers.DialogueSystem.NGUI {
    8.  
    9.     /// <summary>
    10.     /// This works just like NGUIDialogueUI except it uses the speaker's bark UI
    11.     /// instead of the dialogue UI's subtitle labels.
    12.     /// </summary>
    13.     public class NGUIDialogueBarkUI : NGUIDialogueUI {
    14.        
    15.         public override void ShowSubtitle(Subtitle subtitle) {
    16.             StartCoroutine(BarkController.Bark(subtitle));
    17.         }
    18.        
    19.     }
    20.  
    21. }
    22.  
    This is an interactive version that lets the player use the response menu. Subtitles (lines of dialogue) use the bark UI attached to the speaker. Make sure each participant in the conversation has a bark UI component.

    If the conversation doesn't use a response menu, you can use the built-in BarkDialogueUI instead (via Window > Dialogue System > Component > UI). The built-in BarkDialogueUI automatically chooses the first response instead of presenting a response menu.

    EDIT: To use NGUIDialogueBarkUI, just drag it onto the Script field of your existing NGUIDialogueUI to replace the script. Then unassign the Subtitle Reminder Line field since you don't need it any more. Steps shown here:
    $NGUIDialogueBarkUI.jpg
     
    Last edited: May 18, 2014
  30. vladimirdlc

    vladimirdlc

    Joined:
    Jan 26, 2013
    Posts:
    19
    Awesome, just what I needed!

    I just got the script working clumsily setting the NPC line reminder to 0px, but unassigning is a far better solution, thank you very much :D
     
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Happy to help! Feel free to post a screenshot of your game to this thread any time. It's always great to see what people are doing with the Dialogue System.
     
  32. vladimirdlc

    vladimirdlc

    Joined:
    Jan 26, 2013
    Posts:
    19
    Sure! Will do that, currently is just a rough prototype based on the Unity 2D Example, but when I get more artwork and be able to tweak the system to present the dialog in the comic style we want, I will post a pic around here.
     
  33. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    I am using Dialogue System v.1.2.3 , I am trying to use the Source Code version instead of dll one, but when I replace DialogueDatabase asset (e.g. Feature Demo.asset ) with DialogueDatabase.cs , all the serialized values is gone.
     
  34. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    I am very interested in this, but have one question.

    I noticed a feature included,

    Could anyone elaborate on that?




    I am anticipating that a lot of my text will actually be derived randomly, from a list of options.


    For example, a list of synonyms for the same word:
    Code (csharp):
    1.  
    2. //The NPC always says this.
    3. NPC: "I bow to you, [Variable] One."
    4. or:
    5. NPC: "I bow to you, " + VariableSynonym + " One."
    6.  
    7. //The word to use is determined Randomly.
    8. Synonym List: [Holy, Divine, Pure, Good, Perfect, Spiritual, Upright, Pious, Reverent, Saintly, Godly]
    9.  
    10. //This is an example of the Player talking to the NPC 4 times.
    11. NPC: "I bow to you, Holy One."
    12. NPC: "I bow to you, Divine One."
    13. NPC: "I bow to you, Pure One."
    14. NPC: "I bow to you, Pious One."

    I am wondering how easy it is to use the unity editor (Dialogue System Editor) to create dialogue trees based on these variables.


    1) Can Dialogue System create and hold a list of strings to use, or would I have to create my own TextAsset, load it, use a script to select a random string from an array, and then feed that variable into Dialogue System?

    2) Does Dialogue System have any of this functionality already? Something akin to typing as the text to display ""I bow to you, [Variable] One." and it knowing that [Variable] is one of several Synonyms?



    Right now, I am debating what is easier for me. I mean, I can simply create my own XML files for dialogue trees, and then simply use a script to output something like DisplayText(TextAsset dialogue4, string[] SynonymList6) or something just using scripts. However, Dialogue System looks pretty dang amazing. I just don't want to have to end up writing my own scripts ANYWAY, ending up not using or bypassing most of Dialogue System's features.
     
    Last edited: May 19, 2014
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Hi yuewahchan, I'm working on a new feature to automatically update the metadata when switching between the precompiled DLL and source code. I'll try to have it ready for the next release.

    Hi CarterG81, the Dialogue System's data (conversations, quests, actors, etc.) are accessible inside and outside conversations using Lua. Every dialogue entry can have a Lua condition that specifies when the entry is valid to use, and a Lua script that runs when the entry is spoken. For example, say you have a quest to turn in a book. The "turn in" entry for the quest giver might be:
    • Dialogue Text: "Thank you for returning my book!"
    • Condition: Variable["HasBook"] == true
    • Script: Quest["ReturnBook"].State = "success"
    Documentation: Lua

    The Dialogue System was built with this kind of functionality in mind. Just put a [lua] tag in your Dialogue Text.

    There are several ways to do this. You can use whichever one fits your needs best. If you want to define your synonym function in C#, you can register it with Lua using Lua.RegisterFunction(). Say you already have a C# function named GetHonorific(). Then your Dialogue Text would be:
    • Dialogue Text: "I bow to you, [lua(GetHonorific())] One."
    You may prefer to put the synonyms directly in the dialogue database asset. In this case, just add them as fields in, say, the actor it applies to. (You can add custom string, int, float, and Boolean fields to any dialogue database asset.) Then use Lua's math.random() function to choose one randomly.

    I like your idea of random synonyms. In the next version, targeted for release on May 26, I'll add a Lua function called RandomElement(). Then you could just add a variable named, for example, Honorifics containing the synonyms, and use this Dialogue Text:
    • Honorifics = "Holy, Divine, Pure, Good, Perfect, Spiritual, Upright, Pious, Reverent, Saintly, Godly"
    • Dialogue Text: "I bow to you, [lua(RandomElement(Variable["Honorifics"])] One."
     
  36. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    I want to intergrate my own quest system and quest UI, is there any approach to start with? My quest system will read the data form other data source.
     
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Hi yuewahchan, no problem; the Dialogue System won't get in your way.

    If you want to check and update quests inside conversations, here are some options:

    1. Register your own C# methods with Lua.
    Use Lua.RegisterFunction(). For example, say you have 2 C# functions called IsQuestComplete(string) and SetQuestComplete(string). If you register these with Lua, then your dialogue entries can use them:
    • Dialogue Text: "Thank you for returning my book!"
    • Condition: IsQuestComplete("ReturnBook")
    • Script: SetQuestComplete("ReturnBook")
    You can examine Scripts/Supplemental/Aurora/TemplateNWScript.cs for an example that registers a function named "NWScript()" with the Lua environment. Projects ported from BioWare's Neverwinter Nights use this.


    2. Copy the quest data into the Dialogue System's Lua environment.
    The third-party support packages do this by implementing OnConversationStart() and OnConversationEnd() methods.

    For example when the RPG Kit 2.0 "bridge" script receives OnConversationStart(), it copies the states of all RPG Kit 2.0 quests into the Lua Quest[] table. Then the conversations can work with Quest[] as normal. When the bridge receives OnConversationEnd(), it updates the states of all RPG Kit 2.0 quests using the values of the Quest[] table.


    3. Use a custom sequencer command.
    If you only need to set quest states (and not check them), you can write a custom sequencer command. For example:
    • Dialogue Text: "Thank you for returning my book!"
    • Sequence: SetQuestComplete(ReturnBook); Audio(Trumpet); Animation(Cheer)
     
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    CarterG81 (and other Dialogue System users who are interested), the function RandomElement() will be in the next release, and is available right now on the Pixel Crushers customer download page as a patch. (PM me your invoice number if you need access.)

    The documentation for it will be:

    RandomElement() Function

    The Dialogue System provides a Lua function RandomElement(). You can use this in combination with the [lua()] tag to insert a random element from a list into your dialogue text.

    The syntax of RandomElement is:

    RandomElement(string)​

    where string is a string of elements separated by the horizontal bar character ('|').


    RandomElement() Example

    Say you have an NPC that greets the character with a random honorific title. In your dialogue database, click on the Variables tab and define a variable named Honorifics that contains this list:

    Variable["Honorifics"] = "Esteemed|Revered|Great|Magnificent"​

    Then, in the dialogue entry, set the text to:

    Dialogue Text: Greetings, [lua(RandomElement(Variable["Honorifics"]))] One!​

    The result is that the NPC will randomly use one of the element in the Honorifics list, such as "Greetings, Esteemed One!" or "Greetings, Great One!"

    The source string doesn't have to be set at design time. You can generate it dynamically during gameplay. You can use RandomElement() for other purposes, too, such giving the player a random item upon completion of a quest, or even choosing a random quest out of a list.
     
  39. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    This is quite impressive, both in speed of implementation and in the extreme quality of your product. Very rarely do you find a designer who provides such high quality and polish in their product.
     
  40. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    Ohhhhh man! I am so excited! I just purchased this, and the enormous attention to detail, the high quality polish, and all the demo's and videos. It really makes me excited to implement my dialogue system.

    This is especially exciting, seeing as how the dialogue system is pretty much my entire game, lol.

    I am really beginning to love Unity's Asset Store. Although it is often risky to make a purchase (Honestly, I wish Unity had a refund/return policy for things which turned out to be different than expected, which is why I only buy things I'm 100% sure are great tools and will be useful. But many assets in the Store have no demo or Unity webplayer example, which is...to put it bluntly...laughable.) it is well worth the risk sometimes, especially when it turns out the product exceeds expectations.

    I purchased a tooltip asset for $2, but it saved me at LEAST an hour, up to who-knows-how-long. So worth it to not have to create your own plugin, mess around, experiment, test, debug, and blah blah blah otherwise do it all yourself.

    I bought this because of three reasons:

    #1 Primary Reason: Great reviews, overwhelming polish and quality, attention to detail, and feature list of this asset.
    #2 Primary Reason: Although I could easily make a dialogue system myself, why should I waste my time? This asset would save me tons of dev time, fulfills my wish to be a lazy dev by doing all the work for me, and gives me a vibrant dialogue system which exceeds anything I'd do myself. I mean, let's be realistic. This doesn't just save me time, it's probably better made than what I'd lazily rush together.

    #3 Minor Reason: The immediate update to do exactly what I asked if it could do. This is what pushed me over the edge of indecision, to buy it. A minor reason, but a good one none-the-less. It couldn't do it super easily, just regular easily, and now it can do it super easily. Just like that. Simply amazing.


    If it doesn't give away too much of my game, I will post screenshots in this thread and my WIP thread to show the dialogue system when it's near ready.
    Until then, I am excited to start work!
     
  41. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Hi CarterG81, thanks for supporting the Dialogue System! If you have any questions or other feature requests as you get into it, you know where to come. :) Thanks again for suggesting RandomElement(). I can imagine a lot of really cool uses for it, such as randomly assigning actors to certain quests based on the current state of the game.

    I'm also a huge fan of the Asset Store. (Reason #4 - lots of other developers bang on the product, finding bugs and smoothing out the workflow, making it better for everyone.) The Dialogue System provides integration packages for a lot of other products. They're all great for speeding up the development of your game, and chosen because they work well with the Dialogue System.
     
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    An updated Adventure Creator support package is available on the Pixel Crushers customer download site. It now synchronizes AC data to the Dialogue System’s Lua environment before Conversation actions start, rather than immediately after they start. This allows Lua conditions on conversations’ start nodes to access up-to-date AC data. If you need access to the download site, please PM me your invoice number. This package will also be included in the next full release on the Asset Store.
     
  43. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Can I check the Current Conversation Name in the Dialogue Entry Conditions ?
    e.g. if IsQuestComplete(Conversation[Current].Name)
     
  44. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Is it possible to override the builtin Sequencer Command ?
     
  45. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    I am making a demo similar to http://play.chatmapper.com/, choose one of the conversation in the dialogue database, and play , that's all.
    however, if I call DialogueManager.StartConversation without parameter of actor and conversant, In the conversation, it involve many different actors and a Sequence, Audio(XXX), but this throws warning of Dialogue System: Sequencer: Audio() command: subject is null.
     
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Hi yuewahchan, yes, you can do this with an extra step. The Dialogue System doesn't set a Lua variable to the name of the current conversation since it's normally assumed that you know the name of the conversation when you're writing it. It does set Variable["Actor"] and Variable["Conversant"] since these can be different depending on who triggers the conversation. I'm hesitant to add the conversation name to Lua automatically in all conversations because I want to keep conversation startups as lean and fast as possible.

    In the START node, you can set a variable using the Script field:
    Code (csharp):
    1.  
    2. Variable["ConversationName"] = "My Conversation"
    3.  
    Then you can reference this in later dialogue entry Conditions:
    Code (csharp):
    1.  
    2. Quest[Variable["ConversationName"]].State == "success"
    3.  
    Note that dialogue entry Conditions and Scripts use the Lua environment.

    Outside of conversations (i.e., in C# or UnityScript scripts), you can use DialogueManager.LastConversationStarted:
    Code (csharp):
    1.  
    2. if (QuestLog.IsQuestComplete(DialogueManager.LastConversationStarted)) { ... }
    3.  
    If you don't want to set the conversation name in the START node, you can add a small script to the Dialogue Manager that does this using OnConversationStart():
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using PixelCrushers.DialogueSystem;
    4.  
    5. public class RecordConversationName : MonoBehaviour {
    6.     public void OnConversationStart(Transform actor) {
    7.         DialogueLua.SetVariable("ConversationName", DialogueManager.LastConversationStarted);
    8.     }
    9. }
    10.  
    From your last post, it sounds like you already found out how to do this. Every dialogue entry has its own Sequence field. If you enter anything in the Sequence field, it overrides the default sequencer command. To change the default sequencer command, edit Dialogue Manager > Camera Settings > Default Sequence.

    Since you haven't specified default actor and conversant objects, the Dialogue Manager doesn't know whose AudioSource to use. You can manually specify it in the Audio() and AudioWait() commands. Say you've added an AudioSource to an object named "AudioManager". You can use this Sequence:
    Code (csharp):
    1.  
    2. Audio(beep, AudioManager)
    3.  
    The Dialogue System will use the AudioSource on the object named AudioManager. If it doesn't find an AudioSource, it will add one.

    AudioWait() is just like Audio() except it waits until the audio clip has finished playing.

    Note that "beep" must be located inside a Resources folder.
     
  47. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    What I mean for the builtin sequencer is not default sequence in display setting. For example, I would like to write my own Audio(xxx) to replace the builtin seq command.
     
  48. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Got it. In this case, create a custom sequencer command. Just make a copy of Scripts/Templates/SequencerCommandTemplate.cs and add your code where the comments indicate. Audio() is a reserved keyword (i.e., built-in command), so you'll have to use a different name such as AudioX() or MyAudio() or something like that. For example, copy SequencerCommandTemplate.cs to SequencerCommandAudioX.cs and add your code. The sequencer will automatically pick it up via reflection.
     
  49. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    For the builtin Audio Command, Audio(beep, AudioManager) is work, but it is too long for the writer to type in, can we have a Audio Settings in Dialogue System Controller to assign a default transform to be used or even a prefab of Audio Source to be used.
     
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,774
    Hi yuewahchan, good idea. In the next release, if the subject is null, the Audio() commands will use the Dialogue Manager object.