Search Unity

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

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

  1. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Hi @Anderz - Portraits are stored as legacy Texture2D images in the dialogue database. To get a portrait, use DialogueDatabase.GetActor():
    Code (csharp):
    1. var portrait = DialogueManager.MasterDatabase.GetActor("Actor Name").portrait;
    DialogueManager.MasterDatabase is a reference to all the loaded dialogue databases. You can also provide an actor ID number (int) to GetActor. If you want to get at the alternate portrait images, reference alternatePortraits[] instead of portrait.

    You can display this using a Unity UI Raw Image. If you want to display it in an Image, convert it to a sprite using:
    Code (csharp):
    1. var sprite = UITools.CreateSprite(portrait);
    UITools.CreateSprite() caches converted textures, so you can call it as often as you want, and it won't create extra garbage.
     
  2. geraldsmallbear

    geraldsmallbear

    Joined:
    Jul 30, 2015
    Posts:
    19
    Hi Tony, Just started your Dialogue System tutorial - setting up an NPC.

    The box for "NPC has an interactive conversation" won't tick. It highlights, but that's all. Consequently I can't set that section up.
    The same happens in the next window (Barks - neither box will tick).
    Then "override Actor Name" ticks and everything thereafter works as normal.

    Unity 4.6.7, Windows 7. Also in project: Megawire, Ultimate Rope, Mesh Maker, Love/Hate, Object Master, ProCore, Terrain Toolkit, Ultimate Door Script.

    Also occurs in a new, empty project

    In the inspector it's adding a component every time I click the box - presumably the same stuff is in there as you have in the wizard window.

    Please take into consideration that all I know about dialogue systems is coming from your tutorial. I'm learning as I go.
     
    Last edited: Aug 5, 2015
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Hi @geraldsmallbear - I'll look into this and try to get you a definitive answer later today.

    In the meantime, on the previous screen (Select Dialogue Database) make sure a database is assigned. Add your conversation to this database so it'll be available in the dropdown menu. You can create an empty stub conversation for now.

    What version of the Dialogue System are you using? You can check the version by selecting menu item Window > Dialogue System > Help > About, or looking at the file Assets/Dialogue System/_README.txt.
     
  4. Daniko

    Daniko

    Joined:
    Mar 24, 2011
    Posts:
    16
    It seems the latest update to Adventure Creator has broken integration?
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Hi @Daniko - I'm working on it right now. I'll have a patch available by the end of the day.
     
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    @geraldsmallbear - I don't know how to reproduce the issue you described. Can you please provide reproduction steps and/or an example project? You can send the example project to tony (at) pixelcrushers.com.

    Alternatively, you can set up NPCs using the steps in How to Set Up NPCs to add and configure exactly the functionality you want on each NPC.
     
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Dialogue System 1.5.4 Beta 1 Available

    Beta version 1.5.4b1 is available on the Pixel Crushers customer download site. If you'd like access, please PM me your Asset Store invoice number.

    Barring any issues in the beta, official release of 1.5.4 is only awaiting an update to Opsive's Third Person Controller (TPC) that will enable the Dialogue System's integration package to save and load its inventory. The TPC update is due in the next few days.

    A few nice features coming in 1.5.4 are:
    • Dialogue System Trigger component, which can trigger any Dialogue System activity and can replace Conversation Trigger, Bark Trigger, Sequence Trigger, etc.

    • Some new Unity UI prefabs by artist Rob Hayes:
    Runic, a classic fantasy RPG UI:


    Mobile, a general-purpose mobile-oriented UI:

    Both sets include dialogue and alert UIs, quest log windows, quest tracker HUDs, and selector HUDs.


    UPGRADING: If upgrading from 1.5.2 or earlier, delete your old Dialogue System folder first. As always, back up your project before upgrading assets.


    Version 1.5.4b1
    Core

    • Added: Unity UIs: Runic, Mobile, JRPG2. Added Bundle UIs for Generic, Runic, and Mobile.
    • Added: DialogueSystemTrigger.
    • Added: Triggers can now fire on OnCollisionEnter/Exit.
    • Added: Dialogue Editor > Quests: Added Track On Start checkbox.
    • Improved: Dialogue Manager now automatically finds dialogue UI in children if Dialogue UI field is unassigned.
    • Improved: Sequencer command SendMessage() now has optional broadcast argument.
    • Improved: Quest state dropdown values are now lowercase to match Lua.
    • Changed: PersistentDestructible & IncrementOnDestroy only record destruction if component has been enabled.
    Third Party Support
    • Adventure Creator: Updated for AC 1.47.
    • articy:draft: Fixed bug converting articy:espresso variables whose names were subsets of other variable names.
    • Aurora/NWN: Now also imports custom variables from journals as well as dialogues.
    • NGUI: NGUITextFieldUI autofocuses UIText.
    • Realistic FPS Prefab: Fixed bug that caused player to take damage if saved game position was lower than scene start position.
     
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Dialogue System 1.5.4 Released!

    Same as above, with the addition of a few more features! It's available for immediate download on the Pixel Crushers customer download site. PM me your Unity Asset Store invoice number if you'd like access. It should be available on the Asset Store in a few days.


    Version 1.5.4
    • UPGRADING: If upgrading from 1.5.2 or earlier, delete your old Dialogue System folder first. As always, back up your project before upgrading assets.
    Core
    • Added: Unity UIs: Runic, Mobile, JRPG2. Added Bundle UIs for Generic, Runic, and Mobile.
    • Added: DialogueSystemTrigger.
    • Added: Triggers can now fire on OnCollisionEnter/Exit.
    • Added: Dialogue Editor > Quests: Added Track On Start checkbox.
    • Added: Lua function GetLocalizedText.
    • Improved: Dialogue Manager now automatically finds dialogue UI in children if Dialogue UI field is unassigned.
    • Improved: Sequencer command SendMessage() now has optional 'broadcast' argument, 'everyone' keyword.
    • Improved: Quest state dropdown values are now lowercase to match Lua.
    • Changed: PersistentDestructible & IncrementOnDestroy only record destruction if component has been enabled.
    Third Party Support
    • Adventure Creator: Updated for AC 1.47.
    • articy:draft: Fixed bug converting articy:espresso variables whose names were subsets of other variable names.
    • Aurora/NWN: Now also imports custom variables from journals as well as dialogues.
    • NGUI: NGUITextFieldUI autofocuses UIText.
    • Realistic FPS Prefab: Fixed bug that caused player to take damage if saved game position was lower than scene start position.
    • Third Person Controller: Added save system integration; updated for TPC 1.01.
     
  10. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,009
    Hey Tony :)

    Do you have any comments on organizing smaller quests into bigger groups of quests? I'm not 100% certain I need it, but maybe it could help me avoid some trial and error.

    I've peeked at the docs for quests before, but I haven't really gotten into using them yet. I realize you can set simple objectives for the player like an errand or "kill 10 rats," but are there any special considerations, special mechanisms, or a guide, for setting up larger groups of quests?

    Let's say, for example, I'm running a NWN type game, but instead of breaking it up into - say - five sequential chapters, it's more like a set of five individual stories that can be played in any order, and replayed as often as desired. I want each story to be entirely self-contained, with no quests hanging over from one to the other. Within each story I want to have maybe multiple serial scenarios - call them dungeon A, dungeon B, dungeon C - each with their own sets of objectives that get set as the player goes along (get the key, open the door, defeat the boss, etc.). And I want to set it up so that if the player wants to abandon a story and play a different one instead, then they abandon the current story - their progress is lost - and they start the new one.

    Structurally I'm aiming for having an "idle" state, then from there the player can choose to open one of many stories, and once a story is started, they go from scenario to scenario - with each scenario containing its own group of objectives - and then when the final scenario is completed, the story concludes, and it's back to the idle state.

    FWIW, I'm also thinking of taking that format and making it available at runtime to players, so they can compose their own stories.
     
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Hi @hopeful - Here are two ways to structure your quest data:

    Example 1: Keep all data in one dialogue database.
    • Dialogue Database
      • Global data: Common actors, variables, etc. that carry through the whole game.
      • Quest: Story 1 Dungeon A
        • Quest Entry: Story 1 Dungeon A Objective i
        • Quest Entry: Story 1 Dungeon A Objective ii
        • Quest Entry: Story 1 Dungeon A Objective iii
      • Quest: Story 1 - Dungeon B
        • ...
      • Quest: Story 2 - Dungeon A
        • ...
    Pros:
    • All of your quest data is available at design time in a single asset file.
    • All of your quest data is loaded at runtime, so you don't need to worry about loading data in and out of memory.
    Cons:
    • If you have a lot of quests, the list in the editor can get pretty long.

    Example 2: Put each story in its own dialogue database. Use another dialogue database to hold common data.
    • Dialogue Database: Global data
      • Common actors, variables, etc. that carry through the whole game.
    • Dialogue Database: Story 1
      • Quest: Dungeon A
        • Quest Entry: Dungeon A Objective i
        • Quest Entry: Dungeon A Objective ii
        • Quest Entry: Dungeon A Objective iii
      • Quest: Dungeon B
        • ...
      • Quest; Dungeon C
        • ...
    • Dialogue Database: Story 2
      • ...
    • Dialogue Database: Story 3
      • ...
    • Dialogue Database: Story 4
      • ...
    • Dialogue Database: Story 5
      • ...

    Pros:
    • Each story is self-contained in its own dialogue database asset file.
    • Only the active story's data is loaded in memory. This is actually not a big concern. Text data doesn't really consume much memory compared to textures and models.
    Cons:
    • You have to keep track of multiple asset files.
    • You have to ensure that internal ID numbers are unique across databases. You can use the Unique ID Tool for this. Also see Syncing Assets From Another Database to read about sharing data between databases.
    • You're responsible for loading and unloading each database as needed. You can use the Extra Databases component to help automate this.

    Quests & Quest Entries
    In either case, each quest can have any number of optional quest entries (objectives). (The term quest entry actually comes from Neverwinter Nights, since this feature was requested by developers porting their games from NWN to Unity.) Each quest entry has its own state -- unassigned, active, success, or failure -- and the quest as a whole has a state.

    It'll be up to you to reset quest states and quest entry states when appropriate (e.g., when the player abandons a quest or a story).


    Player-Generated Quests
    Internally, quest data is stored in the Dialogue System's Lua environment. (I'm going to post a cool use case for this later today.) To add a new quest at runtime, you just need to put it into the Lua environment's Quest[] table. The Dialogue System gives you several options:
    1. Use the QuestLog class in a script (e.g., QuestLog.AddQuest(...)).
    2. Manually add the quest using Lua code.
    3. Or create a new dialogue database and add it. You can even import a dialogue database at runtime from a Chat Mapper XML file:
    Code (csharp):
    1. var db = ChatMapperTools.Load(filename).ToDialogueDatabase();
    2. DialogueManager.AddDatabase(db);
     
    hopeful likes this.
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Dynamic Text in Quest Descriptions

    A developer asked how to modify a quest's description in the quest log window according to the way in which the player completed the quest. I thought I'd post a solution here. The Dialogue System's integrated Lua environment and custom fields offer a neat way to do this.

    The scenario was that a quest could be completed in 5 possible ways, from the best way to the worst way. Here are the steps to reflect this in the quest's description:

    1. In the quest, add 5 outcome text fields and a blank field named "None". They might look something like this:



    2. Add a text field named "Outcome". Set its value to "None".

    3. At the end of the "Description" field (or "Success Description" or "Failure Description", depending on when you want to display it), add this tag:

      [lua(Quest["your_quest"][Quest["your_quest"].Outcome])]

      where "your_quest" is the name of your quest (replacing blank spaces with underscores). In the screenshot below, the quest is named "Example Quest":



    4. When you set the quest state to success, also set the Outcome field to one of those 5 field names you defined:

      Lua Script: Quest["your_quest"].Outcome = "Best"

    When the quest log window displays the "Description" field, it evaluates all [lua(...)] tags. The tag in step #3 above returns the contents of one of those 5 outcome fields (the one that you named in the Outcome field). So the quest log will look like this:



    If you want to check how the quest ended, check Quest["your_quest"].Outcome:
    • Condition: Quest["your-quest"].Outcome == "Best"
    • Dialogue Text: "I see you're awesome at quests. Want another job?"

    If you're using language localization, you can use the GetLocalizedText() Lua function in your Lua tag, something like:

    [lua(GetLocalizedText("Quest", "your_quest", Quest["your_quest"].Outcome))]
     
    EDarkness likes this.
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Version 1.5.4 is now available on the Unity Asset Store!

    Coming next: An updated Oculus Rift example scene (and updated documentation) using Unity 5.1's new native VR support.
     
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Updated Oculus Rift VR Example Scene

    The Oculus Rift example scene has been updated for Unity 5.1.2's native VR support. You can download it from the Dialogue System Extras page. The online manual has also been updated with a page on Oculus support.
     
  16. EpicIndustries

    EpicIndustries

    Joined:
    Sep 28, 2014
    Posts:
    32
    Hi,

    Is there any way to access the id or title of the dialogue currently being spoken from a custom SequencerCommand?
    I'm trying to achieve a catch all crazytalk implementation to have crazy talk simple play with the id (or title) of the text currently being spoken in the dialogue system.
    While I'm at it, I also would like to know the name of the actor talking so I can select the right avatar to show.

    I could manually pass this information in for every dialogue entry, but I'd rather have a catch all set as the default sequence which does it automatically.

    Any help would be much appreciated, thankyou!
     
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Hi @EpicIndustries -

    You may want to use entrytags, which are documented in the How to Add Lipsync section.

    If that isn't what you're looking for, you can use the DialogueManager static class's CurrentConversationState property.
    Code (csharp):
    1. // Get the current conversation title, conversation ID, and dialogue entry ID:
    2. var currentDialogueEntry = DialogueManager.CurrentConversationState.subtitle.dialogueEntry;
    3. var dialogueEntryID = currentDialogueEntry.id;
    4. var conversationID = currentDialogueEntry.conversationID;
    5. var conversationTitle = DialogueManager.MasterDatabase.GetConversation(conversationID).Title;
    6.  
    7. // Get the name and transform of the speaker:
    8. var speakerInfo = DialogueManager.CurrentConversationState.subtitle.speakerInfo;
    9. var speakerName = speakerInfo.Name;
    10. var speakerTransform = speakerInfo.transform;
     
  18. EpicIndustries

    EpicIndustries

    Joined:
    Sep 28, 2014
    Posts:
    32
    Perfect, I was going about it the wrong way. This works great for me thankyou
     
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Happy to help!
     
  20. Anderz

    Anderz

    Joined:
    Dec 5, 2013
    Posts:
    24
    Hi Tony, Thanks for your help earlier with retrieving the actor picture.
    We have a new issue, this time with the SALSA integration. We're using the SALSA() entrytag for out audio, and it works well in most cases, except when we have two dialogue states directly after each other from the same actor (without a continue button). This causes the second state of dialogue to skip the audio and go straight to the response menu, or if there isn't one, jump straight to the next line unless we delay it. To mitigate this we've had to create blank dialogue states as spacers between back-to-back dialogue so the voice over will actually play through SALSA. This adds quite a bit of bloat to our often one-sided conversations, so I'm wondering: is this a bug, or are we doing something wrong?

    Thanks for your time!
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Hi @Anderz - Thanks for reporting this timing issue. It's fixed in an updated support package that you can download here: SALSA_Support_2015-08-16.unitypackage.
     
  22. Anderz

    Anderz

    Joined:
    Dec 5, 2013
    Posts:
    24
    Wow, incredibly quick support! The fix works a treat. Thank you so much!
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    My pleasure! Thanks again for letting me know about the bug.
     
  24. Xtense

    Xtense

    Joined:
    Feb 18, 2015
    Posts:
    34
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Hi @Xtense - That's a great idea. I'm going to record more video tutorials tomorrow, and I'll add this to the list. I'll post a link here tomorrow when it's ready.
     
  26. Xtense

    Xtense

    Joined:
    Feb 18, 2015
    Posts:
    34
    Thanks, can't wait! :)
     
  27. jburfield

    jburfield

    Joined:
    Aug 19, 2015
    Posts:
    8
    Hello.

    Is there a way to use the dialogue system to make a in-game tutorial for the player?

    Example: Press "W" to go forward, Press "E" to pickup an object, etc. Where the dialogue waits for the user to press the corresponding button before continuing?
     
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Hi @jburfield - Yes. The Examples folder contains several examples, including an in-game Tutorial Example.
     
  29. jburfield

    jburfield

    Joined:
    Aug 19, 2015
    Posts:
    8
    Ok cool, I figured it out. Didn't think to use the QTEs for a button tutorial.
     
  30. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,262
    Can i use this also with makinom?
     
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    That'll work, too. I like to use a conversation with sequencer commands that use the @Message() syntax to wait for a gameplay event to occur (as in the example scene).

    Makinom support is coming. If it doesn't make it into version 1.5.5, it'll be in 1.5.6 for sure.
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    New SALSA with RandomEyes Support Package Available

    Some of SALSA's example assets have new metadata in SALSA v1.3.3 (released yesterday). The Dialogue System's SALSA Support example scene needed to be updated to correctly reference the example assets. If you're using SALSA 1.3.3+ and want to play the example scene, you can download an updated support package here:

    SALSA_Support_2015-08-19.unitypackage
     
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Dialogue System for Unity - Localization



    @Xtense - If this tutorial doesn't cover what you're looking for, just let me know and I'll do my best to answer!
     
  34. jburfield

    jburfield

    Joined:
    Aug 19, 2015
    Posts:
    8
    So I've been trying to search for the solution to my next issue to no avail.

    What is the best way to get voice overs in the conversions? I won't have any face animations since in my game, there is no NPCs, only the player being talked to by an ominous voice, but there is on-screen dialogue. I tried using Voice() but it wants an animation component.

    Audio() skips the text dialogue but plays the audio. AudioWait() displays the text dialogue, and then plays the voice audio during the next dialogue.

    I'm adding these commands to the Sequence textbox for the dialogue entry.
     
  35. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    460
    Hi TonyLi,

    I have Dialogue System, but haven't delved into it yet.

    I just watched the localization video you posted above, and am wondering if there is support for runtime loading of a localization file. For example, if modders wanted to alter the text or translations, would Dialogue System's Localization system support that? Thanks.
     
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Hi @jburfield - AudioWait() should do exactly what you need. (The Voice() command is simply AudioWait() paired with an animation.) Let's see if we can get to the bottom of why the audio isn't playing until the next entry.

    What versions of Unity and the Dialogue System are you using? (Windows > Dialogue System > Help > About)

    Are you using any other audio products that might intercept and delay audio playback?

    Out of curiosity, what happens if you use a sequence like this:

    Audio(my-audio-file); Delay(5)

    This would only be as a test. I don't recommend it as a solution. In the sequence above, the Audio() command should play my-audio-file immediately. The Delay() command will tell the dialogue entry to stick around for 5 seconds to give the audio time to play.

    If you temporarily set the Dialogue Manager's Debug Level to Info, it will log a lot of information to the console. This might give you some insight into the sequencer commands that are running.

    Also please feel free to send your dialogue database or an example project to tony (at) pixelcrushers.com. I'll be happy to take a look.

    Hi @Korindian - Yes. You can convert Chat Mapper XML format into a dialogue database asset at runtime using ChatMapperTools.Load() and ChatMapperProject.ToDialogueDatabase(). Then you can load that database into memory using DialogueManager.AddDatabase(). If you don't want to use Chat Mapper XML format, you can use your own format, create a dialogue database asset manually, and add it.
     
  37. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    460
  38. jburfield

    jburfield

    Joined:
    Aug 19, 2015
    Posts:
    8
    Thanks for your help, I believe I found the issue. Your tip on setting the Debug Level to Info I think led me to figuring it out. I saw in the console that my NPC was saying the text, and after the text was finish displaying, it would then say my player was saying the same text (not displaying it) and it was playing the audio source.

    I believe my issue was that I had an audiosource on my player, and it was attaching the audio to the player and will play it after the dialogue in question was finished displaying, when I should have had the audiosource on the NPC gameobject. (maybe thinking the audio is a response to the text dialogue?)

    Anyway, I fixed it by removing the audio source from the player and putting it on the NPC.

    And just for your info, I have version 1.5.4.
     
  39. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Hmm, with Debug Level set to Info, it should report which GameObject it's looking for the AudioSource on. If you haven't specified a subject in the AudioWait() command, it'll use the current speaker. I'd think this would be the NPC, given your description. Sounds like you have it all in hand now, though. If you'd like to pursue the issue further, just let me know!
     
  40. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,262
    I read some posts here today and the one with the player generated quest sounds interesting.
    But somehow i do not understand it the right way i think.
    I understand what you explained, even the last part with the localisation but how is this then a player generated quest?

    I hoped to read about a way to include quests that a player can intergrate with another asset from the store wich let the player build levels inside the game and save these levels so that others can load them and play them.
    I know that here will be prooblems with the database and also with languages but as i read about what you wrote i thought i can maybe build some kind of placeholder database with some ingrediances so the player can at least can create some standard dialogues and or quests.
    Do you have an idear on how to integrate such another asset or how i can let the user use your asset in some way with his own created levels to at least explain the next player what he has to do in this level or much better make Real dialogues and quests?

    Edit:
    Do you also let makinom users use also the language feature?
    Makinom has a language solution so it would be good to know how i use yours if you feature it?
    Also will it then be better to use your save and load feature then makinoms?

    Then i read that you support a program to write the dialogues and i will look at this program too but i am also intterested wich format this program has to save to so it can be used with your asset.
    I use another program to write my storys called scrivener and it stores his text parts also in a database and can export to many formats so maybe i can use it to to help me with your asset.
    Maybe your featured program has some dialogue specialized options that scrivener do not have and then i have to think about to buy another program but i hope to have not so not split my workflow at the writing front into peaces.
     
    Last edited: Aug 22, 2015
  41. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Hi @RandAlThor - Player-generated quests are different from localization. They can work in hand-in-hand though.

    Yes, this is quite possible. My procedural quest generator, Quest Machine, has been in development forever as I continue to refine and simplify the process. It's not available yet, but I can share some insights gained from writing it. I'll first present the information. It's a bit overwhelming. Afterward, I'll simplify it to give you my recommendation.
    • There are several ways to create new quests:
      • In scripts: QuestLog.AddQuest()
      • In Lua: Quest["MyNewQuest"] = { Name="My Quest", Description="your-description"... }
      • Or create a dialogue database and use DialogueManager.AddDatabase(). You can create a database manually in code or by converting Chat Mapper XML format.
    • The [lua] markup tag is very powerful. In fact, the whole integrated Lua environment is what makes it work so well. Using the [lua] tag, you can write generic quest templates and fill them in with procedurally-generated content. For example, you can :
      • Set these Lua variables:
        • Quest["MyQuest1"].Amount = 5;
        • Quest["MyQuest1"].Target = "rats";
      • Create a generic "Kill Quest" conversation with entries like this:
        • Dialogue Text: "Hi, [lua(Actor["Player"].Name)]!
          I want you to kill [lua(Quest["MyQuest1"].Amount)] [lua(Quest["MyQuest1"].Target)].
          "
        • During gameplay, the [lua] tags will be replaced, like this:
          Dialogue Text: "Hi, Conan! I want you to kill 5 rats."
    I know that's a lot of dense information above. You can just hold onto it for reference. Below, I'll describe one way to add player-generated quests. It's still complicated, but you have to expect some complexity for what you're trying to do here. Just take it step by step.
    • The player will create a quest by adding a quest giver NPC to the scene. You will need to provide a way for the player to specify this information:
      • Quest description
      • Quest type (kill quest, fetch quest, etc.)
      • Target (for example, rats to kill or berries to harvest)
      • Amount (the amount to kill or harvest)
      • Reward
    • Add an Increment On Destroy component to all targets (rats, berries, etc.). Set the Variable to Increment to the same as the target name (e.g., "rats").
    • Create a quest. If you're using Makinom (support is coming soon), you'll probably want to use Makinom actions to do this. Use the quest giver's name for the name of the quest. Store Target, Amount, and Reward in the quest.
    • Create a generic conversation for each type of quest (kill quest, fetch quest, etc.).
      • In the START node, put this in the Script field:
        Script: quest = Quest[Variable["Conversant"]]
        This creates an alias "quest" to the NPC's quest to make the Lua code simpler.
      • Use the [lua] tag in your conversation, such as:
        • Dialogue Text: "Kill [lua(quest.Amount)] [lua(quest.Target)]."
      • You will need branches in the conversation that check the quest state, the Variable to Increment, etc.
    • Add a Conversation Trigger to the NPC that starts the appropriate generic conversation.
    Makinom integration isn't ready yet. I'm still working on it. The integration will let you use Makinom's language feature. You will still need to add your translations to the Dialogue System's dialogue database, but the Dialogue System will automatically switch to the language you've set in Makinom.

    The Dialogue System will tie into Makinom's save and load feature. They will work together.

    The Dialogue System doesn't support Scrivener, but it can import from these programs:
     
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Updated Action-RPG Starter Kit Support Package Available

    An updated Action-RPG Starter Kit support package is available on the Dialogue System Extras page. It contains:
    • A new component, “Persistent Player Spawner”. Add this component to your Dialogue Manager GameObject to better support teleporting between scenes.
    • An improved DSTeleporter that can be configured for OnTriggerEnter or OnUse.
    • A new sequencer command ARPGLoadLevel() that you can use to change scenes in conversations and during sequences.
     
  43. thedreamer

    thedreamer

    Joined:
    May 13, 2013
    Posts:
    218
    Are you making Quest Machine right now? I know that Quest Machine is another asset.. is it right?
     
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Yes, my primary development focus is on Quest Machine right now, along with support and smaller improvements to the Dialogue System and Love/Hate, such as Makinom support. Quest Machine will be a separate asset, but it integrates nicely with the Dialogue System and Love/Hate.
     
  45. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Dialogue System for Unity 1.5.5 Released!

    The Dialogue System 1.5.5 is now available on the Pixel Crushers customer download site. (PM me your Asset Store invoice number if you need access.) It should be available on the Asset Store in a few days!

    This release introduces support for RT-Voice, which uses your system's text-to-speech capability to generate audio. The Dialogue System, RT-Voice, and SALSA make it very easy to let your characters talk out loud with lipsync. If you plan to use voice actors, this is a great way to prototype your game before you've recorded them.



    Version 1.5.5
    Core
    • Added: entrytaglocal sequencer keyword (localized entrytag).
    • Added: OnBarkLine script message.
    • Improved: Added DialogueManager.LoadAsset(name,type) overload to specify type.
    • Changed: MoveTo() sequencer command now uses Rigidbody.MovePosition/Rotation if subject has rigidbody.
    • Changed: Dialogue System debugging (set via Dialogue Manager > Debug Level) now only logs in debug builds (Debug.isDebugBuild).
    • Fixed: Instantiated dialogue UI prefabs now set parent with Transform.SetParent(parent,false) to retain local transform settings.
    • Fixed: ProximitySelector now prevents click passthrough from previous conversation to trigger.
    • Fixed: VerificationError warning when playing hide animations on Unity UI dialogue UIs in webplayer builds.
    • Unity UI: Added Always Visible checkbox to subtitle panels; improved typewriter effect (can use any text alignment, can pause & unpause).
    Third Party Support
    • Action-RPG Starter Kit: Added Persistent Player Spawner component; improved DSTeleporter component with more options; added ARPGLoadLevel() sequencer command.
    • RT-Voice: Added support.
    • SALSA with RandomEyes: Fixed timing issue when two sequential lines play on same SALSA character.
    • S-Inventory: Updated for S-Inventory 1.27; can now transparently load from Resources or asset bundles; added Realistic FPS Prefab 2 Cameras example.
     
  46. Anderz

    Anderz

    Joined:
    Dec 5, 2013
    Posts:
    24
    Hi again Tony,
    We use the dialogue system in our educational sims to test the user with input fields and are facing a bit of an issue with logic. Basically, they must enter in the correct answer (variable) to continue. Here's how we achieve this:

    The question gets asked with an input field and the answer is checked against the "correctAnswer" variable using Lua conditions. This works fine. If it's correct, the conversation continues. If it's incorrect, we cycle through a generic "no, that's not right" snippet of dialouge, and return back to the same input field as before, where they must try again.

    The problem is if the user does not know the answer, they're stuck in an infinite loop. So we want to be able to have the conversation automatically branch to a different piece of dialogue on, say, the 3rd attempt at inputting an answer and getting it wrong. I tried to do this by adding a number variable that tracks the number of incorrect attempts, but there doesn't seem to be a sequence command to increment number variables, only set it. We could develop our own workaround for this or use playmaker, but that'd add bloat we'd rather not deal with given how common this interaction will be, and perhaps there's a different approach we haven't considered.

    Thanks again for all your help!

    EDIT: Nevermind! I just discovered we could increment the variable with Lua in the optional Lua field, and that has done the trick!
     
    Last edited: Aug 24, 2015
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    Hi @Anderz - You can use the Script field to increment a Lua variable using Lua code. You don't need to use a sequencer command for that.
     
  48. Anderz

    Anderz

    Joined:
    Dec 5, 2013
    Posts:
    24
    I literally just stumbled upon this in the documentation and tried to edit my original post to save face, but you beat me to it! Thanks again for your insanely quick support.
     
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,013
    It's all good! Happy to help!
     
  50. jburfield

    jburfield

    Joined:
    Aug 19, 2015
    Posts:
    8
    So, I didn't actually fixed my issue, I thought I did.

    So here is what I have:
    • I have an empty gameobject that is the "NPC" and a "Player" object that is just a capsule gameobject with an attached camera and arms (first person game).
    • The empty gameobject has an audio source for the voice overs, and the "Player" object doesn't have a audio source (the player never speaks).
    • The voice overs are 2D sounds (I think they are made 2D in Unity 5 by setting Spatial Blend to 0 or 2D)
    • The voice overs are in my resources folder in a sub folder called 'VoiceOvers'.
    • The scene I'm currently making is the tutorial for the game, so it's just straight dialogue to the player.
    • I have a conversion trigger that is set to 'On Start' attached to the empty gameobject NPC, with the Actor being the empty gameobject and the Actor being the player game object, and the 'Only Once' checkbox is checked.
    • I'm using for example: 'AudioWait(VoiceOver/speech_intro1)' for the first block of dialogue.
    • I've verified that all of my voice over files do exist, named correctly as I call them, and that they actually do have sound when played externally.
    What happens is: The dialogue displays, when transitioning between dialogues, a faint noise occurs, and after the last dialogue only that last dialogue's voice over is then actually played.

    I have the debug mode set to info and it shows the empty game object is saying the correct dialogue, and it says the Sequencer is playing the correct voice over. No errors or warnings, just the debug logs.

    Not sure what the issue is. I tried following the instructions at http://forum.unity3d.com/threads/re...s-quests-and-more.204752/page-22#post-1866899 in your reply to Keitaro3660 but your instructions is pretty much what I did.

    A second question I have is: Is there a way to hide the dialogue UI when pausing the game? I know of the DialogueManager.Pause() and DialogueManager.UnPause() methods, but is there a way to hide the UI as well? Right now, it stays on screen and stays over my pause menu UI. I'm using the legacy UI 'Sci-fi Dialogue UI'
     
unityunity