• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Awards @ endgame

Status
Not open for further replies.
Level 9
Joined
Sep 8, 2004
Messages
633
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. :)
 
Level 4
Joined
Feb 12, 2006
Messages
99
If I had to do that I would use the eye doctor method. Checking red's against blue's, then setting a variable to the higher one. I'd check the variable against teal, and so on. I've never really gotten how do do the integer A and integer B things..
 
Level 9
Joined
Sep 8, 2004
Messages
633
Xander- said:
If I had to do that I would use the eye doctor method. Checking red's against blue's, then setting a variable to the higher one. I'd check the variable against teal, and so on. I've never really gotten how do do the integer A and integer B things..

That is what this one does. (With integer and array integer variables)
 
Status
Not open for further replies.
Top