• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Check player with most lumber

Status
Not open for further replies.
Level 13
Joined
Sep 14, 2008
Messages
1,407
I have a big problem...

I am making "mario party" map where gold represents coins and wood are stars.

Now when the game is over I need a trigger which looks how has the most "stars" and if two player have the same number of "stars" look who has the most coins...

There are 4 players. The trigger must check all of them...

I tried it but my trigger was so big that I had no overview at all...

Maybe it is easier in jass.... But I am not able to code jass unfortunatly...

I really need this trigger... It is the last one which is missing in my map...


I give you anything you want... +rep or credit or both...
 
Level 13
Joined
Oct 27, 2008
Messages
1,176
Use a Array to keep track of the stars

Ok here you go this should do wat u want

  • Untitled Trigger 001
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set Stars1 = (Player 1 (Red) Current gold)
      • Set Stars2 = (Player 2 (Blue) Current gold)
      • Set Stars3 = (Player 3 (Teal) Current gold)
      • Set Stars4 = (Player 4 (Purple) Current gold)

  • Untitled Trigger 002
    • Events
      • Time - Elapsed game time is 300.00 seconds
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Stars1 Greater than Stars2
          • Stars1 Greater than Stars3
          • Stars1 Greater than Stars4
        • Then - Actions
          • Game - Display to (All players) the text: Player 1 has Won
          • Game - Victory Player 1 (Red) (Show 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!
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Stars2 Greater than Stars1
              • Stars2 Greater than Stars3
              • Stars2 Greater than Stars4
            • Then - Actions
              • Game - Display to (All players) the text: Player 2 has Won
              • Game - Victory Player 2 (Blue) (Show dialogs, Show scores)
              • Game - Defeat Player 1 (Red) with the message: Defeat!
              • Game - Defeat Player 3 (Teal) with the message: Defeat!
              • Game - Defeat Player 4 (Purple) with the message: Defeat!
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Stars3 Greater than Stars1
                  • Stars3 Greater than Stars2
                  • Stars3 Greater than Stars4
                • Then - Actions
                  • Game - Display to (All players) the text: Player 3 has Won
                  • Game - Victory Player 3 (Teal) (Show dialogs, Show scores)
                  • Game - Defeat Player 1 (Red) with the message: Defeat!
                  • Game - Defeat Player 2 (Blue) with the message: Defeat!
                  • Game - Defeat Player 4 (Purple) with the message: Defeat!
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Stars4 Greater than Stars1
                      • Stars4 Greater than Stars2
                      • Stars4 Greater than Stars3
                    • Then - Actions
                      • Game - Display to (All players) the text: Player 4 has Won
                      • Game - Victory Player 4 (Purple) (Show dialogs, Show scores)
                      • Game - Defeat Player 1 (Red) with the message: Defeat!
                      • Game - Defeat Player 2 (Blue) with the message: Defeat!
                      • Game - Defeat Player 3 (Teal) with the message: Defeat!
                    • Else - ActionsUntitled Trigger 001
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Coins1 Equal to Coins2
        • Then - Actions
          • Trigger - Run one 2 <gen> (checking conditions)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Coins1 Equal to Coins3
            • Then - Actions
              • Trigger - Run one 3 <gen> (checking conditions)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Coins1 Equal to Coins4
                • Then - Actions
                  • Trigger - Run one 4 <gen> (checking conditions)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Coins2 Equal to Coins3
                    • Then - Actions
                      • Trigger - Run two 3 <gen> (checking conditions)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Coins2 Equal to Coins4
                        • Then - Actions
                          • Trigger - Run two 4 <gen> (checking conditions)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Coins3 Equal to Coins4
                            • Then - Actions
                              • Trigger - Run three 4 <gen> (checking conditions)
                            • Else - Actions
The Number Represent the Player Numbers with Even Stars that are now checking Coins

  • Win Coins 1 2
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Coins1 Greater than Coins2
        • Then - Actions
          • Game - Victory Player 1 (Red) (Show 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!
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Coins2 Greater than Coins1
            • Then - Actions
              • Game - Victory Player 2 (Blue) (Show dialogs, Show scores)
              • Game - Defeat Player 1 (Red) with the message: Defeat!
              • Game - Defeat Player 3 (Teal) with the message: Defeat!
              • Game - Defeat Player 4 (Purple) with the message: Defeat!
            • Else - Actions
  • Win Coins 1 3
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Coins1 Greater than Coins3
        • Then - Actions
          • Game - Victory Player 1 (Red) (Show 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!
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Coins3 Greater than Coins1
            • Then - Actions
              • Game - Victory Player 3 (Teal) (Show dialogs, Show scores)
              • Game - Defeat Player 1 (Red) with the message: Defeat!
              • Game - Defeat Player 2 (Blue) with the message: Defeat!
              • Game - Defeat Player 4 (Purple) with the message: Defeat!
            • Else - Actions
  • Win Coins 1 4
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Coins1 Greater than Coins4
        • Then - Actions
          • Game - Victory Player 1 (Red) (Show 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!
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Coins4 Greater than Coins1
            • Then - Actions
              • Game - Victory Player 4 (Purple) (Show dialogs, Show scores)
              • Game - Defeat Player 1 (Red) with the message: Defeat!
              • Game - Defeat Player 2 (Blue) with the message: Defeat!
              • Game - Defeat Player 3 (Teal) with the message: Defeat!
            • Else - Actions
  • Win Coins 2 3
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Coins2 Greater than Coins3
        • Then - Actions
          • Game - Victory Player 2 (Blue) (Show dialogs, Show scores)
          • Game - Defeat Player 1 (Red) with the message: Defeat!
          • Game - Defeat Player 3 (Teal) with the message: Defeat!
          • Game - Defeat Player 4 (Purple) with the message: Defeat!
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Coins3 Greater than Coins2
            • Then - Actions
              • Game - Victory Player 3 (Teal) (Show dialogs, Show scores)
              • Game - Defeat Player 1 (Red) with the message: Defeat!
              • Game - Defeat Player 2 (Blue) with the message: Defeat!
              • Game - Defeat Player 4 (Purple) with the message: Defeat!
            • Else - Actions
  • Win Coins 2 4
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Coins2 Greater than Coins4
        • Then - Actions
          • Game - Victory Player 2 (Blue) (Show dialogs, Show scores)
          • Game - Defeat Player 1 (Red) with the message: Defeat!
          • Game - Defeat Player 3 (Teal) with the message: Defeat!
          • Game - Defeat Player 4 (Purple) with the message: Defeat!
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Coins4 Greater than Coins2
            • Then - Actions
              • Game - Victory Player 4 (Purple) (Show dialogs, Show scores)
              • Game - Defeat Player 1 (Red) with the message: Defeat!
              • Game - Defeat Player 2 (Blue) with the message: Defeat!
              • Game - Defeat Player 3 (Teal) with the message: Defeat!
            • Else - Actions
  • Win Coins 3 4
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Coins3 Greater than Coins4
        • Then - Actions
          • Game - Victory Player 3 (Teal) (Show dialogs, Show scores)
          • Game - Defeat Player 1 (Red) with the message: Defeat!
          • Game - Defeat Player 2 (Blue) with the message: Defeat!
          • Game - Defeat Player 4 (Purple) with the message: Defeat!
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Coins4 Greater than Coins3
            • Then - Actions
              • Game - Victory Player 4 (Purple) (Show dialogs, Show scores)
              • Game - Defeat Player 2 (Blue) with the message: Defeat!
              • Game - Defeat Player 3 (Teal) with the message: Defeat!
              • Game - Defeat Player 1 (Red) with the message: Defeat!
            • Else - Actions

all u need to change is the event that triggers this
um that should be all of it that u need it should work out the way u want it to just make the arrays and your done
 
Last edited:
Level 13
Joined
Oct 27, 2008
Messages
1,176
part of the trigger is missing 1 second
thx for the rep though
the way its put there is the smallest its going to get
the bottom part is meant to be part of the whole thing not as a different part
 
Level 13
Joined
Oct 27, 2008
Messages
1,176
i do take it serious i only give rep if the info im given when i asked a question helped me in some way
Y i've always liked the hero so im useing the avatar for now
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
Here you go, everything in a single trigger:
  • VictoryTest
    • Events
      • Time - Elapsed game time is 300.00 seconds
    • Conditions
    • Actions
      • Set id = 1
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) Current lumber) Greater than ((Player(id)) Current lumber)
            • Then - Actions
              • Set id = (Integer A)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Player((Integer A))) Current lumber) Equal to ((Player(id)) Current lumber)
                  • ((Player((Integer A))) Current gold) Greater than ((Player(id)) Current gold)
                • Then - Actions
                  • Set id = (Integer A)
                • Else - Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer A) Equal to id
            • Then - Actions
              • Game - Victory (Player((Integer A))) (Show dialogs, Show scores)
              • Game - Display to (All players) the text: (Player + ((String((Integer A))) + has won))
            • Else - Actions
              • Game - Defeat (Player((Integer A))) with the message: Defeat!
Doesn't seem so huge to me :)
 
Status
Not open for further replies.
Top