ORK Inventory Data Sync

Announcements, support questions, and discussion for Quest Machine.
Post Reply
shortestyard57
Posts: 29
Joined: Fri Jun 02, 2023 8:31 am

ORK Inventory Data Sync

Post by shortestyard57 »

Hey Tony,

I am trying to use data sync to update a quest counter based on number of items in ORK player inventory but I am not figuring out how to get it to register changes in the player inventory. I can see through the debug messages that the ORK Inventory Counter Sync component correctly lists the possible items however it does not seem to be detecting any inventory. Is there a specific component the ORK Inventory Data Sync component needs to paired with to work?

My current setup is a Quest Journal for ORK component on the same scene object as the Quest Machine Configuration component. My ORK inventory is a shared inventory across the party if that matters.

Thanks in advance.
User avatar
Tony Li
Posts: 20634
Joined: Thu Jul 18, 2013 1:27 pm

Re: ORK Inventory Data Sync

Post by Tony Li »

Hi,

The ORK Inventory Counter Synchronizer sends a "Data Source Value Changed" message along with the item name & amount to Quest Machine's Message System whenever the amount of an item changes.

In your quest, make sure the counter's name exactly matches the ORK item's name, including capitalization. Make sure the counter's Value Mode is set to Data Sync. The counter will listen for a "Data Source Value Changed" message from the Message System. If the message's item name matches the counter name, it will update the amount.
shortestyard57
Posts: 29
Joined: Fri Jun 02, 2023 8:31 am

Re: ORK Inventory Data Sync

Post by shortestyard57 »

Double checked the spelling and used copy paste to triple check. I did go into the code on the ORK Inventory Data Sync component and stepped through it until I realized it was returning questListContainer as null. I tried adding a Quest List Container for ORK component but I wasnt able to test if that fixed that just created problems with starting quests maybe because of the Quest Journal For ORK component already existing?

Is a quest list container for ORK required to use the inventory Data Sync?
User avatar
Tony Li
Posts: 20634
Joined: Thu Jul 18, 2013 1:27 pm

Re: ORK Inventory Data Sync

Post by Tony Li »

Hi,

I didn't catch that your Quest Journal is on a GameObject separate from the player. Please use this patch. It handles that case.

QM_ORK3Patch_2023-11-21.unitypackage

This fix will be in the next full Quest Machine release, too.
shortestyard57
Posts: 29
Joined: Fri Jun 02, 2023 8:31 am

Re: ORK Inventory Data Sync

Post by shortestyard57 »

Works, thanks for that.

Another data sync with ORK framework question. What is the best way to go about returning to a quest node if the counter conditions are no longer true? For example, I need to have 5 herbs in my inventory. I find 5 herbs and the quest progresses to a return to quest giver node. I however then drop or use an herb so I no longer have the required 5. I am sure there is an easier way to do this but I have been playing around with a separate quest node activated upon the completion of acquiring the 5 herbs with a ORK Has Item condition but I cannot figure out how to make it a less than. If I use Literal 4 then it goes true as soon as it is activated instead of when the player drops below the required counter.
User avatar
Tony Li
Posts: 20634
Joined: Thu Jul 18, 2013 1:27 pm

Re: ORK Inventory Data Sync

Post by Tony Li »

shortestyard57
Posts: 29
Joined: Fri Jun 02, 2023 8:31 am

Re: ORK Inventory Data Sync

Post by shortestyard57 »

Awesome I was going the correct direction but how can you input the <= # in the counter value? I can input an = but not < or >
User avatar
Tony Li
Posts: 20634
Joined: Thu Jul 18, 2013 1:27 pm

Re: ORK Inventory Data Sync

Post by Tony Li »

Ah, that will require a new condition type. Please import this updated ORK 3 integration package:

QM_ORKSupport_2023-11-24.unitypackage

Then use the new ORK Item Quantity Quest Condition.
shortestyard57
Posts: 29
Joined: Fri Jun 02, 2023 8:31 am

Re: ORK Inventory Data Sync

Post by shortestyard57 »

Great thank you that's very helpful.

Following along with the tutorial you sent I had to add an additional step of setting the Fetch 5 Carrots node (ID 1 in the example) to inactive and then to active otherwise the counter condition was not triggering true, despite having reached the counter limit again (i.e. it would show 5/5 carrots in the HUD). Don't know if it something with the ORK Data Sync specifically but either way its not a big deal, just figured I would offer it up in case you think its worth mentioning it in the tutorial.

I also was getting a console error that QM was trying to reference the ORK Inventory Counter Sync Component after it had been destroyed. This was happening after reloading the scene during runtime. I added a null check and unsubscribed from the listener events just in case and it seems to have fixed the invalid references. Changes below if you think its something worth adding to the next release.

Code: Select all

 protected virtual void OnQuestListChange(Quest quest)
        {
             if (gameObject == null) {return;}

            if (gameObject.activeInHierarchy && enabled)
            { 
                RefreshCounterItemNames();
                StartCoroutine(UpdateCountersAfterOneFrame());
            }
        }

Code: Select all

 private void OnDisable()
        {
            if (player == null || player.GameObject == null) return;
            var questListContainer = player.GameObject.GetComponent<QuestListContainer>();
            if (questListContainer == null) questListContainer = QuestMachine.GetQuestJournal();

            questListContainer.questAdded -= OnQuestListChange;
            
            questListContainer.questRemoved -= OnQuestListChange;
            
        }
Thanks as always for your quick help.
User avatar
Tony Li
Posts: 20634
Joined: Thu Jul 18, 2013 1:27 pm

Re: ORK Inventory Data Sync

Post by Tony Li »

Good calls. I'll add that to the integration.
Post Reply