Delete spawned actor from Array...

Hi,

i try to explain my problem. :slight_smile:

I have an Backpack (Actor) with an simple array. I can put things(other Actors) in the Inventory (Actor Array). Everytime i spawn the Backpack Actor, all Actors from the Actor Array spawn around the Backpack Actor. If i grab the backpack again, every Actor get destroyed and respawn after i drop the backpack again (Spawned Item Array). This all works fine.

An example:
nlZjBSJ.png

1,2,3 are different objects and 4 is my Backpack. Backpack

My problem is: I want to delete the objects from the inventory array, after i used them (for example: combine each other to get a new object).

I tried to take the spawned Actor Reference to ‘remove’ from the array but it doesn’t work. Same for ‘Display Name’ comparison, because the names changes.

I’m a bit lost right now because i don’t know how i get a reference from the used actor to the original inventory array.

Maybe over the Spawned Item Array?

I look forward to every note. Thank you.

As far as my experience goes, if you want to destroy an item, first you have to remove it from the arrays it is present, or else it becomes a “pending for delete”.

If that’s not the problem and you don’t know how to delete a certain type of actor, you might want to give a tag to the actors, such as “Wood” and “Water”. Then you can search for “Has Tag” in a foreachloop.

Or you can have your inventory as a struct that contains a list of integer arrays, named after the items that they can contain. So you can lower or increase the number of the said integer array depending on what you use and pick up.

Those are the ways I can think of right now.

I’ll give it a shot. Thank you.

This was the right hint! Thank you! I created a Array (Actor, Names) and use my existing (unique) Tags per Actor.