Database, Quests, Inventory and Saves

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Zimennik
Posts: 2
Joined: Sun Apr 24, 2022 10:06 am

Database, Quests, Inventory and Saves

Post by Zimennik »

Hello. Not so long ago I bought Dialogue System for Unity, and now I'm trying to integrate it into my game. I have a few problems that I hope you can help me with.

The structure of my game is this: There is a main stage with all the necessary managers, UI, and the player. As needed, new locations are loaded onto this scene using the Additive method. On the same scene, there is a Dialogue System Controller with a Database assigned.

1. There are quite a lot of NPCs in my game, each of which has dialogues and quests. Should I use one Database for everything?

2. Let's say I want to mark a quest as completed when the player enters a new location (and I don't want to use the Dialogue System Trigger). Is it possible to set the state of the quest through a script?

3. In my save system, I need to store player parameters, quest status, inventory, and more. Moreover, the game will only "auto-save" after fulfilling any conditions, talking with a specific NPC or completing a cutscene. Is it possible to implement all this with this asset? Or would it be better to write your own system?

4. Can I call any custom script from the conversations?

5. I want to make my own journal system to keep track of the status of quests and display inventory. How to get a list of all quests and items from database? And can I add/remove an item via code?

Sorry for being a little messy, but I'd really appreciate your help!
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Database, Quests, Inventory and Saves

Post by Tony Li »

Zimennik wrote: Sun Apr 24, 2022 10:11 am1. There are quite a lot of NPCs in my game, each of which has dialogues and quests. Should I use one Database for everything?
Yes. It's by far the easiest way to manage it. If you have several simultaneous writers, or if the Dialogue Editor gets a little slow when you have a massive amount of content, you can switch to multiple databases.
Zimennik wrote: Sun Apr 24, 2022 10:11 am2. Let's say I want to mark a quest as completed when the player enters a new location (and I don't want to use the Dialogue System Trigger). Is it possible to set the state of the quest through a script?
Yes. Use QuestLog.SetQuestState().
Zimennik wrote: Sun Apr 24, 2022 10:11 am3. In my save system, I need to store player parameters, quest status, inventory, and more. Moreover, the game will only "auto-save" after fulfilling any conditions, talking with a specific NPC or completing a cutscene. Is it possible to implement all this with this asset? Or would it be better to write your own system?
Use the Dialogue System's built-in save system. For your own data, see: How To: Write Custom Savers.
Zimennik wrote: Sun Apr 24, 2022 10:11 am4. Can I call any custom script from the conversations?
Yes. You can register your script methods with Lua and use them in conversation nodes' Conditions and Script fields. And you can write custom sequencer commands. (More info: Cutscene Sequence Tutorials)
Zimennik wrote: Sun Apr 24, 2022 10:11 am5. I want to make my own journal system to keep track of the status of quests and display inventory. How to get a list of all quests and items from database? And can I add/remove an item via code?
To get a list of all quests, use QuestLog.GetAllQuests().

To get a list of all quests and items defined in the dialogue database, iterate through DialogueManager.masterDatabase.items.

At runtime, treat the dialogue database as read-only. At runtime, the fields of items, quests, variables, etc., are maintained in a Lua environment. You can define a Boolean field to track whether the player has an item, or a Number field to track the amount of the item the player has. Then you can use DialogueLua.Get/SetItemField() to change that field. However, a better solution is to use a real inventory system and access it through Lua. The Dialogue System has integrations with several inventory systems on the Asset Store such as Inventory Engine and Ultimate Inventory System.
Zimennik
Posts: 2
Joined: Sun Apr 24, 2022 10:06 am

Re: Database, Quests, Inventory and Saves

Post by Zimennik »

Thank you very much for the fast and quality response! I'm going to apply new knowledge in the project =)
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Database, Quests, Inventory and Saves

Post by Tony Li »

Happy to help!
Post Reply