I maked Blueprint actor class with which I want to spawn AI. everything works fine but problem come if i place second one to scene… I dont know how to separate them if i want to have two direfent “packs” with same AI class…
2 in scenes… one have max 5 actor second 10 max actors…
Problem - totaly 10 spawned actors unlike 15 …
So what is happening is when NPC count in the scene reaches 5 the First_Spawner stops spawing, and when NPC count reaches 10, the second one stops too.
This is happening because you are using GetAllActorsOfClass in the scene (which is the same for both Spawners) and checking if it reached that MaxNpcCount variable.
So depending on what you need, there is different ways to fix it:
To make each Spawner spawn certain amount of NPC you may create AlreadySpawned int variable and increment it each time you spawn an NPC, then check if it reached MaxNpcCount.
To keep the level of spawned NPC in the level you just set “MaxNpcCount” to desired amount (in this case 15), this way both spawners will keep spawning NPCs until there are 15 of them on the map.
Hope this helps~
Yes like this its working. BUT… How if one or more DIE ? how this solve…
How do you need it to work?
If you need them to spawn only certain number of NPCs, then you can use new int variable to track how many were spawned already.