Forum rules - please read before posting.

How to make dropped Scene Items disappear (without interacting with them)

edited October 22 in Technical Q&A

Hi!
I need some guidance on how to correctly set up my "drop item" logic.

My main character is a dog with a backpack who can drop food items on the ground and pick them up again. There are different types of food (carrots, potatoes or poisoned meat, for example).

https://drive.google.com/file/d/1eCYaLXRMep_JujJJB26MKQlLy1ikl5_R/view?usp=sharing

I’ve successfully implemented the Scene Item mechanic following this tutorial

Everything works perfectly. I can drop and pick up items as intended.

However, I need an additional mechanic that I can’t figure out how to implement:
Sometimes, I want dropped items to be lost forever and never return to the player’s inventory. For example:

  • When the player drops food for an NPC to eat.
  • When another NPC “steals” a dropped item.

Is there a clean way to achieve this within the Scene Item logic?
I know how to pick up dropped items, but how could I make it so that an NPC picks up (removes) that specific Scene Item instead?

I thought about using Object: Remove and linking a Scene Item prefab, but that only works if I already know which item was dropped (and I don’t, since it’s instantiated dynamically).

I could build a complex evaluator to detect which item is on the ground using variables, but I’m hoping there’s a simpler, AC-friendly solution I’m missing.

Thanks in advance!

Comments

  • I'm not 100% sure of your meaning. Can such items be taken by an NPC at any time once on the ground, or e.g. immediately after being dropped? How are such items determined if they can be taken by someone else?

    If you want items to be "detected" by a nearby NPC you're likely best off with a custom script to check what's nearby. Though, as a Scene Item is linked to an Inventory item, you might also rely on Inventory property data to set certain flags that can be read through script.

  • Yeah, sorry. Let me clarify a bit! _:)

    The NPCs in my case don't need to detect the item. What I need to know is whether there’s a simple way to remove or destroy a dropped Scene Item (which was spawned from a prefab using “Item to Scene”) without the player interacting with it.

    In the game, there are different scenarios:

    Case 1:
    Sometimes you find a hungry NPC, and the player needs to drop an item near that NPC (any item from the inventory is valid, since all items are food related). Let’s say you choose to drop some meat, and the meat appears on the ground. Then the NPC will immediately take the meat you dropped.

    I don’t need the item to be detected, because I’ve placed a Trigger beneath the NPC, along with a variable. So if you click the “Drop” button in the inventory, the game checks: “Are you near this NPC?” and if so, a cinematic plays where the NPC picks up and eats the food.

    Case 2:
    I was also thinking about implementing a mechanic where the player can drop items in the scene, but those items disappear when you leave the area (as if vermin ate them while you were gone).
    This case seems more complicated.

    So, my question is:
    Is there a recommended way to do this within AC Scene item logic >>> to remove or destroy Scene Item instances that were spawned from prefabs?

  • edited October 23

    So, I’ve managed to solve Case 1, but not Case 2 yet.

    I wasn’t familiar with Inventory Properties before, so I gave it a try.
    I created a popup Inventory Property named "Food Type", basically a list of food items.
    It flags which item I’ve selected at the moment I drop it in front of the NPC. Then I use Inventory: Property to Variable to reflect that property into a generic AC variable (also a popup with a list of food types).

    This way, at that moment, I know exactly which item is on the ground. Knowing which food is placed, I can simply use Object: Remove (and link the prefab from assets) to delete it.
    It seems to work...

    But Case 2 is a lot more complex… I have no idea how I should proceed : (

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.