Forum rules - please read before posting.

Current inventory item in action list

Hi everyone,

I was wondering if there is an option to get currently used inventory item in action list. All I see are parameters and popups and I have to manually set all the items. I am trying to give an item to another player but before giving it I have to check if the item can be given to that player (I have an action that checks appropriate properties of an item). I don't want to specify this action for all inventory items in the game (a lot of them and all would be the same except the item), so I am looking if there is something like current inventory item, but Inventory add and remove methods doesn't have that and runtimeInventory fields like "selected", "last clicked", etc. are giving me null (maybe because I use only keyboard to navigate.

Comments

  • The runtimeInventory.selectedItem variable will always be set regardless of your control setup.  However, once an Interaction runs, the item has been processed and it is set to null by the time the Actions run.

    However, a custom script could read this variable in an Update() function, and assign it to its own InvItem variable, provided that it is not null.  This way, it will always be set to the last-selected item.
  • Hmmm... I thought about saving the InvItemID in AC global variable using an Action when I close inventory, so I won't have to check it every frame. Hoped there was an easier way. As always, thanks for quick response :D
  • edited July 2016
    That too should work if the menu is always closed by the time the interaction runs.
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.