How can I use multiple Spawn Actor from Class?
I have a Spawn Actor from Class setup and it works great.
I can place one into the world and enemies will spawn at the rate which i have set, the issue is if I fill the world the enemies can spawn outside of the walls / gaps and therefore just fall forever until the game ends... This is an issue as I need a wave based spawning system so round one can spawn x amount of enemies of a certain type and round 2 can spawn more enemies...
When i try to place 2 Spawn Actor from Class in the world the enemies ONLY spawn from the first one and not the second one... I will attach my blueprint and other relevant screenshots.
I am new with unreal so any suggestions would help.
asked Jul 28 '16 at 07:50 PM in Blueprint Scripting
Issue is very simple, you searching all spawner actors but oyu only gettign one with index 0 so only one works... not only that is binded to multiple functions in each EnemySpawner object.
You don't need reference of object of a blueprint you are in, if object pin is not connected it should default to "self" which is object you currently in. If not there is "Self" node that returns current object you are in. So remove whole "Get All Actors Of Class" part, if you get error you need to connect something to Object pin connect "Self" node
answered Jul 28 '16 at 08:13 PM
on your "Enemy Spawner" Event Beginplay -> get all enemy spawner -> get element 0 from array HERE IS THE ERROR you get all spawners with (Get all actors from class...) but then you tell to just use the element 0, everytime you use this function it is returning all Enemy Spawners, for coincidence (or not, i don't know how "get all actors from class" is implemented) the first element from the array is always the same, so the call to spawn enemy in another spawners never happens, to fix instead of all this code in "begin play" i would just use Event BeginPlay->Set Timer By Function Name and use "This" in the "Object" camp (so every spawner would call "spawn enemies" for itself)
edit:other guy answered first, his answer is right, very similar to what i told, i will still leave my answer just in case you think it's easier to understand
Follow this question
Once you sign in you will be able to subscribe for any updates here