• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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.
 
Level 13
Joined
Jun 5, 2008
Messages
504
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.
Top