• 🏆 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!

How can i make this trigger "better" because it is too long

Status
Not open for further replies.
Level 17
Joined
Jun 2, 2009
Messages
1,137
How can i make this trigger better optimized? Specially i am talking about "player" sections.

  • Baslangic Triggerlari
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Game - Set the time of day to 5.00
      • Game - Set time of day speed to 100.00% of the default speed
      • Hashtable - Create a hashtable
      • Set hash = (Last created hashtable)
      • Custom script: call ExecuteFunc("RegisterItemCosts")
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Player 1 (Red) controller) Equal to User
              • (Player 7 (Green) controller) Equal to User
        • Then - Actions
          • -------- Obslu oyun --------
          • Set ClanDevilPlayer = Neutral Victim
          • Camera - Set Player 1 (Red)'s camera Field of view to 90.00 over 0.00 seconds
          • Set ClanReaperPlayer = Neutral Extra
          • Camera - Set Player 7 (Green)'s camera Field of view to 90.00 over 0.00 seconds
        • Else - Actions
          • -------- Obssuz oyun --------
          • Set ClanDevilPlayer = Player 1 (Red)
          • Set ClanReaperPlayer = Player 7 (Green)
          • -------- Devil ayarlar --------
          • Player - Make ClanDevilPlayer treat Player 2 (Blue) as an Ally with shared vision
          • Player - Make ClanDevilPlayer treat Player 3 (Teal) as an Ally with shared vision
          • Player - Make ClanDevilPlayer treat Player 4 (Purple) as an Ally with shared vision
          • Player - Make ClanDevilPlayer treat Player 5 (Yellow) as an Ally with shared vision
          • Player - Make ClanDevilPlayer treat Player 6 (Orange) as an Ally with shared vision
          • Player - Make ClanDevilPlayer treat Player 8 (Pink) as an Enemy
          • Player - Make ClanDevilPlayer treat Player 9 (Gray) as an Enemy
          • Player - Make ClanDevilPlayer treat Player 10 (Light Blue) as an Enemy
          • Player - Make ClanDevilPlayer treat Player 11 (Dark Green) as an Enemy
          • Player - Make ClanDevilPlayer treat Player 12 (Brown) as an Enemy
          • Player - Make Player 2 (Blue) treat ClanDevilPlayer as an Ally with shared vision
          • Player - Make Player 3 (Teal) treat ClanDevilPlayer as an Ally with shared vision
          • Player - Make Player 4 (Purple) treat ClanDevilPlayer as an Ally with shared vision
          • Player - Make Player 5 (Yellow) treat ClanDevilPlayer as an Ally with shared vision
          • Player - Make Player 6 (Orange) treat ClanDevilPlayer as an Ally with shared vision
          • Player - Make Player 8 (Pink) treat ClanDevilPlayer as an Enemy
          • Player - Make Player 9 (Gray) treat ClanDevilPlayer as an Enemy
          • Player - Make Player 10 (Light Blue) treat ClanDevilPlayer as an Enemy
          • Player - Make Player 11 (Dark Green) treat ClanDevilPlayer as an Enemy
          • Player - Make Player 12 (Brown) treat ClanDevilPlayer as an Enemy
          • -------- Reaper ayarlar --------
          • Player - Make ClanReaperPlayer treat Player 2 (Blue) as an Enemy
          • Player - Make ClanReaperPlayer treat Player 3 (Teal) as an Enemy
          • Player - Make ClanReaperPlayer treat Player 4 (Purple) as an Enemy
          • Player - Make ClanReaperPlayer treat Player 5 (Yellow) as an Enemy
          • Player - Make ClanReaperPlayer treat Player 6 (Orange) as an Enemy
          • Player - Make ClanReaperPlayer treat Player 8 (Pink) as an Ally with shared vision
          • Player - Make ClanReaperPlayer treat Player 9 (Gray) as an Ally with shared vision
          • Player - Make ClanReaperPlayer treat Player 10 (Light Blue) as an Ally with shared vision
          • Player - Make ClanReaperPlayer treat Player 11 (Dark Green) as an Ally with shared vision
          • Player - Make ClanReaperPlayer treat Player 12 (Brown) as an Ally with shared vision
          • Player - Make Player 2 (Blue) treat ClanReaperPlayer as an Enemy
          • Player - Make Player 3 (Teal) treat ClanReaperPlayer as an Enemy
          • Player - Make Player 4 (Purple) treat ClanReaperPlayer as an Enemy
          • Player - Make Player 5 (Yellow) treat ClanReaperPlayer as an Enemy
          • Player - Make Player 6 (Orange) treat ClanReaperPlayer as an Enemy
          • Player - Make Player 8 (Pink) treat ClanReaperPlayer as an Ally with shared vision
          • Player - Make Player 9 (Gray) treat ClanReaperPlayer as an Ally with shared vision
          • Player - Make Player 10 (Light Blue) treat ClanReaperPlayer as an Ally with shared vision
          • Player - Make Player 11 (Dark Green) treat ClanReaperPlayer as an Ally with shared vision
          • Player - Make Player 12 (Brown) treat ClanReaperPlayer as an Ally with shared vision
      • -------- Harita üzerindeki eski unitleri deistir --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ClanDevilPlayer Not equal to Player 1 (Red)
        • Then - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
            • Loop - Actions
              • Unit - Change ownership of (Picked unit) to ClanDevilPlayer and Retain color
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ClanReaperPlayer Not equal to Player 7 (Green)
        • Then - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by Player 7 (Green)) and do (Actions)
            • Loop - Actions
              • Unit - Change ownership of (Picked unit) to ClanReaperPlayer and Retain color
        • Else - Actions
      • Set GOD_ButtonNumber = 8
      • Set GOD_Buton_Name[1] = |cff00ff00Orman|r
      • Set GOD_Buton_Name[2] = |cff87cefaDestek|r
      • Set GOD_Buton_Name[3] = |cffff8c00+%20 vurus hızı|r
      • Set GOD_Buton_Name[4] = |cffff8c00+5 zirh|r
      • Set GOD_Buton_Name[5] = |cffff8c00+12 hasar|r
      • Set GOD_Buton_Name[6] = |cffff8c00+6 strength|r
      • Set GOD_Buton_Name[7] = |cffff8c00+6 intelligence|r
      • Set GOD_Buton_Name[8] = |cffff8c00+6 agility|r
      • -------- Spellbooklar --------
      • Set GOD_Ability[1] = GOD Orman
      • Set GOD_Ability[2] = GOD Destek
      • Set GOD_Ability[3] = God 3 // AS
      • Set GOD_Ability[4] = God 4 // ARMOR
      • Set GOD_Ability[5] = God 5 // DAMAGE
      • Set GOD_Ability[6] = God 6 // str
      • Set GOD_Ability[7] = God 7 // int
      • Set GOD_Ability[8] = God 8 // agi
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Turn Gives bounty On for (Picked player)
          • For each (Integer A) from 1 to 12, do (Actions)
            • Loop - Actions
              • Player - Disable GOD_Ability[(Integer A)] for (Picked player)
      • -------- Spellbooklarin içlerindekiler --------
      • Set GOD_Sub_Ability[1] = GOD ORMAN REAL
      • Set GOD_Sub_Ability[2] = GOD DESTEK REAL
      • Set GOD_Sub_Ability[3] = GOD AS (20%)
      • Set GOD_Sub_Ability[4] = GOD ARMOR (+5)
      • Set GOD_Sub_Ability[5] = GOD DAMAGE (+12)
      • Set GOD_Sub_Ability[6] = Item Hero Stat Bonus (+6 Strength)
      • Set GOD_Sub_Ability[7] = Item Hero Stat Bonus (+6 Intelligence)
      • Set GOD_Sub_Ability[8] = Item Hero Stat Bonus (+6 Agility)
      • Set GOD_Sub_Ability[9] = stat int 8//
      • Set GOD_Sub_Ability[10] = stat agi 8//
      • Set GOD_Nick[1] = |cff87cefaOrman|n
      • Set GOD_Nick[2] = |cff87cefaDestek|r|n
      • Set GOD_Nick[3] = |cff87cefaAS|r|n
      • Set GOD_Nick[4] = |cff87cefaARMOR|r|n
      • Set GOD_Nick[5] = |cff87cefaDMG|r|n
      • Set GOD_Nick[6] = |cff87cefaSTR|r|n
      • Set GOD_Nick[7] = |cff87cefaINT|r|n
      • Set GOD_Nick[8] = |cff87cefaAGI|r|n
      • Player - Make ClanDevilPlayer treat ClanReaperPlayer as an Enemy
      • Player - Make ClanReaperPlayer treat ClanDevilPlayer as an Enemy
      • Player - Make Player 2 (Blue) treat Neutral Passive as an Enemy
      • Player - Make Player 3 (Teal) treat Neutral Passive as an Enemy
      • Player - Make Player 4 (Purple) treat Neutral Passive as an Enemy
      • Player - Make Player 5 (Yellow) treat Neutral Passive as an Enemy
      • Player - Make Player 6 (Orange) treat Neutral Passive as an Enemy
      • Player - Make Player 8 (Pink) treat Neutral Passive as an Enemy
      • Player - Make Player 9 (Gray) treat Neutral Passive as an Enemy
      • Player - Make Player 10 (Light Blue) treat Neutral Passive as an Enemy
      • Player - Make Player 11 (Dark Green) treat Neutral Passive as an Enemy
      • Player - Make Player 12 (Brown) treat Neutral Passive as an Enemy
      • Player - Make Neutral Passive treat ClanDevilPlayer as an Enemy
      • Player - Make Neutral Passive treat ClanReaperPlayer as an Enemy
      • Player - Make Neutral Passive treat Player 2 (Blue) as an Enemy
      • Player - Make Neutral Passive treat Player 3 (Teal) as an Enemy
      • Player - Make Neutral Passive treat Player 4 (Purple) as an Enemy
      • Player - Make Neutral Passive treat Player 5 (Yellow) as an Enemy
      • Player - Make Neutral Passive treat Player 6 (Orange) as an Enemy
      • Player - Make Neutral Passive treat Player 8 (Pink) as an Enemy
      • Player - Make Neutral Passive treat Player 9 (Gray) as an Enemy
      • Player - Make Neutral Passive treat Player 10 (Light Blue) as an Enemy
      • Player - Make Neutral Passive treat Player 11 (Dark Green) as an Enemy
      • Player - Make Neutral Passive treat Player 12 (Brown) as an Enemy
      • Set Circle[2] = Kasa 0059 <gen>
      • Set Circle[3] = Kasa 0090 <gen>
      • Set Circle[4] = Kasa 0091 <gen>
      • Set Circle[5] = Kasa 0093 <gen>
      • Set Circle[6] = Kasa 0092 <gen>
      • Set Circle[8] = Kasa 0077 <gen>
      • Set Circle[9] = Kasa 0082 <gen>
      • Set Circle[10] = Kasa 0083 <gen>
      • Set Circle[11] = Kasa 0085 <gen>
      • Set Circle[12] = Kasa 0084 <gen>
      • Unit - Make Clan Reaper's Headquarter 0004 <gen> Invulnerable
      • Unit - Make Clan Devil's Headquarter 0003 <gen> Invulnerable
      • Player - Set name of ClanDevilPlayer to |cffff0000Clan Devi...
      • Player - Change color of ClanDevilPlayer to Red, Changing color of existing units
      • Player - Set name of ClanReaperPlayer to |cffda70d6Clan Reap...
      • Player - Change color of ClanReaperPlayer to Purple, Changing color of existing units
      • Set PlayingPlayers = (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing)))
      • Player Group - Pick every player in PlayingPlayers and do (Actions)
        • Loop - Actions
          • Player - Set (Picked player) Current gold to 700
          • Player - Set (Picked player) Food cap to 3
          • Camera - Pan camera for (Picked player) to (Center of StartCamera <gen>) over 0.20 seconds
          • Camera - Set (Picked player)'s camera Field of view to 90.00 over 0.00 seconds
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across StartCamera <gen>
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across Region 079 <gen>
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across AltarVisibility <gen>
          • Hero - Make (Picked player) Heroes gain 100.00% experience from future kills
      • Set DevilPlayersArray[0] = ClanDevilPlayer
      • Set DevilPlayersArray[1] = Player 2 (Blue)
      • Set DevilPlayersArray[2] = Player 3 (Teal)
      • Set DevilPlayersArray[3] = Player 4 (Purple)
      • Set DevilPlayersArray[4] = Player 5 (Yellow)
      • Set DevilPlayersArray[5] = Player 6 (Orange)
      • Set ReaperPlayersArray[0] = ClanReaperPlayer
      • Set ReaperPlayersArray[1] = Player 8 (Pink)
      • Set ReaperPlayersArray[2] = Player 9 (Gray)
      • Set ReaperPlayersArray[3] = Player 10 (Light Blue)
      • Set ReaperPlayersArray[4] = Player 11 (Dark Green)
      • Set ReaperPlayersArray[5] = Player 12 (Brown)
      • Set Player_Colors[(Player number of ClanDevilPlayer)] = |CFFFF0303
      • Set Player_Colors[2] = |CFF0042FF
      • Set Player_Colors[3] = |CFF1CE6B9
      • Set Player_Colors[4] = |CFF540081
      • Set Player_Colors[5] = |CFFFFFC00
      • Set Player_Colors[6] = |CFFFE8A0E
      • Set Player_Colors[(Player number of ClanReaperPlayer)] = |CFF20C000
      • Set Player_Colors[8] = |CFFE55BB0
      • Set Player_Colors[9] = |CFF959697
      • Set Player_Colors[10] = |CFF7FBFF1
      • Set Player_Colors[11] = |CFF004040
      • Set Player_Colors[12] = |CFF492A04
      • For each (Integer A) from 1 to 16, do (Actions)
        • Loop - Actions
          • Set PlayerNames[(Integer A)] = ((Player_Colors[(Integer A)] + (Name of (Player((Integer A))))) + |r)
      • Set Combine_Charged_Items = True
      • Set Combine_Charges_Max = 3
      • Set PlayerNames[(Player number of ClanDevilPlayer)] = |cffff0000Clan Devil|r
      • Set PlayerNames[(Player number of ClanReaperPlayer)] = |cffda70d6Clan Reaper|r
      • Player Group - Add Player 2 (Blue) to ClanDevilPlayers
      • Player Group - Add Player 3 (Teal) to ClanDevilPlayers
      • Player Group - Add Player 4 (Purple) to ClanDevilPlayers
      • Player Group - Add Player 5 (Yellow) to ClanDevilPlayers
      • Player Group - Add Player 6 (Orange) to ClanDevilPlayers
      • Player Group - Add Player 8 (Pink) to ClanReaperPlayers
      • Player Group - Add Player 9 (Gray) to ClanReaperPlayers
      • Player Group - Add Player 10 (Light Blue) to ClanReaperPlayers
      • Player Group - Add Player 11 (Dark Green) to ClanReaperPlayers
      • Player Group - Add Player 12 (Brown) to ClanReaperPlayers
 
You can use a
  • Player Group - Pick every player in (All players) and do (Actions)
to do actions for each player in a... group. Instead of "All Players", I'd use 3 Player Groups, one for Player 2 to 6, second for Player 8-12, third for both combined. Then you just select the correct group for your action and do something like:
  • Player - Make (Picked Player) treat Neutral Passive as an Enemy
 
Level 3
Joined
Oct 28, 2010
Messages
6
You could make good use of loops in many places. The following one would make Neutral Passive treat player 2-12 as an enemy.

  • Untitled Trigger 001 Copy
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 2 to 12, do (Actions)
        • Loop - Actions
          • Player - Make Neutral Passive treat (Player((Integer A))) as an Enemy
 
Level 17
Joined
Jun 2, 2009
Messages
1,137
Wow. Clever. Here is the situation. I have added Player 2 to 6 to ClanDevilPlayers and Player 8 to 12 ClanReaperPlayers

  • Player Group - Add Player 2 (Blue) to ClanDevilPlayers
  • Player Group - Add Player 3 (Teal) to ClanDevilPlayers
  • Player Group - Add Player 4 (Purple) to ClanDevilPlayers
  • Player Group - Add Player 5 (Yellow) to ClanDevilPlayers
  • Player Group - Add Player 6 (Orange) to ClanDevilPlayers
  • Player Group - Add Player 8 (Pink) to ClanReaperPlayers
  • Player Group - Add Player 9 (Gray) to ClanReaperPlayers
  • Player Group - Add Player 10 (Light Blue) to ClanReaperPlayers
  • Player Group - Add Player 11 (Dark Green) to ClanReaperPlayers
  • Player Group - Add Player 12 (Brown) to ClanReaperPlayers
Now it will gonna work? Clan Devil (1) ally with players 2 to 6
Clan Reaper (7) ally with players 8 to 12

Player 1 to 6 VS player 7 to 12
This is what i want from this trigger

1-) ClanDevilPlayers ALLY with ClanDevilPlayer (player 1)
2-) Player 1 ALLY with ClanDevilPlayers
3-) ClanDevilPlayer ENEMY to Player 7 to 12

  • Player Group - Pick every player in ClanDevilPlayers and do (Actions)
    • Loop - Actions
      • Player - Make (Picked player) treat ClanDevilPlayer as an Ally with shared vision
      • Player - Make ClanDevilPlayer treat (Picked player) as an Ally with shared vision
      • For each (Integer A) from 7 to 12, do (Actions)
        • Loop - Actions
          • Player - Make ClanDevilPlayer treat (Player((Integer A))) as an Enemy
And this is for the Clan Reaper (7 to 12)

  • Player Group - Pick every player in ClanReaperPlayers and do (Actions)
    • Loop - Actions
      • Player - Make (Picked player) treat ClanReaperPlayer as an Ally with shared vision
      • Player - Make ClanReaperPlayer treat (Picked player) as an Ally with shared vision
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Player - Make ClanReaperPlayer treat (Player((Integer A))) as an Enemy
Is everything allright? Because i believe i am missing something in there.

  • Baslangic Triggerlari
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Game - Set the time of day to 5.00
      • Hashtable - Create a hashtable
      • Set hash = (Last created hashtable)
      • Custom script: call ExecuteFunc("RegisterItemCosts")
      • Player Group - Add Player 2 (Blue) to ClanDevilPlayers
      • Player Group - Add Player 3 (Teal) to ClanDevilPlayers
      • Player Group - Add Player 4 (Purple) to ClanDevilPlayers
      • Player Group - Add Player 5 (Yellow) to ClanDevilPlayers
      • Player Group - Add Player 6 (Orange) to ClanDevilPlayers
      • Player Group - Add Player 8 (Pink) to ClanReaperPlayers
      • Player Group - Add Player 9 (Gray) to ClanReaperPlayers
      • Player Group - Add Player 10 (Light Blue) to ClanReaperPlayers
      • Player Group - Add Player 11 (Dark Green) to ClanReaperPlayers
      • Player Group - Add Player 12 (Brown) to ClanReaperPlayers
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Player 1 (Red) controller) Equal to User
              • (Player 7 (Green) controller) Equal to User
        • Then - Actions
          • -------- Obslu oyun --------
          • Set ClanDevilPlayer = Neutral Victim
          • Camera - Set Player 1 (Red)'s camera Field of view to 90.00 over 0.00 seconds
          • Set ClanReaperPlayer = Neutral Extra
          • Camera - Set Player 7 (Green)'s camera Field of view to 90.00 over 0.00 seconds
        • Else - Actions
          • -------- Obssuz oyun --------
          • Set ClanDevilPlayer = Player 1 (Red)
          • Set ClanReaperPlayer = Player 7 (Green)
          • -------- Devil ayarlar --------
          • Player Group - Pick every player in ClanDevilPlayers and do (Actions)
            • Loop - Actions
              • Player - Make (Picked player) treat ClanDevilPlayer as an Ally with shared vision
              • Player - Make ClanDevilPlayer treat (Picked player) as an Ally with shared vision
              • For each (Integer A) from 7 to 12, do (Actions)
                • Loop - Actions
                  • Player - Make ClanDevilPlayer treat (Player((Integer A))) as an Enemy
          • Player Group - Pick every player in ClanReaperPlayers and do (Actions)
            • Loop - Actions
              • Player - Make (Picked player) treat ClanReaperPlayer as an Ally with shared vision
              • Player - Make ClanReaperPlayer treat (Picked player) as an Ally with shared vision
              • For each (Integer A) from 7 to 12, do (Actions)
                • Loop - Actions
                  • Player - Make ClanDevilPlayer treat (Player((Integer A))) as an Enemy
      • -------- Harita üzerindeki eski unitleri deistir --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ClanDevilPlayer Not equal to Player 1 (Red)
        • Then - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
            • Loop - Actions
              • Unit - Change ownership of (Picked unit) to ClanDevilPlayer and Retain color
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ClanReaperPlayer Not equal to Player 7 (Green)
        • Then - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by Player 7 (Green)) and do (Actions)
            • Loop - Actions
              • Unit - Change ownership of (Picked unit) to ClanReaperPlayer and Retain color
        • Else - Actions
      • Set GOD_ButtonNumber = 8
      • Set GOD_Buton_Name[1] = |cff00ff00Orman|r
      • Set GOD_Buton_Name[2] = |cff87cefaDestek|r
      • Set GOD_Buton_Name[3] = |cffff8c00+%20 vurus hızı|r
      • Set GOD_Buton_Name[4] = |cffff8c00+5 zirh|r
      • Set GOD_Buton_Name[5] = |cffff8c00+12 hasar|r
      • Set GOD_Buton_Name[6] = |cffff8c00+6 strength|r
      • Set GOD_Buton_Name[7] = |cffff8c00+6 intelligence|r
      • Set GOD_Buton_Name[8] = |cffff8c00+6 agility|r
      • -------- Spellbooklar --------
      • Set GOD_Ability[1] = GOD Orman
      • Set GOD_Ability[2] = GOD Destek
      • Set GOD_Ability[3] = God 3 // AS
      • Set GOD_Ability[4] = God 4 // ARMOR
      • Set GOD_Ability[5] = God 5 // DAMAGE
      • Set GOD_Ability[6] = God 6 // str
      • Set GOD_Ability[7] = God 7 // int
      • Set GOD_Ability[8] = God 8 // agi
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • For each (Integer A) from 1 to 12, do (Actions)
            • Loop - Actions
              • Player - Disable GOD_Ability[(Integer A)] for (Picked player)
      • -------- Spellbooklarin içlerindekiler --------
      • Set GOD_Sub_Ability[1] = GOD ORMAN REAL
      • Set GOD_Sub_Ability[2] = GOD DESTEK REAL
      • Set GOD_Sub_Ability[3] = GOD AS (20%)
      • Set GOD_Sub_Ability[4] = GOD ARMOR (+5)
      • Set GOD_Sub_Ability[5] = GOD DAMAGE (+12)
      • Set GOD_Sub_Ability[6] = Item Hero Stat Bonus (+6 Strength)
      • Set GOD_Sub_Ability[7] = Item Hero Stat Bonus (+6 Intelligence)
      • Set GOD_Sub_Ability[8] = Item Hero Stat Bonus (+6 Agility)
      • Set GOD_Sub_Ability[9] = stat int 8//
      • Set GOD_Sub_Ability[10] = stat agi 8//
      • Set GOD_Nick[1] = |cff87cefaOrman|n
      • Set GOD_Nick[2] = |cff87cefaDestek|r|n
      • Set GOD_Nick[3] = |cff87cefaAS|r|n
      • Set GOD_Nick[4] = |cff87cefaARMOR|r|n
      • Set GOD_Nick[5] = |cff87cefaDMG|r|n
      • Set GOD_Nick[6] = |cff87cefaSTR|r|n
      • Set GOD_Nick[7] = |cff87cefaINT|r|n
      • Set GOD_Nick[8] = |cff87cefaAGI|r|n
      • Player - Make ClanDevilPlayer treat ClanReaperPlayer as an Enemy
      • Player - Make ClanDevilPlayer treat Neutral Passive as an Enemy
      • Player - Make ClanReaperPlayer treat ClanDevilPlayer as an Enemy
      • Player - Make ClanReaperPlayer treat Neutral Passive as an Enemy
      • Player - Make Neutral Passive treat ClanDevilPlayer as an Enemy
      • Player - Make Neutral Passive treat ClanReaperPlayer as an Enemy
      • Set Circle[2] = Kasa 0059 <gen>
      • Set Circle[3] = Kasa 0090 <gen>
      • Set Circle[4] = Kasa 0091 <gen>
      • Set Circle[5] = Kasa 0093 <gen>
      • Set Circle[6] = Kasa 0092 <gen>
      • Set Circle[8] = Kasa 0077 <gen>
      • Set Circle[9] = Kasa 0082 <gen>
      • Set Circle[10] = Kasa 0083 <gen>
      • Set Circle[11] = Kasa 0085 <gen>
      • Set Circle[12] = Kasa 0084 <gen>
      • Unit - Make Clan Reaper's Headquarter 0004 <gen> Invulnerable
      • Unit - Make Clan Devil's Headquarter 0003 <gen> Invulnerable
      • Player - Set name of ClanDevilPlayer to |cffff0000Clan Devi...
      • Player - Change color of ClanDevilPlayer to Red, Changing color of existing units
      • Player - Set name of ClanReaperPlayer to |cffda70d6Clan Reap...
      • Player - Change color of ClanReaperPlayer to Purple, Changing color of existing units
      • Set PlayingPlayers = (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing)))
      • Player Group - Pick every player in PlayingPlayers and do (Actions)
        • Loop - Actions
          • Player - Set (Picked player) Current gold to 700
          • Player - Set (Picked player) Food cap to 2
          • Camera - Pan camera for (Picked player) to (Center of StartCamera <gen>) over 0.20 seconds
          • Camera - Set (Picked player)'s camera Field of view to 90.00 over 0.00 seconds
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across StartCamera <gen>
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across Region 079 <gen>
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across AltarVisibility <gen>
          • Hero - Make (Picked player) Heroes gain 100.00% experience from future kills
      • Set DevilPlayersArray[0] = ClanDevilPlayer
      • Set DevilPlayersArray[1] = Player 2 (Blue)
      • Set DevilPlayersArray[2] = Player 3 (Teal)
      • Set DevilPlayersArray[3] = Player 4 (Purple)
      • Set DevilPlayersArray[4] = Player 5 (Yellow)
      • Set DevilPlayersArray[5] = Player 6 (Orange)
      • Set ReaperPlayersArray[0] = ClanReaperPlayer
      • Set ReaperPlayersArray[1] = Player 8 (Pink)
      • Set ReaperPlayersArray[2] = Player 9 (Gray)
      • Set ReaperPlayersArray[3] = Player 10 (Light Blue)
      • Set ReaperPlayersArray[4] = Player 11 (Dark Green)
      • Set ReaperPlayersArray[5] = Player 12 (Brown)
      • Set Player_Colors[(Player number of ClanDevilPlayer)] = |CFFFF0303
      • Set Player_Colors[2] = |CFF0042FF
      • Set Player_Colors[3] = |CFF1CE6B9
      • Set Player_Colors[4] = |CFF540081
      • Set Player_Colors[5] = |CFFFFFC00
      • Set Player_Colors[6] = |CFFFE8A0E
      • Set Player_Colors[(Player number of ClanReaperPlayer)] = |CFF20C000
      • Set Player_Colors[8] = |CFFE55BB0
      • Set Player_Colors[9] = |CFF959697
      • Set Player_Colors[10] = |CFF7FBFF1
      • Set Player_Colors[11] = |CFF004040
      • Set Player_Colors[12] = |CFF492A04
      • For each (Integer A) from 1 to 16, do (Actions)
        • Loop - Actions
          • Set PlayerNames[(Integer A)] = ((Player_Colors[(Integer A)] + (Name of (Player((Integer A))))) + |r)
      • Set Combine_Charged_Items = True
      • Set Combine_Charges_Max = 3
      • Set PlayerNames[(Player number of ClanDevilPlayer)] = |cffff0000Clan Devil|r
      • Set PlayerNames[(Player number of ClanReaperPlayer)] = |cffda70d6Clan Reaper|r
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
I don't know how your map works exactly but in most maps you only need to do things for Users that are actually in the game.

If that's the case for you then you should setup your Player Groups to account for this:
  • Events
    • Elapsed game time is 0.01 seconds
  • Conditions
  • Actions
    • Set ClanDevilPlayers = (All players matching (Player number of matching player <= 6) And (Matching player is a User Equal to True) And (Matching player is Playing) Equal to True)
    • Set ClanReaperPlayers = (All players matching (Player number of matching player >= 7) And (Player number of matching player <= 12) And (Matching player is a User Equal to True) And (Matching player is Playing) Equal to True)
With this trigger you now have the ACTIVE Users in these Player Groups meaning that ALL of your triggers that reference these Player Groups will only reference those that actually exist. Now just make sure that this trigger runs before your other triggers which reference these Player Groups. This is where Wrda's suggestion comes into play:
  • Events
    • Elapsed game time is 0.01 seconds
  • Conditions
  • Actions
    • Trigger - Run SetupPlayers (ignoring conditions)
    • Trigger - Run SetupUnits (ignoring conditions)
    • Trigger - Run SetupDevils (ignoring conditions)
    • Trigger - Run SetupReapers (ignoring conditions)
    • Trigger - Run SetupResources (ignoring conditions)
    • Trigger - Run GameStart (ignoring conditions)
^ This allows you to order the execution of your triggers. So since we know that SetupPlayers will create all of our Player Groups we can be sure that every single other trigger that runs after it will be able to reference those Player Groups without issues. You can then easily re-order these at any time and guarantee that your game logic executes flawlessly.

Then what if a Player leaves the game? This again depends on how you want your map to work but in most games the leaver is now excluded from your triggers:
  • Events
    • Player 1 leaves the game
    • Player 2 leaves the game
    • Player 3 leaves the game
    • etc...
  • Conditions
  • Actions
    • Player Group - Remove (Triggering player) from ClanDevilPlayers
    • Player Group - Remove (Triggering player) from ClanReaperPlayers
But you can go a step further and allow yourself to control both active/leaver players.

What I usually do is create two Player Groups for my Users. One Player Group contains all of the Active Users and the other contains Users that were active from the start. So you now have control in your triggers to do the following:

Pick every Player that is CURRENTLY playing the game. So leavers are excluded.
- OR -
Pick every Player that IS/WAS playing the game. So leavers are included.

This makes it very easy to manage your Players. Do you want to remove ALL units owned by ALL players of a team? Or do you just want to remove ALL units owned by ACTIVE players of a team? You now have the power to do so. This same concept applies to Unit Groups which will make your life so much easier.

When creating a map you should establish these groups as early as possible, this way all of your future triggers can be managed with ease. You'll have access to everything and everyone at any given moment and you can set it up to automatically manage these groups when a Player leaves/Unit dies in order to ensure that you're only ever interacting with Players/Units that actually exist.
 
Last edited:
Level 3
Joined
Oct 28, 2010
Messages
6
Wow. Clever. Here is the situation. I have added Player 2 to 6 to ClanDevilPlayers and Player 8 to 12 ClanReaperPlayers

  • Player Group - Add Player 2 (Blue) to ClanDevilPlayers
  • Player Group - Add Player 3 (Teal) to ClanDevilPlayers
  • Player Group - Add Player 4 (Purple) to ClanDevilPlayers
  • Player Group - Add Player 5 (Yellow) to ClanDevilPlayers
  • Player Group - Add Player 6 (Orange) to ClanDevilPlayers
  • Player Group - Add Player 8 (Pink) to ClanReaperPlayers
  • Player Group - Add Player 9 (Gray) to ClanReaperPlayers
  • Player Group - Add Player 10 (Light Blue) to ClanReaperPlayers
  • Player Group - Add Player 11 (Dark Green) to ClanReaperPlayers
  • Player Group - Add Player 12 (Brown) to ClanReaperPlayers
Now it will gonna work? Clan Devil (1) ally with players 2 to 6
Clan Reaper (7) ally with players 8 to 12

Player 1 to 6 VS player 7 to 12
This is what i want from this trigger

1-) ClanDevilPlayers ALLY with ClanDevilPlayer (player 1)
2-) Player 1 ALLY with ClanDevilPlayers
3-) ClanDevilPlayer ENEMY to Player 7 to 12

  • Player Group - Pick every player in ClanDevilPlayers and do (Actions)
    • Loop - Actions
      • Player - Make (Picked player) treat ClanDevilPlayer as an Ally with shared vision
      • Player - Make ClanDevilPlayer treat (Picked player) as an Ally with shared vision
      • For each (Integer A) from 7 to 12, do (Actions)
        • Loop - Actions
          • Player - Make ClanDevilPlayer treat (Player((Integer A))) as an Enemy
And this is for the Clan Reaper (7 to 12)

  • Player Group - Pick every player in ClanReaperPlayers and do (Actions)
    • Loop - Actions
      • Player - Make (Picked player) treat ClanReaperPlayer as an Ally with shared vision
      • Player - Make ClanReaperPlayer treat (Picked player) as an Ally with shared vision
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Player - Make ClanReaperPlayer treat (Player((Integer A))) as an Enemy
Is everything allright? Because i believe i am missing something in there.

  • Baslangic Triggerlari
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Game - Set the time of day to 5.00
      • Hashtable - Create a hashtable
      • Set hash = (Last created hashtable)
      • Custom script: call ExecuteFunc("RegisterItemCosts")
      • Player Group - Add Player 2 (Blue) to ClanDevilPlayers
      • Player Group - Add Player 3 (Teal) to ClanDevilPlayers
      • Player Group - Add Player 4 (Purple) to ClanDevilPlayers
      • Player Group - Add Player 5 (Yellow) to ClanDevilPlayers
      • Player Group - Add Player 6 (Orange) to ClanDevilPlayers
      • Player Group - Add Player 8 (Pink) to ClanReaperPlayers
      • Player Group - Add Player 9 (Gray) to ClanReaperPlayers
      • Player Group - Add Player 10 (Light Blue) to ClanReaperPlayers
      • Player Group - Add Player 11 (Dark Green) to ClanReaperPlayers
      • Player Group - Add Player 12 (Brown) to ClanReaperPlayers
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Player 1 (Red) controller) Equal to User
              • (Player 7 (Green) controller) Equal to User
        • Then - Actions
          • -------- Obslu oyun --------
          • Set ClanDevilPlayer = Neutral Victim
          • Camera - Set Player 1 (Red)'s camera Field of view to 90.00 over 0.00 seconds
          • Set ClanReaperPlayer = Neutral Extra
          • Camera - Set Player 7 (Green)'s camera Field of view to 90.00 over 0.00 seconds
        • Else - Actions
          • -------- Obssuz oyun --------
          • Set ClanDevilPlayer = Player 1 (Red)
          • Set ClanReaperPlayer = Player 7 (Green)
          • -------- Devil ayarlar --------
          • Player Group - Pick every player in ClanDevilPlayers and do (Actions)
            • Loop - Actions
              • Player - Make (Picked player) treat ClanDevilPlayer as an Ally with shared vision
              • Player - Make ClanDevilPlayer treat (Picked player) as an Ally with shared vision
              • For each (Integer A) from 7 to 12, do (Actions)
                • Loop - Actions
                  • Player - Make ClanDevilPlayer treat (Player((Integer A))) as an Enemy
          • Player Group - Pick every player in ClanReaperPlayers and do (Actions)
            • Loop - Actions
              • Player - Make (Picked player) treat ClanReaperPlayer as an Ally with shared vision
              • Player - Make ClanReaperPlayer treat (Picked player) as an Ally with shared vision
              • For each (Integer A) from 7 to 12, do (Actions)
                • Loop - Actions
                  • Player - Make ClanDevilPlayer treat (Player((Integer A))) as an Enemy
      • -------- Harita üzerindeki eski unitleri deistir --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ClanDevilPlayer Not equal to Player 1 (Red)
        • Then - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
            • Loop - Actions
              • Unit - Change ownership of (Picked unit) to ClanDevilPlayer and Retain color
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ClanReaperPlayer Not equal to Player 7 (Green)
        • Then - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by Player 7 (Green)) and do (Actions)
            • Loop - Actions
              • Unit - Change ownership of (Picked unit) to ClanReaperPlayer and Retain color
        • Else - Actions
      • Set GOD_ButtonNumber = 8
      • Set GOD_Buton_Name[1] = |cff00ff00Orman|r
      • Set GOD_Buton_Name[2] = |cff87cefaDestek|r
      • Set GOD_Buton_Name[3] = |cffff8c00+%20 vurus hızı|r
      • Set GOD_Buton_Name[4] = |cffff8c00+5 zirh|r
      • Set GOD_Buton_Name[5] = |cffff8c00+12 hasar|r
      • Set GOD_Buton_Name[6] = |cffff8c00+6 strength|r
      • Set GOD_Buton_Name[7] = |cffff8c00+6 intelligence|r
      • Set GOD_Buton_Name[8] = |cffff8c00+6 agility|r
      • -------- Spellbooklar --------
      • Set GOD_Ability[1] = GOD Orman
      • Set GOD_Ability[2] = GOD Destek
      • Set GOD_Ability[3] = God 3 // AS
      • Set GOD_Ability[4] = God 4 // ARMOR
      • Set GOD_Ability[5] = God 5 // DAMAGE
      • Set GOD_Ability[6] = God 6 // str
      • Set GOD_Ability[7] = God 7 // int
      • Set GOD_Ability[8] = God 8 // agi
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • For each (Integer A) from 1 to 12, do (Actions)
            • Loop - Actions
              • Player - Disable GOD_Ability[(Integer A)] for (Picked player)
      • -------- Spellbooklarin içlerindekiler --------
      • Set GOD_Sub_Ability[1] = GOD ORMAN REAL
      • Set GOD_Sub_Ability[2] = GOD DESTEK REAL
      • Set GOD_Sub_Ability[3] = GOD AS (20%)
      • Set GOD_Sub_Ability[4] = GOD ARMOR (+5)
      • Set GOD_Sub_Ability[5] = GOD DAMAGE (+12)
      • Set GOD_Sub_Ability[6] = Item Hero Stat Bonus (+6 Strength)
      • Set GOD_Sub_Ability[7] = Item Hero Stat Bonus (+6 Intelligence)
      • Set GOD_Sub_Ability[8] = Item Hero Stat Bonus (+6 Agility)
      • Set GOD_Sub_Ability[9] = stat int 8//
      • Set GOD_Sub_Ability[10] = stat agi 8//
      • Set GOD_Nick[1] = |cff87cefaOrman|n
      • Set GOD_Nick[2] = |cff87cefaDestek|r|n
      • Set GOD_Nick[3] = |cff87cefaAS|r|n
      • Set GOD_Nick[4] = |cff87cefaARMOR|r|n
      • Set GOD_Nick[5] = |cff87cefaDMG|r|n
      • Set GOD_Nick[6] = |cff87cefaSTR|r|n
      • Set GOD_Nick[7] = |cff87cefaINT|r|n
      • Set GOD_Nick[8] = |cff87cefaAGI|r|n
      • Player - Make ClanDevilPlayer treat ClanReaperPlayer as an Enemy
      • Player - Make ClanDevilPlayer treat Neutral Passive as an Enemy
      • Player - Make ClanReaperPlayer treat ClanDevilPlayer as an Enemy
      • Player - Make ClanReaperPlayer treat Neutral Passive as an Enemy
      • Player - Make Neutral Passive treat ClanDevilPlayer as an Enemy
      • Player - Make Neutral Passive treat ClanReaperPlayer as an Enemy
      • Set Circle[2] = Kasa 0059 <gen>
      • Set Circle[3] = Kasa 0090 <gen>
      • Set Circle[4] = Kasa 0091 <gen>
      • Set Circle[5] = Kasa 0093 <gen>
      • Set Circle[6] = Kasa 0092 <gen>
      • Set Circle[8] = Kasa 0077 <gen>
      • Set Circle[9] = Kasa 0082 <gen>
      • Set Circle[10] = Kasa 0083 <gen>
      • Set Circle[11] = Kasa 0085 <gen>
      • Set Circle[12] = Kasa 0084 <gen>
      • Unit - Make Clan Reaper's Headquarter 0004 <gen> Invulnerable
      • Unit - Make Clan Devil's Headquarter 0003 <gen> Invulnerable
      • Player - Set name of ClanDevilPlayer to |cffff0000Clan Devi...
      • Player - Change color of ClanDevilPlayer to Red, Changing color of existing units
      • Player - Set name of ClanReaperPlayer to |cffda70d6Clan Reap...
      • Player - Change color of ClanReaperPlayer to Purple, Changing color of existing units
      • Set PlayingPlayers = (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing)))
      • Player Group - Pick every player in PlayingPlayers and do (Actions)
        • Loop - Actions
          • Player - Set (Picked player) Current gold to 700
          • Player - Set (Picked player) Food cap to 2
          • Camera - Pan camera for (Picked player) to (Center of StartCamera <gen>) over 0.20 seconds
          • Camera - Set (Picked player)'s camera Field of view to 90.00 over 0.00 seconds
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across StartCamera <gen>
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across Region 079 <gen>
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across AltarVisibility <gen>
          • Hero - Make (Picked player) Heroes gain 100.00% experience from future kills
      • Set DevilPlayersArray[0] = ClanDevilPlayer
      • Set DevilPlayersArray[1] = Player 2 (Blue)
      • Set DevilPlayersArray[2] = Player 3 (Teal)
      • Set DevilPlayersArray[3] = Player 4 (Purple)
      • Set DevilPlayersArray[4] = Player 5 (Yellow)
      • Set DevilPlayersArray[5] = Player 6 (Orange)
      • Set ReaperPlayersArray[0] = ClanReaperPlayer
      • Set ReaperPlayersArray[1] = Player 8 (Pink)
      • Set ReaperPlayersArray[2] = Player 9 (Gray)
      • Set ReaperPlayersArray[3] = Player 10 (Light Blue)
      • Set ReaperPlayersArray[4] = Player 11 (Dark Green)
      • Set ReaperPlayersArray[5] = Player 12 (Brown)
      • Set Player_Colors[(Player number of ClanDevilPlayer)] = |CFFFF0303
      • Set Player_Colors[2] = |CFF0042FF
      • Set Player_Colors[3] = |CFF1CE6B9
      • Set Player_Colors[4] = |CFF540081
      • Set Player_Colors[5] = |CFFFFFC00
      • Set Player_Colors[6] = |CFFFE8A0E
      • Set Player_Colors[(Player number of ClanReaperPlayer)] = |CFF20C000
      • Set Player_Colors[8] = |CFFE55BB0
      • Set Player_Colors[9] = |CFF959697
      • Set Player_Colors[10] = |CFF7FBFF1
      • Set Player_Colors[11] = |CFF004040
      • Set Player_Colors[12] = |CFF492A04
      • For each (Integer A) from 1 to 16, do (Actions)
        • Loop - Actions
          • Set PlayerNames[(Integer A)] = ((Player_Colors[(Integer A)] + (Name of (Player((Integer A))))) + |r)
      • Set Combine_Charged_Items = True
      • Set Combine_Charges_Max = 3
      • Set PlayerNames[(Player number of ClanDevilPlayer)] = |cffff0000Clan Devil|r
      • Set PlayerNames[(Player number of ClanReaperPlayer)] = |cffda70d6Clan Reaper|r
As far as I can tell, you dont need the first line where you pick the players. Running the loop should be enough.
 
Status
Not open for further replies.
Top