Page 1 of 3
An Idea: Add an Inventory UI Panel
Posted: Thu Sep 13, 2018 8:57 am
by Alatriste
Hi Tony,
I know this one goes far beyond the scope of Dialogue System, but it would be amazing that DS include an optional UI Inventory panel where the item collected and stored by DS are displayed. Just a way to keep a visual track of what our inventory has.
I know there are plugins that already do that and even more, but looking at them, many are way more complicated or offer way too many different options, which make them difficult to set up.
Anyway, just an idea to make DS even better!
Re: An Idea: Add an Inventory UI Panel
Posted: Thu Sep 13, 2018 1:41 pm
by Tony Li
Thanks for the idea; I'll keep it in mind. You may be interested in Inventory Engine. It's the simplest inventory system that's integrated with the Dialogue System, and it works the best (most reliable, fewest headaches).
Re: An Idea: Add an Inventory UI Panel
Posted: Thu Sep 13, 2018 3:48 pm
by Alatriste
Thanks for the suggestion! I'll take a look.
Re: An Idea: Add an Inventory UI Panel
Posted: Mon Sep 17, 2018 2:11 pm
by CricketSaysChill
Just wanted to throw in that I managed to do this really easily in a couple of hours with 'just' the dialogue System using only the Unity UI. Might be useful for someone in the future so I'll try to explain a little. You don't even need seperate inventory plugins depending on how your game is built.
I just created a new Cavnas with an open inventory button. Said button when clicked activates a Scrollview Gameobject in it which itself is filled with an arranged row of buttons, each button representing an item. (It's buttons all the way down) They have no on click function, but will activate a child window in their Animation OnHover state when the mouse hovers over them in order to Show stats and detials for the item. When the Player collects the item in game I just use "SetActive(MegaUltraDeathSword, true);" in the sequence area of the dialogue node to turn on the button in the inventory giving the apperance that the Player has visually collected the item.
Then, assuming you made a "is_collected" variable for the item. Just set said variable in the item to true using the script ["Mega_Ultra_Death_Sword"].Is_Collected = true;. This is critical if you use the persistant active data scripts when saving as you can just add one to the inventory for each item with the condition that it has been found so the game knows when you load in that the item has been collected. Hope that all makes sense.
Re: An Idea: Add an Inventory UI Panel
Posted: Mon Sep 17, 2018 8:37 pm
by Tony Li
Thanks for sharing that!
Re: An Idea: Add an Inventory UI Panel
Posted: Tue Sep 18, 2018 11:32 am
by Alatriste
CricketSaysChill wrote: ↑Mon Sep 17, 2018 2:11 pm
Just wanted to throw in that I managed to do this really easily in a couple of hours with 'just' the dialogue System using only the Unity UI. Might be useful for someone in the future so I'll try to explain a little. You don't even need seperate inventory plugins depending on how your game is built.
I just created a new Cavnas with an open inventory button. Said button when clicked activates a Scrollview Gameobject in it which itself is filled with an arranged row of buttons, each button representing an item. (It's buttons all the way down) They have no on click function, but will activate a child window in their Animation OnHover state when the mouse hovers over them in order to Show stats and detials for the item. When the Player collects the item in game I just use "SetActive(MegaUltraDeathSword, true);" in the sequence area of the dialogue node to turn on the button in the inventory giving the apperance that the Player has visually collected the item.
Then, assuming you made a "is_collected" variable for the item. Just set said variable in the item to true using the script ["Mega_Ultra_Death_Sword"].Is_Collected = true;. This is critical if you use the persistant active data scripts when saving as you can just add one to the inventory for each item with the condition that it has been found so the game knows when you load in that the item has been collected. Hope that all makes sense.
Thanks for sharing! I might give a try. I wonder how it can handle that all objects are aligned by appearing order if not all items are unlocked sequentially.
Re: An Idea: Add an Inventory UI Panel
Posted: Fri Sep 21, 2018 8:30 am
by CricketSaysChill
Alatriste wrote: ↑Tue Sep 18, 2018 11:32 amThanks for sharing! I might give a try. I wonder how it can handle that all objects are aligned by appearing order if not all items are unlocked sequentially.
Not well on it's own I suppose.
Like I said it depends on what kind of game you are making. Mine for example uses pre-determined inventory slots for items even though they can be picked up in random order, but I want to have gaps betwen inventory slots on purpose, so it doesn't bother me personally. I like the 'feel' it gives the game because it hints to the Player "woah. Look at all this stuff you haven't found yet. Better explore a little more."
My current personal idea if you wanted to avoid that (Note that this is just vague theory crafting from here on out) you could probably easily write a simple C# script that checks the Dialogue System item table for all items that have the variable "is_collected" set to true. Following that it should thereafter instantiate said gameobjects at unique transform coordinates found inside the scrollview inventory. IE Item 1 is_collected= true so instantiate Item1 at x=75 x y=75, Item 2 is_collected= true, instantiate at x=150 y=150.
But at that point it might just be easier to get the inventory System.
Re: An Idea: Add an Inventory UI Panel
Posted: Fri Sep 21, 2018 8:46 am
by Tony Li
You can use a layout group inside the scroll content to get rid of gaps. It will still show items in the order they are defined at design time, such as alphabetical order.
For example, let's say your scroll content contains a Horizontal Layout Group. Inside the Vertical Layout Group are three items: Apple, Banana, and Cherry. All three start inactive.
If you pick up Cherry and then Apple (and activate their UI elements), the scroll content will be:
[Apple][Cherry]
with no gap. If you then pick up Banana, the content will be:
[Apple][Banana][Cherry]
Re: An Idea: Add an Inventory UI Panel
Posted: Sat Sep 22, 2018 12:39 pm
by Alatriste
Thanks to both. I hope I can give a try in the next days.
Re: An Idea: Add an Inventory UI Panel
Posted: Thu Dec 13, 2018 10:21 am
by Alatriste
I finally bought the Inventory Engine as I tried to make the inventory myself but I wanted to handle some logic to align the objects, etc, so I found this the easiest solution, especially if Dialogue System supports it.
But I'm having some problems running the example scene. I suppose to have to interact with another character but I don't know how to do it. The interaction doesn't work, neither the access to the other room (where I guess the apples are). Am I missing something?
When I try to follow the tutorial I'm getting this error as well:
Code: Select all
Dialogue System: Lua code 'mmAddItem("MainInventory", "Apple", 1)' threw exception 'Exception has been thrown by the target of an invocation.'
UnityEngine.Debug:LogError(Object)
PixelCrushers.DialogueSystem.Lua:RunRaw(String, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter Wrapper/Lua.cs:218)
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:OnFinishedSubtitle(Object, EventArgs) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:224)
PixelCrushers.DialogueSystem.ConversationView:FinishSubtitle() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:379)
PixelCrushers.DialogueSystem.ConversationView:OnFinishedSubtitle() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:386)
PixelCrushers.DialogueSystem.Sequencer:FinishSequence() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:469)
PixelCrushers.DialogueSystem.Sequencer:Update() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:462)