How often is the For Loop that is driving the entire process of spawning being called? what is the value of “bots to spawn” (the max for the for loop), being set too?
The for loop, depending on how often it is being called, and how many bots it is going to create per call, can make it appear that it’s not working.
If only 4 points to spawn at, there is an “edge” condition in the way that I slapped this together, that gives a 25% chance of reselecting, the prior spawn point.
Pass N - spawn point selected and removed, but now the “in use” array is empty, i.e. length = 0
Pass N+1 - In use array empty, and is refilled, but now because of only 4 spawn points, we have the 1 in 4 chance, that we will select the same spawn point, that we did on Pass N, because it is now back in the array.
to remove a condition like that, would take more nodes for sure. As you would need to test again, after removing the spawn point, and if the length was zero, set a boolean, to remember that you should not select that same location. Then save off that location in a variable, load the in use array from the master, AND remove the location you just saved off in the new variable, from the in use array. then on the next iteration, you would check the boolean (after you have selected the new location), it would be true, then take the saved location and put it into the in use array, and set the boolean to false. That would absolutely guarantee that the same location would never be selected twice.
The For Loop, depending on how fast it’s called, and how many it spawns at any one time, aggrevates this “edge” condition. Or so I think, because I have a feeling it’s spawning more than one bot per call, and the bots are being spawned irrespective if any other bots have died.
Hope this helps!