Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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

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

  1. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Thanks man this asset is the best in terms of flexibility and immediate support!
     
    hopeful and TonyLi like this.
  2. JuliusIbidus

    JuliusIbidus

    Joined:
    Jun 3, 2018
    Posts:
    43
    Hello, I've been using Dialogue System with another character controller (GKC from the unity store) and they have been working together without a problem. However, I went over the tutorial about using the Camera Angle Editor and, after creating a new angle (I made a cube, called it Terminal and set an angle for it and saving the prefab) then closing the editor tab my scene (I had it docked on a second screen) there seems to be a problem with the main camera. When I play the scene I get 'Display 1 No cameras rendering' message, and the console shows the following error:

    Dialogue System: The scene is missing a camera tagged 'MainCamera'. The Selector may not behave the way you expect.
    UnityEngine.Debug:LogError(Object, Object)
    PixelCrushers.DialogueSystem.Selector:Start() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Interaction/Selector.cs:259)

    I have a Selector on the Player Controller of my player, and I don't see anything wrong with it. It's odd, this is the first camera problem I have had working between the two frameworks (DS and GKC). Any ideas where my error could be? Thanks in advance.
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    Hi @rlhalh - Try reloading your scene. It's possible that something might have happened when you were using the Camera Angle Editor that caused an issue with cameras. It sounds like no cameras are active. Make sure your camera is tagged MainCamera and that it's active and enabled. It's simplest if you don't assign a camera to Dialogue Manager's Camera & Cutscene Settings > Sequencer Camera. If you confirm that works and then you want to use a separate camera for conversations/sequences, you can assign one later.
     
  4. JuliusIbidus

    JuliusIbidus

    Joined:
    Jun 3, 2018
    Posts:
    43
    Many thanks for the reply. For some reason the camera that GKC sets up with the player controller became inactive during the process of editing camera angles. I set it back to active and it works just fine now. Odd little quirk. Thanks again for the help.
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    Glad to help!
     
  6. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Hi @TonyLi my quest is a collection quest. How can I get the item using a button? (For example evilas RPG pack or invector pickup method) instead of using box collider to trigger it. I tried using on use but it still doesn't update the collection counter and the game object doesn't disable
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    Hi - What kind of button? A UI button, an interactable button object in the scene, or something else?
     
  8. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    I created a prefab of a cube object and set it as the drop lootable gameobject and applied dialogue system trigger and increment on destroy and usable on it just like the one on the YouTube tutorial but instead of using a box collider and set it as a trigger to activate the increment on destroy and set the gameobject inactive, I want to use a button(for example letter 'e') just like when talking to NPC to trigger the increment on destroy and disable the gameobject
     
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    Got it. I'll assume you're using a Dialogue System Selector to interact with the cube. On the Selector, untick Broadcast To Children.

    Set up the cube like this:

    upload_2019-3-14_9-41-20.png

    Add an empty Child GameObject set up like this:

    upload_2019-3-14_9-41-36.png

    Note that I assigned the child GameObject to the cube's OnExecute() event, which calls its DialogueSystemTrigger.OnUse method.

    If you don't have the vGetItemCount() function, import the updated Invector Support package from the Dialogue System Extras page.
     
  10. jrackley

    jrackley

    Joined:
    Jan 26, 2017
    Posts:
    55
    Hello,
    I have a question on calling an animation event based on response. I have a large conversation put in, and I would like the character to play a different animation for different responses. I am looking at the 'on conversation line' event, but what I cannot figure out is how to tell it to play animation A on dialogue entry 20, or animation B on dialogue entry 5. Could you point me in the right direction?
     
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    What about using the response entry's Sequence field? (See Cutscene Sequences)

    Say you want the speaker to play animation A, which is an animator state in the speaker's animator controller. Set the Sequence field to:

    AnimatorPlayWait(A)

    If you want to play state A on the listener:

    AnimatorPlayWait(A,listener)

    There are other animation sequencer commands, too. AnimatorPlayWait() is a simple one to use. It plays an animator state and waits for it to finish.
     
  12. jrackley

    jrackley

    Joined:
    Jan 26, 2017
    Posts:
    55
    Thanks for the quick response once again! I did happen to find that in the docs after looking deeper into them as well. Should be perfect from there!
     
    TonyLi likes this.
  13. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Hi @TonyLi the tutorial you gave works but the message at the show alert dont work. I followed all the steps but the objective complete alert message at the show alert after the queststate is in success doest appear. And also how can I disable other ui in the background when starting a conversation and opening the quest journal?

    BTW what's the purpose of vgetitemcount() function?
     
    Last edited: Mar 15, 2019
  14. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    [EDIT] BTW I manage to find the solution on how to disable other ui when starting conversation but I still don't know how to disable other ui when I'm accessing the quest journal.
     
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    Hi @dinaloraven234 - If you're doing this during a conversation, you will need to tick the Dialogue Manager's Alert Settings > Allow Alerts During Conversations. By default, this is unticked, which doesn't allow alert messages to appear while a conversation is running. If that's not the problem, make sure your alert panel is visible. It's possible that its Rect Transform got changed so it's offscreen or something.

    It returns the amount of an item that the Invector player has. For example, you can use it to check if the player has completed a collection quest.

    The quest log window's Main Panel has a UI Panel component with two events: OnOpen() and OnClose(). In OnOpen(), hide the other UIs. In OnClose(), re-enable them.
     
  16. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Thanks for your response. What I want to do is that the alert objective complete will appear after you have collected the item, before talking to the NPC to deliver it. And also how can I remove items from the inventory? like for example I have collected the quest item and will report back to the NPC then I will give the item to the NPC then the item will be removed from my inventory.
     
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    If it's set up like my previous reply, the alert should appear. Check the alert UI elements to make sure they're positioned properly to be visible.

    I'll add a vRemoveItemByID() function in version 2.1.3.
     
  18. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Hi @TonyLi regarding camera closeup, is there a function that when you press the continue button it will change the camera to the listener like the Camera(Closeup,listener,1)@{{end}}. I tried this command but it will wait for the dialogue to finish.
     
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    Hi @dinaloraven234 - If I understand you correctly, use the required keyword. For example:
    Code (sequencer):
    1. Camera(Closeup,listener,1);
    2. required Camera(Closeup,listener)@1
    The first line moves the camera into a closeup of the listener over 1 second. The second command immediately moves the camera into a closeup at the 1-second mark. The required keyword guarantees that this command runs even if the player continues before 1 second has passed.
     
  20. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Hi @TonyLi thanks for all the responses you've given to answer all my questions and for the great customer support. If you don't mind will you make a simple shop system that can be integrated for invector? Evilas RPG pack is also great but it has a major bug and its kinda slowing my progress. I've addressed it to their forum but it they still haven't answered. The major bug I'm talking about is at first the shop system works but when my unity editor crashes and opens it again it doesn't work anymore. The way I've found to address this problem is by reimporting the whole asset and redoing the item list data which is kinda annoying and really slows my progress
     
    Weblox likes this.
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    Hi @dinaloraven234 - Shop and inventory systems are no simple task. I don't know if Inventory Pro and Invector integrate together, but if they do then that's an option you can look at.

    If you stick with EviLA's pack, you could try exporting the ItemListData files as unitypackages every once in a while to have them as backups. When things go bad, try reimporting them from the unitypackage. Or, better yet, use version control and revert to a version that was working correctly.
     
  22. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    I have an idea on how I can create a shop system but using dialogues using the vAddItemByID. I'm just waiting for the vRemoveItemByID in your next release to add and remove items using the dialogue system
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    No need to wait. You can download the Invector Support package from the Extras page right now. The format of vRemoveItemByID is:

    vRemoveItemByID( itemID:int, amount:int )​

    Example:

    vRemoveItemByID(3, 1)​

    (Removes one sword.)
     
  24. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Thank you @TonyLi I'm gonna create a text based shop system instead of evilas RPG pack until the author fixes the bug
     
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    Sounds good. If you want vendors' dialogue UIs to look different (e.g., themed like a shop), you can add an Override Dialogue UI component to the vendor and assign a different dialogue UI.
     
  26. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Hi @TonyLi thanks for the tip. What Lua function will I use to take input from the user(example a number) then instead of assigning a value in vAddItemByID I'll use the input given by the user. Like this: vAddItemByID(3,(input of the user), true).
    And how to multiply that input when I use the vRemoveItemByID. Example(vRemoveItemByID(3,20) * (input of the user) I'll use this logic for the removing of currency to simulate that I bought the item from the shop and reduce my gold amount
     
  27. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    Hi @dinaloraven234 - Use the TextInput() sequencer command. Set up a text field UI that only accepts numeric input. If you're not using the dialogue UI's default text field UI for anything else, you can simply inspect its InputField child GameObject and set the Content Type to Integer Number. This will store the player's input in a Lua variable. For example, let's say you use this command:
    • Dialogue Text: "How many swords would you like to buy?"
    • Sequence: TextInput(Text Field UI, Amount:, quantity)
    This will use the text field UI named "Text Field UI", show the label "Amount:" in front of it, and store the player's input in a Lua variable named "quantity".

    Let's say the player's gold is stored in a Lua variable named "gold".

    If the player buys swords that are 8 gold each, use this Lua in the following node's Script field:
    • Script:
      Code (Lua):
      1. vAddItemByID(3, Variable["quantity"], false)
      2. Variable["gold"] = Variable["gold"] - (8 * Variable["quantity"])
      3. ShowAlert("Bought "..Variable["quantity"].." swords.")
    If the player sells swords for only 4 gold each, use something like this in the Script field:
    • Script:
      Code (Lua):
      1. vRemoveItemByID(3, Variable["quantity"])
      2. Variable["gold"] = Variable["gold"] + (4 * Variable["quantity"])
      3. ShowAlert("Sold "..Variable["quantity"].." swords.")
    (Ignore the 1. 2. 3. in front of those lines of Lua. This forum software adds line numbers in front of code blocks.)

    I recommend getting this working first. Once you've confirmed that it's working, then you can add some logic to make sure the player has enough money to buy the items or enough items to sell.
     
  28. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Thanks for this I'll try it when I come back home. One more question, how can I store the "gold" item in the itemlistdata of invector to the Lua variable "gold" so when the variable "gold" increase or decrease then it will also decrease/ increase the "gold" item in the itemlistdata?
     
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    You might want to store the gold amount only in EviLA's ItemListData. Write custom Lua functions to get and set it. For example, they could be called vGetGold() and vSetGold(). Then instead of this:

    Variable["gold"] = Variable["gold"] - (8 * Variable["quantity"])

    you'd do this:

    vSetGold( vGetGold() - (8 * Variable["quantity"]) )
     
  30. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Hi @TonyLi can I use the vgetitemcount() to check whether the player has enough gold to purchase from the store? I don't want to create a custom Lua as my programming knowledge is just basic and I might mess some things up. I'll just use the vgetitemcount() to check if the player has sufficient gold and write a condition using the vgetitemcount() to restrict the player from buying. ill just use vAddItemByID and vRemoveItemByID for adding removing gold from the item manager
     
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    I'm not very familiar with EviLA's RPG pack. If it treats gold as just another item, then yes you can use vGetItemCount() to get the amount of gold.
     
  32. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Its just like other items you will just create it in the item manager. What's the Lua condition for me to restrict the player from buying items from the vendor using vgetitemcount? Like if gold = 0 or below the selling price?
     
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    Use the Conditions field. For example:

    upload_2019-3-18_14-33-18.png

    You might still want to show the menu item but show it grayed out. To do that, inspect the conversation's properties and tick Include Invalid Entries:

    upload_2019-3-18_14-30-23.png
     
  34. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Hi @TonyLi how can I make a that if vgetitemcount(23) >= 30 then it will go to the dialogue "how many do you want to buy" but if vgetitemcount(23) < 30 then it will go to dialogue "sorry you don't have enough money to purchase". I tried putting these conditions like these but it always go to the you dont have enough money dialogue even i have 100 gold in my inventory. See the picture attached.
     

    Attached Files:

    • 3.png
      3.png
      File size:
      154.3 KB
      Views:
      284
    • 1.png
      1.png
      File size:
      154.4 KB
      Views:
      292
    • 3.png
      3.png
      File size:
      154.3 KB
      Views:
      279
    • 2.png
      2.png
      File size:
      153.5 KB
      Views:
      285
    Last edited: Mar 19, 2019
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    Hi @dinaloraven234 - That should work. Is it not working? If not, what's happening?

    You might find it simpler to show invalid entries as grayed out, like I described in my previous reply. That's just my personal preference, though.
     
  36. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Hi @TonyLi I tried that and retried again now but what happens is that after the dialogue "what do you want to buy?" Instead of showing the 2 items (health and stamina potion) the dialogue just closes. I follow your instruction. I put the condition on a dialogue text that has the (health potion = 30 gold) just like your example. See the attached pictures above
     
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    Where is the "what do you want to buy?" node? Is it the same as "Yes, I'd like to see your goods"? If so, is there a Condition on it or its reply node?

    If you play with the Dialogue Editor open on that conversation, check the node at runtime. The active node will be green. Valid followups will have green arrows, and invalid followups will have red arrows, similar to this:

    upload_2019-3-19_11-24-39.png

    In this example, since only the Stamina Potion link is green, the player must have 25 to 29 gold.

    (I still suggest the Include Invalid Entries thing I mentioned earlier. I think it will make it easier to see what's going on.)
     
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    Dialogue System for Unity 2.1.3 Released!

    Version 2.1.3 is now available on the Asset Store!

    Highlights include:
    • Editor improvements: can now auto-arrange lassoed selections of nodes, hover to see SimStatus, etc.
    • Usable component now has OnUse, OnSelect, OnDeselect UnityEvents - super handy!
    • Updated integrations: articy:draft, Adventure Creator, Emerald AI, Invector, Opsive Controllers, ORK Framework, RPG Kit, uMMORPG, and uSurvival.

    Release Notes:

    [Core]
    • Changed: Dialogue System LocalizeUIText script is now a wrapper for common library’s LocalizeUI.
    • Dialogue Editor:
      • Improved: Can now apply Arrange Nodes only to lassoed selection of nodes.
      • Improved: When using SimStatus, hover tooltip shows node’s SimStatus at runtime.
      • Improved: Links with non-default priority are now drawn thicker.
      • Improved: Added menu option to center on active node at runtime.
      • Improved: Can now specify a single conversation for search & replace.
      • Fixed: Null reference exception in Dialogue Editor’s Watches tab when exiting playmode.
    • Fixed: LuaTable bug affecting SimStatus.
    • Fixed: Dialogue Manager’s Display Settings no longer reset to defaults during play when playing conversation while inspecting Dialogue Manager in inspector’s Debug mode.
    • Fixed: Quest log window track checkbox didn’t appear when display name differs from quest name.
    • Fixed: Quest log window abandon text now uses display name, not quest name.
    • Improved: Usable component now has OnSelect(), OnDeselect(), and OnUse() events.
    • Improved: Added Dialogue System Trigger > Start Conversation option to specify entry ID.
    • Improved: Selector can now display different reticle images and use messages per layer and per tag.
    • Improved: Added IStandardDialogueUI interface to allow custom dialogue UI scripts to use more built-in features.
    • Improved: Added speed mode to Timeline() sequencer command.
    • Improved: Text Table editor: Performance improvement for large tables.
    • Improved: UI panels remember last selection instead of reverting to first selectable. Added UIPanel.monitorSelection bool to temporarily disable this functionality.
    • Improved: Added UpdateTracker() Lua function.
    • Improved: QuestStateListener methods made virtual for easier subclassing.
    • Save System:
      • Improved: Position Saver now updates NavMeshAgent if present.
      • Improved: Assign Unique Keys menu item now also disambiguates existing duplicates.
      • Fixed: Error message “Some objects were not cleaned up” when stopping playmode when Save System doesn’t have data serializer or data storer.
    [Third Party Support]
    • articy: Fixed import of Response_Menu_Sequence property, multiparagraph markup conversion.
    • Adventure Creator: Minor bug fix; added actions to check & set quest states and show/hide quest log window.
    • Emerald AI: Updated support for version 2.2; added several Lua functions to control Emerald AI.
    • ICode: Updated support for version 2.2.1.
    • Invector: Fixed bug that disabled Lua functions when changing scenes; added vGetItemCount(), vRemoveItemByID() Lua functions.
    • Opsive Character Controllers: Updated support for version 2.1.1; fixed bugs in saving inventory & attributes.
    • ORK Framework: Updated support for version 2.23.0.
    • RPG Kit: Updated support for version 3.1.9.
    • uMMORPG: Updated support for version 1.162.
    • uSurvival: Updated support for version 1.140.
     
    Candy-Bomber and Deckard_89 like this.
  39. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Hi @TonyLi I've already checked the invalid entries node. Haven't tried checking it in runtime. I'll see to that tomorrow.
     
  40. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    912
    Hi @TonyLi, Have you tried using Dialogue system with both UFPS and Cinemachine? I'm trying to setup my cutscenes and was hoping to use them together with dialogue system because of the integration but they are clashing due to them both trying to control maincamera.
     
  41. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    Hi @AndyNeoman - UFPS version 1? Which are clashing? At what point do they clash?

    Assuming UFPS v1, try this setup: The vp_FPCamera component on the player's FPSCamera GameObject controls the camera. You can either add a Dialogue System Events component to the player to disable vp_FPCamera in the OnConversationStart() event and re-enable it in OnConversationEnd(), or you can create and assign a separate sequencer camera. If you assign a separate sequencer camera, deactivate the player's Audio Listener and activate the Audio Listener on FPSCamera. Either way should free up a camera during conversations so the Dialogue System and Cinemachine can control it.
     
    AndyNeoman likes this.
  42. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Hi @TonyLi I know what's causing the problem now. It seems vGetItemCount() doesn't work or not detecting my items in the inventory. How to fix it?
     
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    Good catch. You can download the fix from the Extras page or right here: DS_Invector_Support_2019-03-20.unitypackage
     
  44. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Thanks man and also I think vRemoveItemByID also has an error

    Dialogue System: Lua code 'vRemoveItemByID(2,1)' threw exception 'Exception has been thrown by the target of an invocation.'

    I have an item in my inventory which is a health potion (5 health potion) (ID is 2) and tried to run the vRemoveItemByID Lua and the error above is what I'm getting
     
  45. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    Fixed. It was the same issue as with vGetItemCount(). Download: DS_Invector_Support_2019-03-20a.unitypackage
     
  46. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    912
    Thanks @TonyLi, i'll give that try, it sounds like the solution. It's UFPS 1 btw. Is that what you do with the integration between UFPS and Dialogue system?
     
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    When a conversation starts, the integration holsters the player's weapon (if the checkbox is ticked) and disables movement controls, but it leaves the camera under UFPS control. This is so UFPS can continue to control the camera in case the designer wants it that way. It's easy enough to disable UFPS's camera control using a Dialogue System Events component like I described above.
     
  48. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Hi @TonyLi it seems to not working properly when i use vAddItemByID (2, Variable["quantity"],false) it adds item to my inventory but displays zero

    And also how can I restrict the input to only numbers?
     
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,728
    Give me a few minutes. I'll put together a short example for you.
     
  50. dinaloraven234

    dinaloraven234

    Joined:
    Dec 20, 2018
    Posts:
    141
    Thanks man and is my Lua correct? I'm gonna use a variable named subtractGold and use it in the vRemoveItemByID () to subtract the gold.

    This is what I have in mind:

    vAddItemByID(2,Variable["input"],false);
    Variable["subtractGold"] = (Variable["input"] * 30);
    vRemoveItemByID(23,Variable["subtractGold"] )
     
unityunity