Update quest log after acquired quest item

Announcements, support questions, and discussion for the Dialogue System.
aragu0529
Posts: 8
Joined: Fri Sep 20, 2024 8:47 pm

Update quest log after acquired quest item

Post by aragu0529 »

Hello,
I have a quest that npc asking for something from the store. And my items are scriptable objects that only load in inventory or the shop. I figured out how to let get the item count in the conversation with custom Lua codes. But the quest log is not updating after I acquired quest item in the inventory. Is there a way let the system check the quest item in the inventory?
Thank you
User avatar
Tony Li
Posts: 22085
Joined: Thu Jul 18, 2013 1:27 pm

Re: Update quest log after acquired quest item

Post by Tony Li »

Hi,

After acquiring the item, call DialogueManager.SendUpdateTracker(). This will send an UpdateTracker() message to the relevant quest UIs (quest tracker HUD and quest log window).
aragu0529
Posts: 8
Joined: Fri Sep 20, 2024 8:47 pm

Re: Update quest log after acquired quest item

Post by aragu0529 »

Sorry, could you please be more specific, where do I call this method from?
User avatar
Tony Li
Posts: 22085
Joined: Thu Jul 18, 2013 1:27 pm

Re: Update quest log after acquired quest item

Post by Tony Li »

You mentioned Lua, so I assume your quest description or a quest entry has some text like:

Code: Select all

[lua(GetItemCount("apple"))] / 3 Apples Picked
and you've registered your own inventory function GetItemCount(). If so, then when the player acquires or loses an item, call this in the same code that updates your inventory:

Code: Select all

PixelCrushers.DialogueSystem.DialogueManager.SendUpdateTracker();
aragu0529
Posts: 8
Joined: Fri Sep 20, 2024 8:47 pm

Re: Update quest log after acquired quest item

Post by aragu0529 »

Thank you its working now!
User avatar
Tony Li
Posts: 22085
Joined: Thu Jul 18, 2013 1:27 pm

Re: Update quest log after acquired quest item

Post by Tony Li »

Glad to help!
aragu0529
Posts: 8
Joined: Fri Sep 20, 2024 8:47 pm

Re: Update quest log after acquired quest item

Post by aragu0529 »

Hello,
I have a new question. So there is a save system comes with the dialogue system can I use it as save and load system for game?
Does it save inventory and player and NPC stats etc? If so how do I make it save inventory or how to tell the system to save the data that needed to be saved?
Thank you
User avatar
Tony Li
Posts: 22085
Joined: Thu Jul 18, 2013 1:27 pm

Re: Update quest log after acquired quest item

Post by Tony Li »

Hi,

It's a general purpose save system. See here for more info: Save System

It works by using "saver" components such as PositionSaver to save a GameObject's position, AnimatorSaver to save an animator state, ActiveSaver to save a GameObject's active/inactive state, etc.

You can also write your own savers: How To: Write Custom Savers

Many of the integrations also come with saver components, such as components to save Inventory Engine inventories, UIS inventories, etc.
aragu0529
Posts: 8
Joined: Fri Sep 20, 2024 8:47 pm

Re: Update quest log after acquired quest item

Post by aragu0529 »

So I have a main menu and I created a load panel with slots, and I attached Save System Methods to the slot button. And on Click I drag the save system methods component in and select SaveSystemMehtods.LoadFromSlot. set the slot index to 0. Then I created a save panel in main game, then attached the SaveSystemMehtods.SaveSlot, set the index to 0. However when I start the game, made some changes then save the game, and went back to the main menu to click on that load slot button. Nothing is happening. Do you know where am I doing wrong?
Thank you.
User avatar
Tony Li
Posts: 22085
Joined: Thu Jul 18, 2013 1:27 pm

Re: Update quest log after acquired quest item

Post by Tony Li »

Hi,

That sounds correct so far. Make sure that in the Button's OnClick() UnityEvent you've assigned the SaveSystemMethods component that you've added to the button, not the SaveSystemMethods.cs script.

Are there any errors or warnings in the Console window?

BTW, there's also a free Menu Framework addon available on the Dialogue System Extras page.
Post Reply