Been trying to figure out a way to have a set amount of turrets constantly respawn (aka so there is always a set amount in the world), I have got them to be able to spawn at 4 random locations as soon as you start the level but only spawns one. In bullet points:
- Turrets spawn at random locations fine
- Need turrets to constantly respawn (after a short delay (which I know how to do)) and not just at the start of the level
- Need to figure out a way to make multiple turrets spawn instead of just one
- Need Turrets to respawn (to a max value I set so there is only so many in the world) when destroyed
Here is a short video showing how it works currently and what code it uses to spawn them https://youtu.be/ZjIj0fAorfA
You can use a timer. Once every second, or so, check how many turrets there are, if it’s not enough, spawn some more
Hey there @ShadowninjaGB! Welcome to the community! You could check them repeatedly like Clockwork mentioned, but another method would be having the manager put them in an array every time they are spawned, and remove them from the array when destroyed. This could be done with an observer pattern setup or if there’s only ever one manager you can just hardcode it by having each turret tell the manager when they have spawned or died directly.
Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.