Destroy All actors of class an area
Hello! I'm looking to make sure when I destroy all actors of my class it is not going server wide but is being replicated and called from the server if that makes any sense
Queen spawns castle
Human player kills Queen
Queens castle destroyed event
More than 1 queen spawning on a server using the same actors
So even with tags, don't the other duplicate Queens get the same tags and all castles are destroyed server wide at the same moment?
I had a crazy idea where I gave each building a random float on spawn and checked that against destroying actor, wanted to get some professional advice before I winged it.
You could store the owning Queen's reference in the castle actor, either as the Owner or in a custom variable. Either way, when the Queen is killed, you loop over all castles and destroy the one(s) whose owning Queen is the one that was killed. (You'll need to make sure that the Queen actor only gets destroyed after all her castles have been destroyed.)
A slightly more complicated but more flexible way would be to add an event dispatcher to the Queen to inform any actor "listening" when the Queen is killed.
Then you create a custom event in the Castle and define whatever you want to happen when the Queen is killed. Then you bind this custom event to the Queen's dispatcher.
When the Queen is killed you send out a dispatcher call and everyone bound to this event will be informed.
answered Sep 22 '15 at 05:24 PM
Found this answer implementing a distance check on actors in array, neat! https://answers.unrealengine.com/questions/29320/get-all-actors-in-distance.html
and i was going it wrong
Follow this question
Once you sign in you will be able to subscribe for any updates here