Thread: Awards @ endgame View Single Post
 05-16-2006, 06:39 AM #1 (permalink) Angelusz User     Join Date: Sep 2004 Posts: 638 Awards @ endgame I'm having a problem i can't seem to resolve, my map is some kind of arena, so i thought it would be fun to display some awards at the end of the game, these include; Most kills, most deaths, highest score, most researches, most units bought and most zones taken. I've got triggers running that capture every kill, research, unit sales and zone conquers, variables being set every time something happens, so all the data is there. Problem is that i can't find a decent way to have the game check for the player with the highest value in the variable. I'm using integer arrays for this, per example, i'll show you a bit of code from one of the 7 awards. Code: ```Awards Mostkills Events Conditions Actions For each (Integer A) from 2 to 8, do (Actions) Loop - Actions If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions And - All (Conditions) are true Conditions var_kills_num[1] Greater than or equal to var_kills_num[(Integer A)] Then - Actions Set Info_mostkills_winner = Player 1 (Red) Skip remaining actions Else - Actions For each (Integer A) from 3 to 8, do (Actions) Loop - Actions For each (Integer B) from 1 to 1, do (Actions) Loop - Actions If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions And - All (Conditions) are true Conditions var_kills_num[2] Greater than or equal to var_kills_num[(Integer A)] var_kills_num[2] Greater than or equal to var_kills_num[(Integer B)] Then - Actions Set Info_mostkills_winner = Player 2 (Blue) Skip remaining actions Else - Actions *** Player 3~8 ***``` Now, i've also tried using a temporary variable, i had it check wheter the var_kills_num(integer A) was greater than the temp variable, setting the tempvariable to the current highest to compare with the others again, when it was higher than the current value, setting the corresponding integer's player to the winner variable. This is how i show the awards: Code: ```Actions Cinematic - Clear the screen of text messages for (All players) Game - Display to (All players) for 30.00 seconds the text: |cffc5dbff---------... Game - Display to (All players) for 30.00 seconds the text: |cffffcc00And here ... Game - Display to (All players) for 30.00 seconds the text: |cffc5dbff---------... Game - Display to (All players) for 30.00 seconds the text: (|cffffcc00 + (Assasin:|r + ((PlayerColors[(Player number of Info_mostkills_winner)] + (Name of Info_mostkills_winner)) + ( |cffc5dbffhas killed: + ((|CFFFF0000 + (String(var_kills_num[(Player number of Info_mostkills_winner)]))) + |cffc5dbffunits.))))) ***The other awards (6 more)*** Game - Display to (All players) for 30.00 seconds the text: |cffc5dbff---------... Wait 10.00 seconds Set Awards_done_check = True``` (Sidenote: The playercolors variable contain color info for text coloring, each player's color is set in it) Does anyone have an idea what i'm doing wrong here, or have another way to compare the variables? (after all, that's what this is all about) Thanks in advance, and thanks for taking the time to read 'till here. :)