Destroy actor blueprint problem

Hello everybody,

I’m going to explain you a bit so you can understand.When i press f a wave of monsters spawn. Let’s say 5. I want that when tthe first monster reach the target point to be destroyed.The problem is that when the first monster reaches the target point the last monster spawned is destroyed. Like when 1 reaches target 5 gets destroyed, when 2 reches the target 4 gets destroyed and so on. Any ideas how can i fix this so when the monsters reaches target point dies and not another monster?
Thank you.

BP Link: http://s13.postimg.org/c9bxqg607/Untitled.png

Looking at your blueprint, you’re calling DestroyActor on the most recently spawned class. You could add each new actor to an array then use Get with array min to kill the first actor you spawned. You’ll then have to remove that index from the array to prevent your code calling a null entry.

i’ve tried but i didn’t succed.I mean i understood what you said to count them and then destroy them in the order they arrive but i dont know how to count them… if you have time can you make like a blueprint that does what you’ve said? I’m new to this and i don’t know too much. If it’s too much to ask it’s ok at least now i have a starting point. Thanks

Sure, when I get into the studio tomorrow I’ll knock up a quick snippet for you.

There is no way i could possibly thank you. Is working. It was so “simple” but when you’re a novice felt so hard.I can’t belive you made it working in like 5 mins or so. You’re just amazing.

BP: http://s11.postimg.org/62dqdgbdf/thankyousomuch.png

You can think of an array as a list of things. In your cast, its a list of your monsters. The item at index 0 is the first one you added to the array, and each subsequent addition gets another index (1, 2, 3, 4, etc etc). You can find out how many items are on your list by running Length on the array.

Give this a try:

https://i.imgur.com/vcr1j1e.png