HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Sorting Varibles

07-05-2004, 07:08 PM#1
sweet5
Mmmk. I have 5 varibles that need sorta at the end of my game. I have a trigger that does this and works great, EXCEPT when there is a tie :< . So I'll post my trig and if any1 knows how to tell if there is a tie and then pick the winner, plz post. Thx for help.


Code:
[color=Red]End Pig Contest[/color]
    [color=Blue]Events[/color]
        Time - PigTimer expires
    [color=Blue]Conditions[/color]
    [color=Blue]Actions[/color]
        Countdown Timer - Destroy PigTimerWindow
        Game - Display to (All players) the text: TIME IS UP!!! The j...
        Unit - Add A peon-type unit classification to PigOne
        Unit - Add A peon-type unit classification to PigTwo
        Unit - Add A peon-type unit classification to PigThree
        Unit - Add A peon-type unit classification to PigFour
        Unit - Add A peon-type unit classification to PigFive
        Unit - Add A peon-type unit classification to FamerOne
        Unit - Add A peon-type unit classification to FamerTwo
        Unit - Add A peon-type unit classification to FamrerThree
        Unit - Add A peon-type unit classification to FarmerFour
        Unit - Add A peon-type unit classification to FarmerFive
        Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) is A peon-type unit) Equal to True
                    Then - Actions
                        Unit - Move (Picked unit) instantly to (Center of StartEnd <gen>)
                    Else - Actions
        -------- Player One Wins --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Integer(PigSizeOne)) Greater than (Integer(PigSizeTwo))
                (Integer(PigSizeOne)) Greater than (Integer(PigSizeThree))
                (Integer(PigSizeOne)) Greater than (Integer(PigSizeFour))
                (Integer(PigSizeOne)) Greater than (Integer(PigSizeFive))
            Then - Actions
                Game - Display to (All players) the text: ((Name of Player 1 (Red)) +  wins!)
                Wait 10.00 seconds
                Game - Victory Player 1 (Red) (Skip dialogs, Show scores)
                Game - Defeat Player 2 (Blue) with the message: Defeat!
                Game - Defeat Player 3 (Teal) with the message: Defeat!
                Game - Defeat Player 4 (Purple) with the message: Defeat!
                Game - Defeat Player 5 (Yellow) with the message: Defeat!
            Else - Actions

Now this only displays the code for P1 winning cuz the trigger is huge with the other 4 players so yep. Plz help.
07-06-2004, 09:53 PM#2
sweet5
fell back to page 2 o_O ...so bump
10-04-2004, 09:37 PM#3
Waldbaer
If you used "greater equal" (I'm not sure if that's the right English word) instead of "greater than", it would work also and if there is a tie, the first mentioned Player (Player1 in this case) will win.
If you want to make win both highest Scores, you have to add an action for every player, which checks if there is another player with the same score and than make this player win also; in the same way you built the first If/Then/Else.
Very complicated, I see...

I hope I could help a little; otherways continue asking, I'll try to make it better another time...