Hi, I'm trying to make a trigger to figure out how people stack up against each other at the end of a round. My trigger as now is when this is ran, if Shots = numshotstaken13(declared in another trigger, means everyone has shot), it says who the winner is and their total distance. This is no good as it only figures out who has the highest distance.
I have a global variable NumberPlayers_Int = 0 <Integer> to keep track of how many players there are (so you can't place 8th in a game with 7 players)
and a global integer array Gameplay_PlayerPoints_Integer = 0 <Integer[12]> (how many pts total they have)
I'm wondering if there's an easy way to figure out
1.) Who is first,second, third, ...# of playersth
2.) announce the guy who is in first (in this case biggest TotalDistance) and his distance
3.) Add to PlayerPoints for the players (so if there's 8 players in the game, first place gets 8, 2nd place gets 7, 3rd gets 6, so on)
4.) maybe handle ties(same distance) with them both getting the same points(IE tying 7/8 in an 8 player game would give you 1 pt)? Not that important.
5.) if LDSK_TotalDistance_Real[LoopA] (their distance) is 0.0, give them no points
I was never very good at doing this kind of stuff "elegantly" in my CS classes lol. (I could probably do all this with hundreds of lines of GUI...)
This is my trigger. Like I said it figures out who has the biggest distance, and announces it, and gives him #player pts.
Thanks in advance.
I have a global variable NumberPlayers_Int = 0 <Integer> to keep track of how many players there are (so you can't place 8th in a game with 7 players)
and a global integer array Gameplay_PlayerPoints_Integer = 0 <Integer[12]> (how many pts total they have)
I'm wondering if there's an easy way to figure out
1.) Who is first,second, third, ...# of playersth
2.) announce the guy who is in first (in this case biggest TotalDistance) and his distance
3.) Add to PlayerPoints for the players (so if there's 8 players in the game, first place gets 8, 2nd place gets 7, 3rd gets 6, so on)
4.) maybe handle ties(same distance) with them both getting the same points(IE tying 7/8 in an 8 player game would give you 1 pt)? Not that important.
5.) if LDSK_TotalDistance_Real[LoopA] (their distance) is 0.0, give them no points
I was never very good at doing this kind of stuff "elegantly" in my CS classes lol. (I could probably do all this with hundreds of lines of GUI...)
This is my trigger. Like I said it figures out who has the biggest distance, and announces it, and gives him #player pts.
-
General - If (Conditions) then do (Actions) else do (Actions)
-
If
-
LDSK_NumShotsTaken_Integer[13] == Shots
-
-
Then
-
Trigger - Turn (Current trigger) Off
-
General - For each integer LoopA from 1 to 12 with increment 1, do (Actions)
-
Actions
-
General - If (Conditions) then do (Actions) else do (Actions)
-
If
-
LDSK_TotalDistance_Real[LoopA] > FurthestDistance
-
-
Then
-
Variable - Set FurthestDistance = LDSK_TotalDistance_Real[LoopA]
-
Variable - Set HighScorePlayer = LoopA
-
-
Else
-
-
-
-
-
-
Variable - Set Gameplay_PlayerPoints_Integer[HighScorePlayer] = (Gameplay_PlayerPoints_Integer[HighScorePlayer] + NumberPlayers_Int)
-
UI - Display (Combine ((Name of player HighScorePlayer), (Combine (" has won with total distance of ", (Combine ((Text(FurthestDistance) with Any Precision decimal places), " meters!")))))) for (All players) to Subtitle area
-
Else
-
Thanks in advance.