• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Check GUI Triggers

Status
Not open for further replies.
Level 17
Joined
Jun 12, 2007
Messages
1,261
I have made 3 triggers using a loop, I'm not used to work with loops.
Because I can't test this for multiple players at the same time. (Since my map is not yet playable for multiple players.)

Could u check these 3 triggers and tell me if they are optimized good (for gui) and work fine?
I could only test them for 1player, not for multiple players so I think they might do weird stuff.

  • Player Kills
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Dying unit)) Equal to Player 12 (Brown)
              • (Owner of (Killing unit)) Equal to (Player((Integer A)))
            • Then - Actions
              • Set PlayerKills[(Integer A)] = (PlayerKills[(Integer A)] + 1)
              • Multiboard - Set the text for GameStats item in column 4, row ((Integer A) + 1) to (String(PlayerKills[(Integer A)]))
            • Else - Actions
  • Player Dies
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set HeroesAlive = (HeroesAlive - 1)
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Dying unit) is A Hero) Equal to True
              • (Owner of (Dying unit)) Equal to (Player((Integer A)))
            • Then - Actions
              • Set PlayerAliveCheck[(Integer A)] = False
              • Set PlayerRessurects[(Integer A)] = (PlayerRessurects[(Integer A)] - 1)
              • Game - Display to (All players) the text: (PlayerColor[(Integer A)] + ((Name of (Player((Integer A)))) + has died.))
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units owned by (Player((Integer A)))) and do (Actions)
                • Loop - Actions
                  • Unit - Remove (Triggering unit) from the game
              • Custom script: set bj_wantDestroyGroup = true
              • Player Group - Pick every player in (All enemies of Player 12 (Brown)) and do (Actions)
                • Loop - Actions
                  • Player - Make (Picked player) treat (Player((Integer A))) as an Neutral with shared vision
              • Multiboard - Set the text for GameStats item in column 2, row ((Integer A) + 1) to (|cffFF0202 + Dead)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • PlayerRessurects[(Integer A)] Greater than or equal to 1
                • Then - Actions
                  • Set HeroGrave[(Integer A)] = (Position of (Dying unit))
                  • Unit - Create 1 Grave for (Player((Integer A))) at HeroGrave[(Integer A)] facing 270.00 degrees
                  • Custom script: call RemoveLocation(udg_HeroGrave[GetForLoopIndexA()])
                • Else - Actions
            • Else - Actions
  • Player Leaves
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 (Blue) leaves the game
      • Player - Player 3 (Teal) leaves the game
      • Player - Player 4 (Purple) leaves the game
      • Player - Player 5 (Yellow) leaves the game
      • Player - Player 6 (Orange) leaves the game
      • Player - Player 7 (Green) leaves the game
      • Player - Player 8 (Pink) leaves the game
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering player) Equal to (Player((Integer A)))
            • Then - Actions
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units in (Playable map area) owned by (Player((Integer A)))) and do (Actions)
                • Loop - Actions
                  • Unit - Remove (Picked unit) from the game
              • Game - Display to (All players) the text: (PlayerColor[(Integer A)] + ((Name of (Player((Integer A)))) + has left the game, what a coward.))
              • Multiboard - Set the text for GameStats item in column 2, row ((Integer A) + 1) to (PlayerColor[9] + -Left-)
            • Else - Actions
+Rep for people that help.
 
Atleast the loop for last trigger is totally useless. Use triggering player instead, and you dont need loop in that.

*edit* Nop thats no way to use loops, no need for them. Every trigger can be done without loops.

I cannot say if it works, but certainly there is better way to do it.
 
Status
Not open for further replies.
Back
Top