AI Spawning

I’m trying to spawn a set number of simple AI enemies within an area via a trigger box, which works fine however the amount of enemies spawned is always less than the amount I defined in the enemy count variable.

The amount spawned changes every time I test as well even though the count variable has stayed the same. I’m trying to spawn anywhere between 12-30 enemies in one go I’m testing at 20 at the moment and so far I’ve had 13, 16 and 17. I’m not sure why its different every time or how to get it so it’s the number I have dictated.

any ideas as to where I’m going wrong?

Hey there @BeamMeUpScottty! Since it’s a for loop, these enemies may be failing the spawning collision check. Try enabling the No Collision Fail boolean on the Spawn AI From Class node and let me know if that makes the spawning number consistent.

image

On overlap event: set count to 0, branch decision-> is count < spawnamount-> true → spawn actor → count +=1 → loop execution pin back to branch decision…I like to make the spawnamount an instance editable and expose on spawn variable, that way I can set the spawn amount individually per instance when I place a box in the level