Forum rules - please read before posting.

Preventing Player removing Item from Container

edited May 2018 in Technical Q&A
Let's say I have an Inventory Item with "Can carry multiple?" set to False (i.e. I only want the Player to be able to carry one of those items at a time), and let's say that he's already got that item

Let's also say that I have a Container somewhere that contains the item (because at some point in the game he's going to lose the item from his Inventory, and he'll need to replenish it somehow)

As the system currently stands, if he goes to the Container and takes the item, it isn't added to his Inventory (as expected, because he can't carry multiple versions of it), BUT, it also disappears from the Container

That last is not what I want to happen. What I want to happen is either that the Inventory Item is greyed out in the Container so that he can see it's there but can't take it, or that the action of attempting to take the Item results in a "You can only carry one of those at a time" type message and the item remains in the Container

Any pointers on the best way to tackle this?


(Unity 2017.3.1f1, AC 1.62.6)

Comments

  • I consider this a bug, so will work on a fix.

    So far as having a response if the player tries to remove an item they cannot, I will also introduce a new custom event "OnContainerRemoveFail", which can be used to hook custom code (to e.g. run an ActionList) in this instance.
  • Cool (to both those things)

    I'd been toying with all kinds of hacky workrounds, but I'll just put it to one side now until the fix comes out
  • Sorry to be a pest

    The latest AC release has fixed the issue where a player tries to remove from a container a single-possession item that they already own. Unfortunately, if they sneakily select "Take All", the item still gets removed from the container

    As the "Take All" button runs an ActionList, it will be simple for me to edit that to insert a check for my own particular use-case for the moment, but you'll probably want to issue an official fix at some point
  • Quite right - thanks for the alert.
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.