Minor Issue with Invector Inventory

Announcements, support questions, and discussion for the Dialogue System.
KingCeryn
Posts: 70
Joined: Sun Aug 23, 2020 5:12 pm

Minor Issue with Invector Inventory

Post by KingCeryn »

Hey, so I've kind of got most everything working right, about to dive into Dialogue Systems itself to start learning it after making sure the integration with Invector TPC works,

However I'm getting one little annoying issue, when changing scenes or loading saves- my character equips an then requips his weapons like 3-4 times and then stops whenever the save/scene loads. It's still working properly, it just duplicates the icon for the weapon in the inventory, but doesnt actually add another item. It seems like a small graphical/backend bug, but i cant pin down where its at.

It's not throwing any errors or warnings, just logging the Lua "Equip" and "unequip" over and over before stopping. Any idea what might be causing this?
User avatar
Tony Li
Posts: 20677
Joined: Thu Jul 18, 2013 1:27 pm

Re: Minor Issue with Invector Inventory

Post by Tony Li »

Hi,

If you click on those log lines in the Console window, the details section at the bottom of the Console window will show the stack trace. Can you identify what scripts or methods are repeatedly calling equip and unequip?

How are you changing scenes?

What is the Save System component's Frames To Wait Before Apply Data set to? (A value of 1 usually works best for Invector.)

Do you have any Dialogue System Triggers or something similar that might call equip and unequip functions?
KingCeryn
Posts: 70
Joined: Sun Aug 23, 2020 5:12 pm

Re: Minor Issue with Invector Inventory

Post by KingCeryn »

Ah, i think I have it set to 2,

The only triggers i have are the level load Generic Actions from the Demo scene. Door to Demo2, etc
KingCeryn
Posts: 70
Joined: Sun Aug 23, 2020 5:12 pm

Re: Minor Issue with Invector Inventory

Post by KingCeryn »

Looks Like I'm getting some "Disable Equipment" Lua messages,

even with weapons holstered, when I enter a new scene it pulls them out a few times.
Looks like maybe the vItemManager.

Disable Equipment vKanata_Long(Clone) (UnityEngine.GameObject)
UnityEngine.Debug:Log(Object)
Invector.vItemManager.vItemManager:UnequipEquipment(vItem) (at Assets/Invector-3rdPersonController/ItemManager/Scripts/vItemManager.cs:634)
Invector.vItemManager.<EquipItemRoutine>d__73:MoveNext() (at Assets/Invector-3rdPersonController/ItemManager/Scripts/vItemManager.cs:807)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
User avatar
Tony Li
Posts: 20677
Joined: Thu Jul 18, 2013 1:27 pm

Re: Minor Issue with Invector Inventory

Post by Tony Li »

I don't see anything Dialogue System related in that stack trace. If you set up two similar scenes without anything Dialogue System-related, does it still show that issue?
KingCeryn
Posts: 70
Joined: Sun Aug 23, 2020 5:12 pm

Re: Minor Issue with Invector Inventory

Post by KingCeryn »

Oh, well no.

In the standard Invector LoadLevel script, it takes your current player to the next scene, etc, rather than have an instance for each scene that gets the inventory transferred

So now using Dialogue systems, I have an instance of the player in each scene, and its getting the inventory and loading saves correctly, but yeah it just Equips and Unequips my gear whenever i load. It also brielfy shows a duplicate icon in my inventory, but its not real and goes away when clicked. the original weapon still exists properly.
User avatar
Tony Li
Posts: 20677
Joined: Thu Jul 18, 2013 1:27 pm

Re: Minor Issue with Invector Inventory

Post by Tony Li »

You can still configure your non-Dialogue System Invector scenes to not take the current player to the next scene (i.e., untick Use Instance).

Did you also untick Use Instance on the inventory prefab? (This varies by Invector version.)
KingCeryn
Posts: 70
Joined: Sun Aug 23, 2020 5:12 pm

Re: Minor Issue with Invector Inventory

Post by KingCeryn »

Yeah im not seeing the "Use Instance" option anywhere, do you happen to know which script component its on?
KingCeryn
Posts: 70
Joined: Sun Aug 23, 2020 5:12 pm

Re: Minor Issue with Invector Inventory

Post by KingCeryn »

Oh sorry, maybe I mistyped- im no longer carrying the same player instance into the next scene,

I'm now using the Dialogue Systems method, of having a player prefab in each scene that gets gets transferred the inventory.

If there's a way to send the original Player prefab to each scene via the dialogue systems scripts, I'd love that! But for now it works normally, just the issue of re-equipping.

It looks like it may be related to the item manager, theres some "in Equip Delay" messages as well:

In Equip delay Great Sword (Invector.vItemManager.vItem)
UnityEngine.Debug:Log(Object)
Invector.vItemManager.<EquipItemRoutine>d__73:MoveNext() (at Assets/Invector-3rdPersonController/ItemManager/Scripts/vItemManager.cs:815)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
Invector.vItemManager.vItemManager:EquipItem(vEquipArea, vItem) (at Assets/Invector-3rdPersonController/ItemManager/Scripts/vItemManager.cs:768)
UnityEngine.Events.UnityEvent`2:Invoke(vEquipArea, vItem)
Invector.vItemManager.vInventory:OnEquipItem(vEquipArea, vItem) (at Assets/Invector-3rdPersonController/ItemManager/Scripts/vInventory.cs:420)
UnityEngine.Events.UnityEvent`2:Invoke(vEquipArea, vItem)
Invector.vItemManager.vEquipArea:AddItemToEquipSlot(Int32, vItem, Boolean) (at Assets/Invector-3rdPersonController/ItemManager/Scripts/vEquipArea.cs:393)
Invector.vItemManager.vItemManager:EquipItemToEquipSlot(Int32, Int32, vItem, Boolean, Boolean) (at Assets/Invector-3rdPersonController/ItemManager/Scripts/vItemManager.cs:866)
Invector.vItemManager.vItemManager:AutoEquipItem(vItem, Int32, Boolean, Boolean) (at Assets/Invector-3rdPersonController/ItemManager/Scripts/vItemManager.cs:729)
Invector.vItemManager.vItemManager:AddItem(ItemReference, Boolean) (at Assets/Invector-3rdPersonController/ItemManager/Scripts/vItemManager.cs:687)
PixelCrushers.DialogueSystem.InvectorSupport.InvectorInventorySaver:ApplyData(String) (at Assets/Pixel Crushers/Common/Third Party Support/Invector Support/Scripts/InvectorInventorySaver.cs:118)
PixelCrushers.SaveSystem:ApplySavedGameData(SavedGameData) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:593)
PixelCrushers.<LoadSceneCoroutine>d__97:MoveNext() (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:703)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
User avatar
Tony Li
Posts: 20677
Joined: Thu Jul 18, 2013 1:27 pm

Re: Minor Issue with Invector Inventory

Post by Tony Li »

What versions of the Dialogue System and Invector are you using? Have you imported the latest Invector Support package from that version of the Dialogue System?

Do these scenes work correctly?

DS_InvectorSceneChangeSaveLoadExample_2020-08-13.unitypackage

It's kind of an old example that was made for a different purpose, so the scene names are strange. Add both scenes to build settings. Play 'Vendor Save Load Scene 1', pick up the gun, then go through the portal to the next scene. The player in the next scene should also have the gun since the saver in scene 1 will record it to the save system, and the saver in scene 2 will retrieve that info from the save system and add it to the player's inventory. Since the player in each scene starts with nothing, when you enter scene 2 the save system will need to give and equip the gun as soon as the scene starts. You can mask that with a scene transition fade from black. But it shouldn't do it multiple times, and it shouldn't have an extra icon.
Post Reply