Forum rules - please read before posting.

How to pass the selected Inventory Item to a parameter?

edited October 2016 in Technical Q&A
I have a puzzle in my game for which the use of "Crafting" would be the ideal solution: Out of 18 items, the correct 8 have to be put into their appropriate slots (so a "pattern" is involved, too).

Unfortunately, the slots in which the ingredients have to be put are very much scattered on the background image of the scene, so there is no way to use slot orientation options like "vertical", "horizontal" or "grid". I tried to use eight "Ingredients" elements instead of only one and put them into the correct space but noticed that they all just mirror each other.

After trying a handful of different ways, it seemed to me that the second best approach would be writing a sequence of action lists, connected to each other via parameters, that handle hotspot interactions, variable sets and checks, container transfers, visual item replacement object teleports in and out of the slots and so forth … 
… and have this sequence triggered via the Unhandled Events: Use on hotspot action of the Inventory Manager. 
I chose this one because basically each and every inventory item can be put in one of the slots, so I wanted to avoid to create 18 x 8 single interactions.

I believe I have got this set up very well, but there is one thing that I cannot seem to handle: how can I pass the Inventory item selected by the player as a parameter to these action lists?

While the setting allows me to "pass Hotspot as GameObject parameter" (and this is working flawlessly!), I'd like it to "pass Selected Item as InventoryItem parameter", too.

Is this possible – this or any other way?

Thank you.

Comments

  • This isn't possible in the same sense as passing Hotspots - though individual inventory items can have their own Unhandled use on Hotspot ActionLists.

    Know, though, that you can still make use of the Crafting approach - if you switch your Crafting Menu's Source to Unity Ui Prefab, then you can arrange your item slots however you wish.  See this tutorial for more on working with Unity UI prefabs in AC's Menu system.
  • I got this to work, Chris – thank you!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.