An Idea: Add an Inventory UI Panel
Re: An Idea: Add an Inventory UI Panel
Hi,
Are you playing the scene "Inventory Engine Example"?
If so, the player moves with the arrow keys, not WASD. The player uses a Proximity Selector to detect the NPC. The apples are in the bottom of the room.
The scene isn't hooked up to any other rooms. You can test all of the Dialogue System integration in this room.
Are you playing the scene "Inventory Engine Example"?
If so, the player moves with the arrow keys, not WASD. The player uses a Proximity Selector to detect the NPC. The apples are in the bottom of the room.
The scene isn't hooked up to any other rooms. You can test all of the Dialogue System integration in this room.
Re: An Idea: Add an Inventory UI Panel
It seems that the proximity selector is not working.
No errors in the console either.
I just wanted to check that the "mmAddItem("MainInventory", "Apple", 1)" worked as I wasn't able to do it in my project.
No errors in the console either.
I just wanted to check that the "mmAddItem("MainInventory", "Apple", 1)" worked as I wasn't able to do it in my project.
- Attachments
-
- Screenshot 2018-12-14 at 09.54.41.png (56.89 KiB) Viewed 1866 times
Re: An Idea: Add an Inventory UI Panel
Hi,
A quick way to check things like that is to add a Lua Console to the scene. During play, press ~+L to open the Lua Console, and enter the Lua command: "mmAddItem("MainInventory", "Apple", 1)"
If you are using Unity 2018+, make sure you've enabled support for 2D physics. Select Tools > Pixel Crushers > Common > Enable Physics2D Support....
If that doesn't fix it, can you update to Dialogue System version 2.0.9 to see if that fixes the Proximity Selector issue?
A quick way to check things like that is to add a Lua Console to the scene. During play, press ~+L to open the Lua Console, and enter the Lua command: "mmAddItem("MainInventory", "Apple", 1)"
If you are using Unity 2018+, make sure you've enabled support for 2D physics. Select Tools > Pixel Crushers > Common > Enable Physics2D Support....
If that doesn't fix it, can you update to Dialogue System version 2.0.9 to see if that fixes the Proximity Selector issue?
Re: An Idea: Add an Inventory UI Panel
That was the problem.If you are using Unity 2018+, make sure you've enabled support for 2D physics. Select Tools > Pixel Crushers > Common > Enable Physics2D Support....
Re: An Idea: Add an Inventory UI Panel
Great! I'm glad that it sounds like it's working now.
Re: An Idea: Add an Inventory UI Panel
Hi Tony,
After I finished a few previous tasks, I'm back with the Inventory engine integration. I'm able to run the demo scene, but when I try to add the inventory to my own project, I got the same error I described before:
I did some testing and I figured out what caused the error, but I'm not sure how to fix it.
You can reproduce it in the demo scene if you disable the "DemoGameManager" and the "DemoCharacterInputManager", which I'm not sure what they do, but apparently is what is screwing my project.
After I finished a few previous tasks, I'm back with the Inventory engine integration. I'm able to run the demo scene, but when I try to add the inventory to my own project, I got the same error I described before:
Code: Select all
Dialogue System: Lua code 'mmAddItem("RogueMainInventory", "Perfume", 1);' threw exception 'Exception has been thrown by the target of an invocation.'
UnityEngine.Debug:LogError(Object)
You can reproduce it in the demo scene if you disable the "DemoGameManager" and the "DemoCharacterInputManager", which I'm not sure what they do, but apparently is what is screwing my project.
Re: An Idea: Add an Inventory UI Panel
Hi,
Inspect your inventories, and untick the Persistent checkboxes. In the example scene, the inventories are named:
InventoryEngine_Support_2018-12-23.unitypackage
The only change in this package is that it will log better error messages to the Console.
Inspect your inventories, and untick the Persistent checkboxes. In the example scene, the inventories are named:
- RogueMainInventory
- RogueArmorInventory
- RogueWeaponInventory
- RogueBombInventory
InventoryEngine_Support_2018-12-23.unitypackage
The only change in this package is that it will log better error messages to the Console.
Re: An Idea: Add an Inventory UI Panel
Hi Tony,
I disable the "Persistent Inventory" script from the RogueMainInventory game object. The rest of files didn't have the script attached. I imported your package and now I get a new error besides the one previously reported:
I'm triggering the dialogue through a dialogue trigger onStart. (so I can debug it faster)
I disable the "Persistent Inventory" script from the RogueMainInventory game object. The rest of files didn't have the script attached. I imported your package and now I get a new error besides the one previously reported:
Code: Select all
ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
System.Collections.Generic.List`1[MoreMountains.InventoryEngine.InventoryItem].get_Item (Int32 index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
MoreMountains.InventoryEngine.InventoryDisplay.UpdateInventoryContent () (at Assets/InventoryEngine/InventoryEngine/Scripts/GUI/InventoryDisplay.cs:420)
MoreMountains.InventoryEngine.InventoryDisplay.ContentHasChanged () (at Assets/InventoryEngine/InventoryEngine/Scripts/GUI/InventoryDisplay.cs:380)
MoreMountains.InventoryEngine.InventoryDisplay.OnMMEvent (MMInventoryEvent inventoryEvent) (at Assets/InventoryEngine/InventoryEngine/Scripts/GUI/InventoryDisplay.cs:803)
MoreMountains.Tools.MMEventManager.TriggerEvent[MMInventoryEvent] (MMInventoryEvent newEvent) (at Assets/InventoryEngine/MMTools/Events/MMEventManager.cs:155)
MoreMountains.InventoryEngine.Inventory.AddItem (MoreMountains.InventoryEngine.InventoryItem itemToAdd, Int32 quantity) (at Assets/InventoryEngine/InventoryEngine/Scripts/Core/Inventory.cs:132)
PixelCrushers.DialogueSystem.InventoryEngineSupport.InventoryEngineLua.mmAddItem (System.String inventoryName, System.String itemID, Double quantity) (at Assets/Pixel Crushers/Dialogue System/Third Party Support/Inventory Engine Support/Scripts/InventoryEngineLua.cs:121)
UnityEngine.Debug:LogException(Exception)
PixelCrushers.DialogueSystem.InventoryEngineSupport.InventoryEngineLua:mmAddItem(String, String, Double) (at Assets/Pixel Crushers/Dialogue System/Third Party Support/Inventory Engine Support/Scripts/InventoryEngineLua.cs:125)
System.Reflection.MethodBase:Invoke(Object, Object[])
Language.Lua.LuaMethodFunction:InvokeMethod(LuaValue[]) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Interpreter/LuaValue/LuaMethodFunction.cs:33)
Language.Lua.FunctionCall:Evaluate(LuaValue, LuaTable) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Interpreter/Expr/FunctionCall.cs:41)
Language.Lua.PrimaryExpr:Evaluate(LuaTable) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Interpreter/Expr/PrimaryExpr.cs:15)
Language.Lua.ExprStmt:Execute(LuaTable, Boolean&) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Interpreter/Chunk/ExprStmt.cs:11)
Language.Lua.Chunk:Execute(Boolean&) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Interpreter/Chunk/Chunk.cs:42)
Language.Lua.Chunk:Execute() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Interpreter/Chunk/Chunk.cs:15)
Language.Lua.LuaInterpreter:Interpreter(String, LuaTable) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Interpreter/LuaInterpreter.cs:36)
PixelCrushers.DialogueSystem.Lua:RunRaw(String, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter Wrapper/Lua.cs:213)
PixelCrushers.DialogueSystem.Lua:Run(String, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter Wrapper/Lua.cs:119)
PixelCrushers.DialogueSystem.ConversationModel:GetState(DialogueEntry, Boolean, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Logic/Model/ConversationModel.cs:227)
PixelCrushers.DialogueSystem.ConversationModel:GetState(DialogueEntry) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Logic/Model/ConversationModel.cs:291)
PixelCrushers.DialogueSystem.ConversationController:OnSelectedResponse(Object, SelectedResponseEventArgs) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:257)
PixelCrushers.DialogueSystem.ConversationView:SelectResponse(SelectedResponseEventArgs) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:454)
PixelCrushers.DialogueSystem.ConversationView:OnSelectedResponse(Object, SelectedResponseEventArgs) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:447)
PixelCrushers.DialogueSystem.AbstractDialogueUI:OnClick(Object) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI Subsystem/Abstract/Abstract Dialogue UI/AbstractDialogueUI.cs:346)
PixelCrushers.DialogueSystem.StandardDialogueUI:OnClick(Object) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI Subsystem/Standard/Dialogue/StandardDialogueUI.cs:202)
UnityEngine.Component:SendMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.StandardUIResponseButton:OnClick() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI Subsystem/Standard/Dialogue/StandardUIResponseButton.cs:124)
UnityEngine.EventSystems.EventSystem:Update()
Re: An Idea: Add an Inventory UI Panel
Make sure the Inventory Display component's Target Inventory Name exactly matches the name of the Inventory GameObject.
The player can have several inventories. In the example scene, there are 4 inventories:
In the example scene, for example, the RogueArmorInventoryDisplay's Target Inventory Name is set to "RogueArmorInventory".
The player can have several inventories. In the example scene, there are 4 inventories:
- RogueMainInventory: Contains items in the player's main inventory.
- RogueArmorInventory: Contains the armor(s) that the player is wearing.
- RogueWeaponInventory: Contains the weapon(s) that the player is holding.
- RogueBombInventory: Contains the bombs that the player has equipped.
In the example scene, for example, the RogueArmorInventoryDisplay's Target Inventory Name is set to "RogueArmorInventory".
Re: An Idea: Add an Inventory UI Panel
Ok, I finally found the problem:
The name of the inventory was correct. It was the "DemoGameManager" game object, that aparente is mandatory, unless you make some coding, as it reads in the documentation of Inventory Engine:
There is also a NPC gameObject that is mandatory (not sure why, but I get the error if I disable it)
Do you know if the script "Localize UI" will work with the text fields of the inventory descriptions of Inventory Engine?
Anyway, all sorted now. I hope the saving/loading still work once I finish the implementation.
The name of the inventory was correct. It was the "DemoGameManager" game object, that aparente is mandatory, unless you make some coding, as it reads in the documentation of Inventory Engine:
The problem is that in the video tutorial that was not clear enough, so if you just follow the tutorial to implement the add-on in your own scene, you will get the error I was getting. The solution is as it reads in the documentation:"if you decide to get rid of demo elements, such as the InventoryDemoGameManager, make sure you implement their behaviors somewhere in your own classes!"
the fast way is to open one of your scenes, drag and drop the PixelRogueRoom1 demo scene into it, drag and drop elements from it into your scene, and remove it. The elements you’ll want to drag and drop that way are the Inventories and InventoryCanvas objects. The Inventories hold the inventory data, and the InventoryCanvas contains everything you need to interact with it. You’ll probably want to modify, rename and reorganize its contents to suit your needs.
There is also a NPC gameObject that is mandatory (not sure why, but I get the error if I disable it)
Do you know if the script "Localize UI" will work with the text fields of the inventory descriptions of Inventory Engine?
Anyway, all sorted now. I hope the saving/loading still work once I finish the implementation.