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.

Found this answer implementing a distance check on actors in array, neat! Get all actors in distance ...? - World Creation - Unreal Engine Forums

and i was going it wrong

https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/FindingActors/Blueprints/index.html

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.

59725-queen_createdispatcher.png

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.

59724-castleevents.png

When the Queen is killed you send out a dispatcher call and everyone bound to this event will be informed.

59726-queen_calldispatcher.png