In my map, I have 4 "areas" people can spawn, and I need a trigger to randomly pick people so that they can actually face another player. However, I have come across some problems that my code does not work for. My map only has 4 players, and there are 8 spots you can spawn (each area has 2 spawn points), so it is possible that all players could be placed in a different area and would then have no opponent. Also, I do not know what to do if there are an odd number of players in the game, because at least one person would always be left out (I was considering making a viewer mode, but then I do not know how to make sure that this player would be picked for the next round so that they don't have to just watch the entire time). I do want it to be random so that you do not get the same opponent on the same area every time. What should I do to solve this?
if anyone is marked as a spectator (more info on this below)
- pick a random area, assign the spectator and a random player to the area
if there are at least two players that haven't been placed yet
- pick a random area, pick 2 random players - this ensures everyone is facing off against someone
if there's only 1 player that hasn't been placed yet
- use a variable or player group or something to mark the player as a spectator for the round
if you want to actively prevent facing the same opponent twice, you'd have to track who's faced who and when picking the second random player pick from those that he hasn't faced yet.
In my map, I have 4 "areas" people can spawn, and I need a trigger to randomly pick people so that they can actually face another player. However, I have come across some problems that my code does not work for. My map only has 4 players, and there are 8 spots you can spawn (each area has 2 spawn points), so it is possible that all players could be placed in a different area and would then have no opponent. Also, I do not know what to do if there are an odd number of players in the game, because at least one person would always be left out (I was considering making a viewer mode, but then I do not know how to make sure that this player would be picked for the next round so that they don't have to just watch the entire time). I do want it to be random so that you do not get the same opponent on the same area every time. What should I do to solve this?
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
@fishy77: Go
These sound like design questions...
if anyone is marked as a spectator (more info on this below) - pick a random area, assign the spectator and a random player to the area
if there are at least two players that haven't been placed yet
- pick a random area, pick 2 random players - this ensures everyone is facing off against someone
if there's only 1 player that hasn't been placed yet
- use a variable or player group or something to mark the player as a spectator for the round
if you want to actively prevent facing the same opponent twice, you'd have to track who's faced who and when picking the second random player pick from those that he hasn't faced yet.