• 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.

Still i am amateur and i know it. How to make this trigger less painful?

Status
Not open for further replies.
Level 18
Joined
Jun 2, 2009
Messages
1,233
I am trying to create turn based hero select system. It works but i know something doesn't feel right.
I bet Uncle, Pyrogasm and Chaosium will be laugh when they see this.

  • TurnPick Copy
    • Events
      • Time - Elapsed game time is 4.00 seconds
    • Conditions
      • mod_tp Equal to True
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Set (Picked player) Food cap to 2
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 2 (Blue) controller) Equal to User
          • (Player 2 (Blue) controller) Not equal to Computer
          • (Player 2 (Blue) slot status) Equal to Is playing
          • PlayerSecti[2] Equal to False
        • Then - Actions
          • Set NextPlayerSecim = Player 2 (Blue)
          • Player - Set NextPlayerSecim Current lumber to 1
          • Game - Display to (All players) for 10.00 seconds the text: (Hero seçme sirasi sende + PlayerNames[(Player number of NextPlayerSecim)])
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Player 8 (Pink) controller) Equal to User
              • (Player 8 (Pink) controller) Not equal to Computer
              • (Player 8 (Pink) slot status) Equal to Is playing
              • PlayerSecti[8] Equal to False
            • Then - Actions
              • Set NextPlayerSecim = Player 8 (Pink)
              • Player - Set NextPlayerSecim Current lumber to 1
              • Game - Display to (All players) for 10.00 seconds the text: (Hero seçme sirasi sende + PlayerNames[(Player number of NextPlayerSecim)])
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Player 3 (Teal) controller) Equal to User
                  • (Player 3 (Teal) controller) Not equal to Computer
                  • (Player 3 (Teal) slot status) Equal to Is playing
                  • PlayerSecti[3] Equal to False
                • Then - Actions
                  • Set NextPlayerSecim = Player 3 (Teal)
                  • Player - Set NextPlayerSecim Current lumber to 1
                  • Game - Display to (All players) for 10.00 seconds the text: (Hero seçme sirasi sende + PlayerNames[(Player number of NextPlayerSecim)])
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Player 9 (Gray) controller) Equal to User
                      • (Player 9 (Gray) controller) Not equal to Computer
                      • (Player 9 (Gray) slot status) Equal to Is playing
                      • PlayerSecti[9] Equal to False
                    • Then - Actions
                      • Set NextPlayerSecim = Player 9 (Gray)
                      • Player - Set NextPlayerSecim Current lumber to 1
                      • Game - Display to (All players) for 10.00 seconds the text: (Hero seçme sirasi sende + PlayerNames[(Player number of NextPlayerSecim)])
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Player 4 (Purple) controller) Equal to User
                          • (Player 4 (Purple) controller) Not equal to Computer
                          • (Player 4 (Purple) slot status) Equal to Is playing
                          • PlayerSecti[4] Equal to False
                        • Then - Actions
                          • Set NextPlayerSecim = Player 4 (Purple)
                          • Player - Set NextPlayerSecim Current lumber to 1
                          • Game - Display to (All players) for 10.00 seconds the text: (Hero seçme sirasi sende + PlayerNames[(Player number of NextPlayerSecim)])
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Player 10 (Light Blue) controller) Equal to User
                              • (Player 10 (Light Blue) controller) Not equal to Computer
                              • (Player 10 (Light Blue) slot status) Equal to Is playing
                              • PlayerSecti[10] Equal to False
                            • Then - Actions
                              • Set NextPlayerSecim = Player 10 (Light Blue)
                              • Player - Set NextPlayerSecim Current lumber to 1
                              • Game - Display to (All players) for 10.00 seconds the text: (Hero seçme sirasi sende + PlayerNames[(Player number of NextPlayerSecim)])
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Player 5 (Yellow) controller) Equal to User
                                  • (Player 5 (Yellow) controller) Not equal to Computer
                                  • (Player 5 (Yellow) slot status) Equal to Is playing
                                  • PlayerSecti[5] Equal to False
                                • Then - Actions
                                  • Set NextPlayerSecim = Player 5 (Yellow)
                                  • Player - Set NextPlayerSecim Current lumber to 1
                                  • Game - Display to (All players) for 10.00 seconds the text: (Hero seçme sirasi sende + PlayerNames[(Player number of NextPlayerSecim)])
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Player 11 (Dark Green) controller) Equal to User
                                      • (Player 11 (Dark Green) controller) Not equal to Computer
                                      • (Player 11 (Dark Green) slot status) Equal to Is playing
                                      • PlayerSecti[11] Equal to False
                                    • Then - Actions
                                      • Set NextPlayerSecim = Player 11 (Dark Green)
                                      • Player - Set NextPlayerSecim Current lumber to 1
                                      • Game - Display to (All players) for 10.00 seconds the text: (Hero seçme sirasi sende + PlayerNames[(Player number of NextPlayerSecim)])
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Player 6 (Orange) controller) Equal to User
                                          • (Player 6 (Orange) controller) Not equal to Computer
                                          • (Player 6 (Orange) slot status) Equal to Is playing
                                          • PlayerSecti[6] Equal to False
                                        • Then - Actions
                                          • Set NextPlayerSecim = Player 6 (Orange)
                                          • Player - Set NextPlayerSecim Current lumber to 1
                                          • Game - Display to (All players) for 10.00 seconds the text: (Hero seçme sirasi sende + PlayerNames[(Player number of NextPlayerSecim)])
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Player 12 (Brown) controller) Equal to User
                                              • (Player 12 (Brown) controller) Not equal to Computer
                                              • (Player 12 (Brown) slot status) Equal to Is playing
                                              • PlayerSecti[12] Equal to False
                                            • Then - Actions
                                              • Set NextPlayerSecim = Player 12 (Brown)
                                              • Player - Set NextPlayerSecim Current lumber to 1
                                              • Game - Display to (All players) for 10.00 seconds the text: (Hero seçme sirasi sende + PlayerNames[(Player number of NextPlayerSecim)])
                                            • Else - Actions
                                              • Game - Display to (All players) for 2.00 seconds the text: secim bitti
  • TurnPick2
    • Events
      • Player - Player 2 (Blue)'s Food used becomes Greater than or equal to 1.00
      • Player - Player 3 (Teal)'s Food used becomes Greater than or equal to 1.00
      • Player - Player 4 (Purple)'s Food used becomes Greater than or equal to 1.00
      • Player - Player 5 (Yellow)'s Food used becomes Greater than or equal to 1.00
      • Player - Player 6 (Orange)'s Food used becomes Greater than or equal to 1.00
      • Player - Player 8 (Pink)'s Food used becomes Greater than or equal to 1.00
      • Player - Player 9 (Gray)'s Food used becomes Greater than or equal to 1.00
      • Player - Player 10 (Light Blue)'s Food used becomes Greater than or equal to 1.00
      • Player - Player 11 (Dark Green)'s Food used becomes Greater than or equal to 1.00
      • Player - Player 12 (Brown)'s Food used becomes Greater than or equal to 1.00
    • Conditions
    • Actions
      • Set PlayerSecti[(Player number of (Triggering player))] = True
      • Trigger - Run TurnPick Copy <gen> (checking conditions)
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
That looks fine to me assuming the only way for the player's Food to increase is by picking a Hero. And you probably want to turn off TurnPick2 once it's all finished. Also, make sure you have a Timer that gives players only 30 seconds or something to choose before TurnPick Copy runs again, otherwise an AFK player can make you wait forever.

How I would do it is store both teams of Players into two different Player Groups, then use a Player array variable to order them properly:
  • Events
    • Time - Elapsed game time is 4.00 seconds
  • Conditions
  • Actions
    • Set NextIndex = -1
    • Player Group - Pick every Player in Team1 and do Actions
      • Loop - Actions
        • Set NextIndex = (NextIndex + 2)
        • Set NextPlayer[NextIndex] = (Picked player)
    • Set NextIndex = 0
    • Player Group - Pick every Player in Team2 and do Actions
      • Loop - Actions
        • Set NextIndex = (NextIndex + 2)
        • Set NextPlayer[NextIndex] = (Picked player)
    • Set NextIndex = 0
    • Trigger - Run Get Next Player (ignoring conditions)
After that's done the Array will be setup so NextPlayer[1] = First player, NextPlayer[2] = Second player, NextPlayer[3] = Third player, etc...

Then I would do something very similar to what you're doing in TurnPick Copy, it would just be a little more organized:
  • Get Next Player
    • Events
    • Conditions
    • Actions
    • Set NextIndex = (NextIndex + 1)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • NextIndex Greater than or Equal to 12
      • Then - Actions
        • // it's finished //
        • Countdown Timer - Pause SelectTimer
        • Skip remaining actions
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • NextPlayer[NextIndex] controller Equal to User
        • NextPlayer[NextIndex] controller Equal to Is playing
      • Then - Actions
        • Set NextPlayerSecim = NextPlayer[NextIndex]
        • Player - Set NextPlayerSecim Current lumber to 1
        • Game - Display to (All players) for 10.00 seconds the text: (Hero seçme sirasi sende + PlayerNames[(Player number of NextPlayerSecim)])
        • Countdown Timer - Start SelectTimer as a One-shot timer that will expire in 30.00 seconds
      • Else - Actions
        • Trigger - Run (this trigger) (ignoring conditions)
So I would run the above trigger whenever I'm getting the Next player for Hero Selection.

The Timer trigger would simply Run the Get Next Player trigger again.

You could also make it so if a Player leaves the game during the Hero Selection process you Run the Get Next Player trigger again.
 
Last edited:
Status
Not open for further replies.
Top