x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Beginner Question: How do I store actors in an array then destroy them when the character that spawned then dies

This character spawns a house, I would like the house to be destroyed when he dies. I could simply add and event to each object variable, but I'm hoping to learn something new, adding and storing to array's is eluding me.

Trying to figure out how I would even start a notification system for spawned objects then checking if the thus object is spawned and limiting over spawning elsewhere.

Multiple characters are being spawned in around the world that are building these houses, would keep them in check.

alt text

alt text

Product Version: Game Mod
Tags:
more ▼

asked Sep 20 '15 at 04:12 PM in Blueprint Scripting

avatar image

Samson F.
56 29 17 25

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

In things you want to destroy when players dies you bind On Destroyed event delegate from that actor that will die or make your own event dispatcher that triggers when play dies if you got specfic system:

https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/AActor/OnDestroyed/index.html

You should have "Bind" nodes when you pull dying actor pin. From binded event you make a code that destroys the object. When dying actor will be destroyed it will call all binded events from delegate, which (if you sish) will destroy objects that have binded that event.

As for a array, considering all objects will be destroyed, you simply clear the array when actor is destroyed, or if array is in dying actor then you can leave it as array will be destroyed with him.

Here you have docs about event dispachers (in C++ they are called Delegates and you may hear that name more):

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/EventDispatcher/index.html

more ▼

answered Sep 20 '15 at 04:43 PM

avatar image

Shadowriver
35.9k 929 169 1105

avatar image Samson F. Sep 20 '15 at 05:12 PM

thank you for the answer

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question