Item spawned at random locations doubles up

I have an event that spawns fuel tanks (4-8 items) at random locations. I can’t seem to figure out how to keep the items from spawning at the same location. Often one will spawn in the same place as the other.
I have even attempted to delete the target point from the level then recalculate the amount of spawn points to no avail.
Thanks for the help.

Shuffle your targets array loop over the first 4 to 8 items.

I’m not sure how a shuffle is going to help. If the indexes don’t get removed, it won’t matter what order they’re in, correct?

This is also a one-time event. It begins on play then spawns the amount of items specified in Max Fuel Amount.

I added the shuffle after the branch just to attempt it but it still uses spawn points already used.

I print the length of the array after every pass and I see the array shrinking appropriately, too.

Thanks.

No scratch the whole thing. Get you locations. Shuffle to randomize and than loop over them but just the amount you need ignoring the rest. If you can wait 3h I can make a screenshot. Currently on mobile.

That worked well, thanks! I removed the random integer, shuffle the array before the spawning, set an integer variable to 0 to start and increment it by 1 after each loop (selecting a new index after each pass).

Sounds a bit strange what you are doing. Just to be sure here =)

This is more Optimized if you want to call it Multiple times and not Spawn at the same Point again and also you can pass how Many to spawn.

And in case you want to let items Spawn at any point again just call this :stuck_out_tongue_winking_eye:

I guess now you are covered with almost anything.

Thanks, Nachtmahr. Your first link is pretty much what I had, but your way is a bit cleaner. Using your method allowed me to eliminate a couple variables and I like the index validity check. I appreciate the in-depth response.