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

[Trigger] Can i write this shorter somehow :D ???

Status
Not open for further replies.
Level 11
Joined
Jul 28, 2007
Messages
920
  • Add Scrolls Orc
    • Events
    • Conditions
    • Actions
      • -------- orc grunt --------
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by Hero[(Integer A)] in slot 1)) Equal to Orc Grunt
              • ((Owner of Hero[(Integer A)]) Current lumber) Greater than or equal to focus_orc_grunt
            • Then - Actions
              • Item - Remove (Item carried by Hero[(Integer A)] in slot 1)
              • Wait 0.01 seconds
              • Custom script: call UnitAddItemToSlotById( udg_Hero[GetForLoopIndexA()] , 'I00F' , 0 )
            • Else - Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by Hero[(Integer A)] in slot 2)) Equal to Orc Grunt
              • ((Owner of Hero[(Integer A)]) Current lumber) Greater than or equal to focus_orc_grunt
            • Then - Actions
              • Item - Remove (Item carried by Hero[(Integer A)] in slot 2)
              • Wait 0.01 seconds
              • Custom script: call UnitAddItemToSlotById( udg_Hero[GetForLoopIndexA()] , 'I00F' , 1 )
            • Else - Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by Hero[(Integer A)] in slot 3)) Equal to Orc Grunt
              • ((Owner of Hero[(Integer A)]) Current lumber) Greater than or equal to focus_orc_grunt
            • Then - Actions
              • Item - Remove (Item carried by Hero[(Integer A)] in slot 3)
              • Wait 0.01 seconds
              • Custom script: call UnitAddItemToSlotById( udg_Hero[GetForLoopIndexA()] , 'I00F' , 2 )
            • Else - Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by Hero[(Integer A)] in slot 4)) Equal to Orc Grunt
              • ((Owner of Hero[(Integer A)]) Current lumber) Greater than or equal to focus_orc_grunt
            • Then - Actions
              • Item - Remove (Item carried by Hero[(Integer A)] in slot 4)
              • Wait 0.01 seconds
              • Custom script: call UnitAddItemToSlotById( udg_Hero[GetForLoopIndexA()] , 'I00F' , 3 )
            • Else - Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by Hero[(Integer A)] in slot 5)) Equal to Orc Grunt
              • ((Owner of Hero[(Integer A)]) Current lumber) Greater than or equal to focus_orc_grunt
            • Then - Actions
              • Item - Remove (Item carried by Hero[(Integer A)] in slot 5)
              • Wait 0.01 seconds
              • Custom script: call UnitAddItemToSlotById( udg_Hero[GetForLoopIndexA()] , 'I00F' , 4 )
            • Else - Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by Hero[(Integer A)] in slot 6)) Equal to Orc Grunt
              • ((Owner of Hero[(Integer A)]) Current lumber) Greater than or equal to focus_orc_grunt
            • Then - Actions
              • Item - Remove (Item carried by Hero[(Integer A)] in slot 6)
              • Wait 0.01 seconds
              • Custom script: call UnitAddItemToSlotById( udg_Hero[GetForLoopIndexA()] , 'I00F' , 5 )
            • Else - Actions
 
Last edited by a moderator:
Level 40
Joined
Dec 14, 2005
Messages
10,532
Edited for trigger tags.

And you can nest an Integer B loop to shorten that by 6x:

  • Add Scrolls Orc
    • Events
    • Conditions
    • Actions
      • -------- orc grunt --------
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • For each (Integer B) from 1 to 6, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Item carried by Hero[(Integer A)] in slot (Integer B))) Equal to Orc Grunt
                  • ((Owner of Hero[(Integer A)]) Current lumber) Greater than or equal to focus_orc_grunt
                • Then - Actions
                  • Item - Remove (Item carried by Hero[(Integer A)] in slot (Integer B))
                  • Wait 0.01 seconds
                  • Custom script: call UnitAddItemToSlotById( udg_Hero[GetForLoopIndexA()] , 'I00F' , bj_forLoopBIndex - 1 )
                • Else - Actions
 
Status
Not open for further replies.
Top