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. FrostedBrain

    FrostedBrain

    Joined:
    Sep 26, 2019
    Posts:
    31
    How can I remove specific trees so players don't see them twice?
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @FrostedBrain - You can either use a variable to record that the branch was shown:

    upload_2020-2-10_13-15-53.png

    Or you can use SimStatus:

    upload_2020-2-10_13-17-26.png

    upload_2020-2-10_13-19-59.png

    The caveat about SimStatus is that it saves data for every single node. If you have a huge amount of dialogue, it can amount to a lot of data. Then again, ZA/UM Studio used SimStatus in Disco Elysium, and that game has a lot of dialogue.
     
  3. DREBOTgamestudio

    DREBOTgamestudio

    Joined:
    Jan 30, 2018
    Posts:
    66
    Hello, i have some trouble with events. I have quest bring 3 skins. I would like to update the questEntry after collecting all the skins and change next questEntry on state active. Are there any built-in ways to implement the above?
    I dont use Condition Observer for this, becouse its resource intensive.

    Now, I implemented it like this(screenshots). But I think this is not the best solution. What can you recommend?
    Code (CSharp):
    1. public class Test : MonoBehaviour
    2. {
    3.     [VariablePopup] public string variablePopupAttribute;
    4.     [QuestPopup] public string questCondition;
    5.     public int entryNubmer = 0;
    6.     [QuestState] public QuestState questState;
    7.  
    8.     public void Check()
    9.     {
    10.         if (DialogueLua.GetVariable(variablePopupAttribute).AsInt >= 3)
    11.         {
    12.             QuestLog.SetQuestEntryState(questCondition, entryNubmer, questState);
    13.         }
    14.     }
    15. }
     

    Attached Files:

    • 1.PNG
      1.PNG
      File size:
      24.9 KB
      Views:
      387
    • 2.PNG
      2.PNG
      File size:
      43.3 KB
      Views:
      407
  4. DREBOTgamestudio

    DREBOTgamestudio

    Joined:
    Jan 30, 2018
    Posts:
    66
    And one more thing. I want to make an inventory. You have items, but I have not found examples of working with them anywhere. There is no way to add an item or change its status in actions. Why is this not? And why then objects if variables can be used instead? Can I add items during the game and track their addition?
    Now I add items like this (screenshot). It is right?

    Thanks for the incredible asset. This is a titanic work!
     

    Attached Files:

    • 3.PNG
      3.PNG
      File size:
      5.6 KB
      Views:
      395
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    You can do it without writing any scripts. This is similar to the "Kill Enemies" quest in DemoScene2. Each enemy has an Increment On Destroy component:

    upload_2020-2-12_20-30-20.png

    This component:
    • Increments a variable named "enemiesKilled".
    • Shows an alert message.
    • Runs DialogueSystemTrigger.OnUse on a separate GameObject named Enemies.

    The separate GameObject named Enemies has a Dialogue System Trigger that checks the value of enemiesKilled:

    upload_2020-2-12_20-31-48.png

    If the variable is >= 5, it sets the quest to success. In your case, you could set the current quest entry to success and set the next quest entry to active. You could either use 2 Dialogue System Triggers, or you could use 1 Dialogue System Trigger and set both entries' states with a Run Lua Code action. Use the "..." dropdown to select the quest entries so you don't have to type anything:

    upload_2020-2-12_20-42-16.png

    The Dialogue System doesn't include a full inventory system. The Item table in the dialogue database is really just a table of data fields. You can use it like in your screenshot and it will work fine. But if you need to present an inventory UI to the player, you will have to write it yourself or use a separate inventory system that has Dialogue System integration such as Inventory Engine or Inventory Pro. If you're using a framework such as Adventure Creator or ORK, the Dialogue System's integration also works with their inventory systems, too.

    Thanks! :)
     
    DREBOTgamestudio likes this.
  6. mickeyband

    mickeyband

    Joined:
    Dec 30, 2018
    Posts:
    16
    Hi, I'm using DIalogue System with TopDown Engine 2D. I'm trying to use the demo Scene included with the 3rd support package. It's giving me this error.


    Assets\Pixel Crushers\Dialogue System\Third Party Support\TopDown Engine Support\Scripts\DialogueSystemTopDownEventListener.cs(52,13): error CS0103: The name 'SaveLoadManager' does not exist in the current context

    Unity version. 2019.3.0f6

    It's strange because it was working fine on 2018.3.1.4f
     
    Last edited: Feb 16, 2020
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Please download and import the updated TopDown Engine Support package from the Dialogue System Extras page.

    TopDown Engine doesn't tell you, but when you download it from inside an older version of Unity, it delivers an older version of TopDown Engine. When you downloaded it from 2019.3, you got the latest version, which has an API change that's handled in the updated support package.
     
    mickeyband and DREBOTgamestudio like this.
  8. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    Hello,

    Im looking for ways to call a method from a script attached to the NPC Im talking with, so when I click a button I can call my own method. So far I have found SendMessage, is there any other alternative especially if I can somehow print out an error if that method doesnt exist?
     
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @skinwalker - You can write a sequencer command. If by "button" you mean a player response menu button, then in the sequencer command the "speaker" will be the player and the "listener" will be the NPC. The guts of the sequencer command could look something like this:
    Code (csharp):
    1. void Awake()
    2. {
    3.     var myScript = listener.GetComponent<MyScript>();
    4.     if (myScript == null) Debug.LogWarning("MyScript is not present on " + listener);
    5.     else myScript.MyMethod();
    6.     Stop();
    7. }
     
    skinwalker likes this.
  10. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    Okay I will give this a try, it needs to execute code that will open a vendor window (the vendor script attached to the npc currently speaking with). Its an end node so the dialogue will end there and I hope that sequence command has time to execute.
     
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Sounds good! That's how most of the integrations with assets that have vendors work. There's typically a sequencer command like "OpenShop()" that designers use on the last node of a conversation.
     
    skinwalker likes this.
  12. goutham12

    goutham12

    Joined:
    Jul 14, 2016
    Posts:
    53
    How can i Map Enter key to Continue button?
     
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Tick the Dialogue Manager's Input Device Manager > Always Auto Focus. This will make sure the continue button is selected (focused) by Unity UI's Event System. When you press the Event System's Submit input, it will click the currently-selected button. By default, the Submit input is mapped to Enter and Spacebar.
     
  14. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    Hello,

    I have been looking for a way to get rid of the Portrait Name in the RPG template, I dont want to use a name or icon for the npc talking, the problem is that I only found a way to get rid of the icon and the separator between the name and dalogue.
     
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @skinwalker - If you're talking about this:

    upload_2020-2-24_18-55-29.png

    then delete the dialogue UI's Dialogue Panel > Main Panel > Portrait Name field.

    If you're talking about this:

    upload_2020-2-24_18-56-41.png

    then inspect the Subtitle Panel Info GameObject's StandardUISubtitlePanel component and untick the Add Speaker Name checkbox.
     
    skinwalker likes this.
  16. goutham12

    goutham12

    Joined:
    Jul 14, 2016
    Posts:
    53
    I tried that it's not working. below am attaching the screenshots of input settings and input manager inspector.
     

    Attached Files:

  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    @goutham12 - While playing in the editor, keep the inspector on the EventSystem. When the conversation shows a subtitle panel, make sure the EventSystem has selected the continue button:

    upload_2020-2-25_8-28-28.png

    Also check that you've enabled continue button mode by setting the Dialogue Manager's Subtitle Settings > Continue Button dropdown to Always, and that you've actually added a continue button and assigned it to the subtitle panel.
     
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Gestalt: Steam & Cinder at PAX East

    At PAX East? Stop by the Metamorphosis Games / Sold Out Games booth and play Gestalt: Steam & Cinder, made with the Dialogue System for Unity and coming out this year on Switch, Xbox One, PS4, and Windows. It's a steampunk metroidvania RPG set in a huge, beautiful pixel art world.You can also wishlist it on Steam.

    upload_2020-2-27_7-50-48.png
     
    TeagansDad likes this.
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Gestalt's heroine is even there in person! ;-)

     
  20. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Lake at PAX East

    Also at PAX East: The first publicly playable demo of Gamious's Lake, made with the Dialogue System for Unity. Available to wishlist on Steam.

     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Disco Elysium - Meet Cuno: Behind the Voice

    Curious about voice acting in the Dialogue System for Unity? Here's a behind the scenes look of the voicing for the character Cuno:



    Studio ZA/UM used the Dialogue System for Unity with articy:draft to write their dialogue and handle voice acting.
     
    TeagansDad likes this.
  22. Deviarc

    Deviarc

    Joined:
    Sep 4, 2014
    Posts:
    24
    Hello, how can I know when an Variable has changed? Is there a easy way like a event subscription to it?

    Im using Variables to control when i'm giving Items to Player from NPC, im not using the DialogueSystem implementation of Item because i'm handling my own inventory system.
    So, when the NPC gives a Item, I change the variable from false to true, theres a specific UI that will inform the reward to player and the way to do this connection is not clear yet.

    Thanks!
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Deviarc - You can use a Condition Observer, which is a polling method, but it's better to register a C# method with the Dialogue System's Lua environment. This way you don't have to use a variable in the first place. In the dialogue entry node's Script field, just call your C# method to give the player an item. This is how it's done in the existing integrations, such as Inventory Pro and Inventory Engine.
     
    Deviarc likes this.
  24. DMRhodes

    DMRhodes

    Joined:
    May 21, 2015
    Posts:
    81
    I'm struggling with something I knew how to do but seem to have forgotten.

    I have the same 4 standard response options for every conversation in my game. For which I have made 4 images. How can I set it up so response(1) always shows Image(1) rather than response text inside of the response button? Response(2) = image(2), etc etc.

    Basically how do I get my response buttons to use images rather than text to describe their purpose in-game?

    Cheers
     
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Candy-Bomber - If they're always the same 4 buttons with same 4 images, you can deactivate the text label and assign the images to the buttons' Image components. Add your 4 buttons to the StandardUIMenuPanel's Buttons list. If you want to assign a node to a specific button, use the [position=#] markup tag. Otherwise it will use the buttons in the Buttons list in forward or reverse order depending on the Button Alignment dropdown.
     
    DMRhodes likes this.
  26. DMRhodes

    DMRhodes

    Joined:
    May 21, 2015
    Posts:
    81
    Thank you. That did the trick :)
     
  27. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Glad to help!
     
  28. Deviarc

    Deviarc

    Joined:
    Sep 4, 2014
    Posts:
    24
    Just gave it a try and damn, it works really well!
    Never saw a lua integration like this, this is really nice.

    Thanks for solving my problem!
     
    TonyLi likes this.
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    My pleasure!
     
  30. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @TonyLi What is the API method, or is there one, to save DS data and reload without it reloading the scene? I am trying to integrate with GKC save system and I want to be able to simply call DS and save its state whenever GKC saves and then to have DS reload its state when GKC loads. I tried calling the SaveSystem SaveGameToSlot and LoadGameFromSlot and it saves DS data fine, but when I have it do the LoadGameFromSlot it re-loads the scene also instead of just applying the saved states to the scene's game objects such as Position Savers.

    [EDIT]
    Also, I noticed that if I call LoadGameFromSlot that it works as described above, but if I first load the scene from GKC and try LoadGameFromSlot that it doesn't do anything at all. No scene load, no object updates either.
     
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @magique - Untick the Save System component's Save Current Scene checkbox. Then LoadGameFromSlot will not load a scene; it will just apply the save data found in the slot.

    This assumes you've set up the Dialogue System's save system components.

    If you haven't set it up, and if you only want to save the Dialogue System's Lua environment (i.e., variables and quest states), then you can call PersistentDataManager.GetSaveData() and PersistentDataManager.ApplySaveData(). This will only save the Lua environment to a string; it won't save the states of any "saver" components such as PositionSaver or ActiveSaver.
     
    magique likes this.
  32. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @TonyLi Is there something else that needs to be done after calling LoadGameFromSlot to make it work? I was sure that I successfully loaded at least once, but now when I call the function it doesn't do anything.

    [EDIT]
    And just after I said that I turned debug on and when I tried it and it worked fine. Not sure what was wrong before. If I see it again I'll let you know.

    [EDIT 2]
    Ok, so it seems hit or miss. I just tried again and this time the debug didn't print and nothing loaded. Not sure what's going on.

    [EDIT 3]
    I think maybe it's not DS. It might be GKC conflicting. I will check with GKC author. If both are saving to PlayerPrefs then maybe GKC is wiping out the DS saved data.
     
    Last edited: Mar 3, 2020
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    @magique - If GKC is being a little heavy-handed and wiping all PlayerPrefs, you can always get the DS save data as a string and let GKC save it. Instead of this:
    Code (csharp):
    1. SaveSystem.SaveToSlot(1);
    you can do something like this:
    Code (csharp):
    1. string s = SaveSystem.Serialize(SaveSystem.RecordSavedGameData());
    Then tell GKC to save string s.

    And instead of this:
    Code (csharp):
    1. SaveSystem.LoadFromSlot(1);
    you can get the string from GKC and do something like this:
    Code (csharp):
    1. SaveSystem.ApplySavedGameData(SaveSystem.Deserialize<SavedGameData>(s));
    Also, make sure your Dialogue Manager has a DialogueSystemSaver component.
     
  34. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    We worked it out. GKC was deleting PlayerPrefs unnecessarily and removing that fixed the issue. GKC author said it was fine to do it. Thanks for the help as always.
     
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Always happy to help!
     
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Disco Elysium Earns 7 BAFTA Nominations

    Congratulations to Studio ZA/UM for garnering a whopping 7 BAFTA awards nominations! Disco Elysium is made with the Dialogue System for Unity, and is nominated in these categories:

    Artistic Achievement
    Debut Game
    Game Design
    Music
    Narrative
    Original Property
    Best Game


     
    AGregori likes this.
  37. AGregori

    AGregori

    Joined:
    Dec 11, 2014
    Posts:
    527
    @TonyLi Hi there, the downloadable doc seems to be offline. Please re-enable it, it would be super helpful, thanks.

    Also, 7 BAFTA nominations for an indie Unity game is huge, especially how it was made using Dialogue System. Congrats!

    SumatraPDF_XbjhU2oH2K.png
     
    Last edited: Mar 5, 2020
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
  39. AGregori

    AGregori

    Joined:
    Dec 11, 2014
    Posts:
    527
    @TonyLi link works now, thanks. In the meantime I saved the entire dox site with HTTrack: it took almost an hour and the result is 100mb, but the html works as expected.
     
    TonyLi likes this.
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    The manual has a lot of screenshots. Even zipped, it's 77 MB.
     
  41. somosky

    somosky

    Joined:
    Feb 15, 2014
    Posts:
    138
    Hi I purchased your asset awhile ago but just getting around to trying it ou . Previously when making my own UI on the canvas I've always set the scale (sorry that might be the wrong name I'm doing this on my phone) to scale with screen size. The canvas on the dialogue manager prefab however does not have that option. I don't want to just add that to the prefab as I'm sure there's a good reason why it's not on there but how can I set my UI to scale with screen size without it using the dialogue system?
     
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    You can absolutely add a Canvas Scaler if you want. There's no problem doing that.
     
  43. mikemuk01

    mikemuk01

    Joined:
    Dec 1, 2016
    Posts:
    53
    Hi I am trying to use Adventure Creator with Dialogue System, using the latest version of Unity. I have imported the third party support package, and I am trying to add the Adventure Creator bridge. When I go to Component → Pixel Crushers → Dialogue System → there is no menu item for Third Party. How can I resolve this please?.
     
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @mikemuk01 - If there are any red compiler errors in the Console window, new components will not be available in the Component menu. If you're using Dialogue System version 2.2.4 (the current version) or earlier, please download and import the updated Adventure Creator Support package from the Dialogue System Extras page. A new version of Adventure Creator came out since DS version 2.2.4 was released, and it requires an update to the Adventure Creator support package.

    DS version 2.2.5 also contains the updated Adventure Creator Support package. This version should be available early next week.
     
    AGregori likes this.
  45. mikemuk01

    mikemuk01

    Joined:
    Dec 1, 2016
    Posts:
    53
    Thank you Tony. That solves the problem
     
    TonyLi likes this.
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Glad to help! :)
     
  47. Mixxy

    Mixxy

    Joined:
    Jan 13, 2016
    Posts:
    8
    Hello! Before I go messing around inside your code, I was wondering if dialogue system has functionality to instantly complete the current typewriter text on the first continue click, and then actually continue on the second click? I dug around for quite awhile last night but never saw anything like that in the documentation, but I could have missed it. Thanks!
     
  48. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Mixxy - Yes, that's the way the example prefabs that ship with the Dialogue System work. Add a StandardUIContinueButtonFastForward component to your continue button. Assign the subtitle text GameObject's typewriter effect. Then configure the continue button's OnClick() to call StandardUIContinueButtonFastForward.OnFastForward().
     
  49. mikemuk01

    mikemuk01

    Joined:
    Dec 1, 2016
    Posts:
    53
    Hi Tony, I am using the latest updates of Dialogue System and Adventure Creator, with Unity 2019.3.3. I have installed the Third Party support package and the Adventure Creator bridge and everything works fine except for one thing. When the NPC dialogue line appears, it is followed by the Player response but the cursor is locked in the middle of the screen so I cannot click on the Player response to move the conversation on. How can I resolve that problem please?
     
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @mikemuk01 - If you're using the Adventure Creator action "Third Party: Dialogue System Conversation", make sure the Adventure Creator Bridge's "Use Dialog State" dropdown is set to any value except for Never. This will put Adventure Creator in its Dialog State during conversations, which unlocks the mouse cursor.

    If the mouse cursor is still locked, some other component, such as another asset, is probably locking it.

    If you're using a Dialogue System Trigger to start the conversation, tick Show Cursor During Conversation. However, since you're using Adventure Creator the preferred method is to use the Adventure Creator "Third Party: Dialogue System Conversation" action since this lets Adventure Creator know what's going on.