Yeah I will have to see how I use it exactly in the final game, the Item thing was just an example.Regardless of the actual content I still would need a possibility to change the localized quest description from c# though.
Hi @OneManBandGames - I’ll add localized versions of QuestLog.SetQuestDescription and QuestLog.SetQuestEntryDescription in version 2.0. In the meantime, you can use DialogueLua.SetLocalizedQuestField to set the description for the current language:
DialogueLua.SetLocalizedQuestField("Your Quest", "Description", "Your description here.");
Or, if you want to set it for a different language, use DialogueLua.SetQuestField:
DialogueLua.SetQuestField("Your Quest", "Description fr", "Votre description ici.");
If you need to include this in saved games, tick the Dialogue Manager’s Persistent Data Settings > Include All Item Data.
This next idea might be getting too elaborate, but you can also include [var=varName] and [lua(code)] tags in your descriptions. So you could set the description at design time like this:
- Description: “You need to find Item X. [lua( Variable[“LearnedRumor”] and “Rumor has it such an item can be found at Location Y.” or “” )]”
At the time of display, the [lua(code)] tag gets replaced with its return value. In this case, it uses Lua equivalent of a ternary operator, which returns one value or another based on a condition. In this case, the condition is that Variable[“LearnedRumor”] is true. If true, it returns “Rumor has it…”. If false, it returns a blank string. Abstractly, the syntax is:
*condition* and *true-value* or *false-value*
This is a really powerful feature. You can do all kinds of things, like revealing characters’ names:
- Description: “You need to find Item X from [lua( Variable[“KnowsIdentity”] and “The Red Mage.” or “a mysterious stranger” )].”
and since it’s general Lua, you can also check other quest states and quest entry states, or even register your own code with Lua.
Thanks Tony, I was not aware of these methods in the DialogueLua class!
The idea of handling the dynamic descriptions with lua tags is intriguing since I would not need to write any code to assemble the descriptions, but it might become messy to maintain once there are multiple variables that are depending on each other etc.
So I have to see which path I will follow according to how complex those quests will turn out in the end =)
@OneManBandGames - You don’t have to use variables. Your Lua expressions can check quest states and quest entry states with the CurrentQuestState() and CurrentQuestEntryState() functions. And you can also register your own C# code, so you could do something like this:
- Description: “You need to find Item X. [lua( GetMyExtraInfo() )]”
Just putting it out there as an option.
Hey Tony. So, Sequencer Shortcuts are nice, but they don’t seem to work whenever I change scenes. What do I do? Btw, the system is set to Dont Destroy on Load, if it’s something you need to know.
Hi @Sigma266 - This is by design so you can have scene-specific Sequencer Shortcuts if you want. Try putting it on a different GameObject such as the Dialogue Manager that survives scene changes. Maybe your GameObject isn’t actually surviving scene changes.
I did put it on my Dialogue Manager, which is why it’s weird. And yes, the objects does survive the scene change because it’s immediatly put inside DontDestroyOnLoad.
EDIT: Nvm. Apparently, going from scene to another deletes my Manager inside DontDestroyOnLoad(weird), and puts in the one from the new scene. I just have to remove the new one. Thanks for help!
@Sigma266 - No worries; I’m glad it’s working now!
Just started using the asset, and it looks awesome!
Has anyone implemented a functionality of tooltips on hover over specified words in conversation? If not any tips how to implement it? Thanks!
Also, what is the best workflow to make descriptions through Dialogue System? I mean, like the ones when you “look” in point and click adventures. Is there a way to make a one-node conversation?
Hi @Shinzironine ! Thanks! I recommend using TextMesh Pro (TMP) to do this, especially since TMP is now free. This post has an example in which you can hover and click on specified words: [Morrowind-Style Keywords Example ]( https://discussions.unity.com/t/517189 page-61#post-2860988)
The Dialogue System Extras also has a Hover Response Button Example that you might be interested in. When you hover over a response button, it shows a tooltip and does some other action (in the example’s case, activating a GameObject).
For this, most people use one-off lines of dialogue called barks.
Thank you for your quick answer! I am really enjoying the asset. These examples and the asset itself are huge timesavers.
Happy to help!
Dialogue System for Unity 1.8.2 Released!
Version 1.8.2 is now available on the Pixel Crushers customer download site. If you need access, please PM me your Asset Store invoice number. It should be available on the Asset Store in a few days.
Version 2.0 is on schedule for release next Monday.
This is an update to the 1.x line to provide some small improvements and bug fixes, and to add Emerald AI 2.0 support.
Version 1.8.2
Core
- Improved: Can now multiedit fields when selecting multiple dialogue entry nodes.
- Improved: Can now define more than 4 emphasis tags.
- Improved: Unity UI Dialogue UI animation handler improvements.
- Improved: MoveTo() with no duration now moves rigidbody, not just transform.
- Fixed: Bug with Continue() at time 0 not clearing previous subtitle.
- Fixed: Build bug with Timeline() sequencer command.
Third Party Support
- Adventure Creator: Start Conversation action can now specify an entry ID.
- articy:draft: Added support for getProp() and getObj() functions.
- Corgi Platformer / Inventory Engine: Inventory panel now refreshed when replacing items during conversations.
- Emerald AI 2.0: Added support.
- Inventory Third Person Controller: Updated for Invector 2.3.0.
- PlayMaker: GetLocalizedText now falls back to Dialogue Manager’s text table.
Version 1.8.2 is now available on the Asset Store!
The Chronicles of the Maze Hunter - by John Lisenby Jr.
Check out The Chronicles of the Maze Hunter, just released for Xbox One and Windows PC by John Lisenby Jr. and made with the Dialogue System for Unity:
Disco Elysium previewed in PC Gamer
The July 2018 issue of PC Gamer has a glowing preview of ZA/UM’s Disco Elysium (which uses the Dialogue System for Unity and articy:draft), calling it:
and predicting:
If you like quirky, thoughtful RPGs, alternate history, or games with compelling dialogue, this is one to put on your list.
Some questions:
- Can I drive animation and script through insertion of “control tag”. For example I want to write the dialogue script in a text file, and have that loaded and controlling the npc mood or animation (for example indicating when in the dialogue he gesture (one off animation) or change expression on his face.
- Can I generate text on the fly with own script, insert “control tags”, and have it recognized by the dialogue system?
Hi @neoshaman - Yes. If your text file is in articy:draft XML, Chat Mapper XML, or Ink format, you can import it at runtime very easily. If it’s in those formats or CSV, Aurora, or TalkIt format, you can import it at design time. Or you can import your own format. (The Dialogue System includes a template script for custom importers.)
Conversations are made of nodes called dialogue entries. Each dialogue entry has a Sequence field for driving animation, and a Script field for managing data. Both fields can connect to your own custom code, too. This is an important design feature of the Dialogue System. Since Sequence and Script fields are text, you can import and export to text formats without losing anything.
Your scripts can also have a custom method “OnConversationLine” that the Dialogue System will automatically invoke with each line of dialogue. This method can parse the dialogue text for control tags if you prefer to do that.
Yes, there are two ways to do this.
- You can create a conversation (an entire list of linked dialogue entry nodes) on the fly and add it to the Dialogue System. This post has example code.
- Or you can run a dummy conversation and feed it a new, generated ConversationState with every line. The Ink integration does this; since Ink runs its own engine, the Dialogue System’s integration turns each Ink state into a ConversationState to present to the dialogue UI.
I know items are not a main feature in this asset, however is there a way to get all items?
For instance: I want to use a foreach loop of each item to populate a list of all items.
Hi @Aidiah - To get all the items in your dialogue database:
foreach (var item in DialogueManager.MasterDatabase.items) {
if (item.IsItem) Debug.Log("Item: " + item.Name);
}
If you’ve added items at runtime (less likely, but still possible), you’ll need to loop through the Lua table instead:
var itemTable = Lua.Run("return Item").AsTable;
foreach (var itemElement in itemTable.Values) {
if ((bool)itemElement["Is_Item"]) {
Debug.Log("Item: " + itemElement["Name"]);
}
}