How to stop spawning items on the same target point

My “Collectable” actor should spawn on the map 5 times, but I want to spawn it in random target points, but they can spawn in the same target points like on the image. How can I fix this? (I tried to remove indexes but I think I did it wrong)


2 Likes

Put the random number in a variable, and then use that variable to remove the index :slight_smile:

3 Likes

Or, even easier:

2 Likes

Small note: this will spawn an item at each point, even if where are more than 5 items have already spawned. But it’ll work if use For EachLoop with Break. For example (variable Count is 0 at beginning):


Or without extra variable: just connect Array Index pin from For Each Loop with Break to Branch condition and change it to ArrayIndex>=4.

5 Likes

Thanks, @ClockworkOcean and @mnelenpridumivat but it didn’t work until I fixed it myself. Here is the right solution:

1 Like