How can I stop spawning an actor after a specific time?

I have 3 target points on my map that every so many seconds spawn a class BP. How can I stop all of them from spawning after lets say…120 seconds?

All of this is set up in my level BP.

thank you.

Well, there are several ways to do this. I’ve used a [Timer][1] that is looped. It calls an event that does the spawning and checks to see if the spawn time is over. If the spawn time is over, stop the Timer.

All the variables like NumberToSpawn, TimeToStopSpawning, etc… are variables I created and named as such to help with the explanation. You could use constants if you want. Also, you could create a function and have all the logic contained in there if you want too. The rest is up to you! =)

I forgot to mention

Another reason I chose to make a custom event was so that you can stick the event anywhere on the BP to help keep it all tidy.

I just reread your post, this might make more sense to use depending on what you want

This is all very helpful. Thanks!! One question though.
I have the spawns to a tick event sequenced to random delays so they com st dofferent times…gow can I set this up with a tick event??

Thanks again for everything!!!

Would you mind posting a picture of your current Blueprint? If you would like to modify your current setup to do what you want it would be easier for me if I could see it rather than re-create it again as I did above.

I’m sorry I don’r really how to do that…

The event tick is sequenced to many different spawn actor from nodes. They all have separate delays before getting to the spawn node to make them constantly spawning at different times. They’re all then plugged into the actor transform and the locations are different Target points I’ve created.
Think of like a game where you’re setting in a room and enemies spawn out of the wall infinitely and you’re seeing how long you can survive…I just need to stop that now.
The timer thing looks promising…I’m just trying to figure out how to set it up with event tick.

I would do a similar thing that I have there with the Branch node. Set up a check on a boolean variable (we’ll call it bCanSpawn) before you spawn your actors using the Branch node. If bCanSpawn is true, spawn away, if it is false, do nothing. You can get the Game Time in Seconds, check if that is greater than your spawn time (120 seconds). If it is greater, then set bCanSpawn to false. Now you wont spawn actors anymore!

Let me know if you need more help. =)

II think.I understand. :slight_smile: let me.try this! Thank you!!