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

[Solved] Trigger takes tens of seconds to finish? Reforged Latest Patch

Status
Not open for further replies.
Level 12
Joined
Feb 5, 2018
Messages
521
I was messing around with the editor, found an old item removal system, which removes items from the ground, if they are not picked up.

I am having two issues here.
1) The item is removed from hero inventory, even if it is picked up.
2) The trigger takes ages to finish. I have read somewhere that a trigger can have over hundreds of lines and still should finish running in a very short time.

So here is the trigger, it's just a bunch of if/then/else actions for item drops.

  • Wolf Cub Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Owner of (Killing unit)) slot status) Equal to Is playing
      • (Level of (Triggering unit)) Less than or equal to 3
    • Actions
      • Custom script: local location udg_TempPoint
      • Custom script: local item udg_TempItem
      • Set VariableSet TempPoint = (Position of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 15
        • Then - Actions
          • Item - Create Hammer at TempPoint
          • Set VariableSet TempItem = (Last created item)
          • Game - Display to (All players) the text: |cffffff00Loot:|r H...
          • Wait 15.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempItem is owned) Equal to False
            • Then - Actions
              • Item - Remove TempItem
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 15
        • Then - Actions
          • Item - Create Hammer at TempPoint
          • Set VariableSet TempItem = (Last created item)
          • Game - Display to (All players) the text: |cffffff00Loot:|r H...
          • Wait 15.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempItem is owned) Equal to False
            • Then - Actions
              • Item - Remove TempItem
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 15
        • Then - Actions
          • Item - Create Axe at TempPoint
          • Set VariableSet TempItem = (Last created item)
          • Game - Display to (All players) the text: |cffffff00Loot:|r A...
          • Wait 15.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempItem is owned) Equal to False
            • Then - Actions
              • Item - Remove TempItem
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 15
        • Then - Actions
          • Item - Create Axe at TempPoint
          • Set VariableSet TempItem = (Last created item)
          • Game - Display to (All players) the text: |cffffff00Loot:|r A...
          • Wait 15.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempItem is owned) Equal to False
            • Then - Actions
              • Item - Remove TempItem
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 7
        • Then - Actions
          • Item - Create Superior Axe at TempPoint
          • Set VariableSet TempItem = (Last created item)
          • Game - Display to (All players) the text: |cffffff00Loot:|r S...
          • Wait 15.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempItem is owned) Equal to False
            • Then - Actions
              • Item - Remove TempItem
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 7
        • Then - Actions
          • Item - Create Superior Axe at TempPoint
          • Set VariableSet TempItem = (Last created item)
          • Game - Display to (All players) the text: |cffffff00Loot:|r S...
          • Wait 15.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempItem is owned) Equal to False
            • Then - Actions
              • Item - Remove TempItem
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 7
        • Then - Actions
          • Item - Create Superior Hammer at TempPoint
          • Set VariableSet TempItem = (Last created item)
          • Game - Display to (All players) the text: |cffffff00Loot:|r S...
          • Wait 15.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempItem is owned) Equal to False
            • Then - Actions
              • Item - Remove TempItem
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 7
        • Then - Actions
          • Item - Create Superior Hammer at TempPoint
          • Set VariableSet TempItem = (Last created item)
          • Game - Display to (All players) the text: |cffffff00Loot:|r S...
          • Wait 15.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempItem is owned) Equal to False
            • Then - Actions
              • Item - Remove TempItem
            • Else - Actions
        • Else - Actions
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Game - Display to (All players) the text: Trigger Finished Ru...
I used to have this same exact thing on some map, before all maps got vanished from my computer. IIRC it worked as planned and the trigger executed itself within milliseconds.

EDIT: Nevermind I got it already. Here is the final trigger if anyone needs an easy item clean up system. Works as planned, fixed both issues with this one.

  • Wolf Cub Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Owner of (Killing unit)) slot status) Equal to Is playing
      • (Level of (Triggering unit)) Less than or equal to 3
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 15
        • Then - Actions
          • Set VariableSet TempInteger = (TempInteger + 1)
          • Set VariableSet TempPoint = (Position of (Triggering unit))
          • Item - Create Hammer at TempPoint
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Set VariableSet TempItem[TempInteger] = (Last created item)
          • Game - Display to (All players) the text: |cffffff00Loot:|r H...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 15
        • Then - Actions
          • Set VariableSet TempInteger = (TempInteger + 1)
          • Set VariableSet TempPoint = (Position of (Triggering unit))
          • Item - Create Hammer at TempPoint
          • Set VariableSet TempItem[TempInteger] = (Last created item)
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Game - Display to (All players) the text: |cffffff00Loot:|r H...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 15
        • Then - Actions
          • Set VariableSet TempInteger = (TempInteger + 1)
          • Set VariableSet TempPoint = (Position of (Triggering unit))
          • Item - Create Axe at TempPoint
          • Set VariableSet TempItem[TempInteger] = (Last created item)
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Game - Display to (All players) the text: |cffffff00Loot:|r A...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 15
        • Then - Actions
          • Set VariableSet TempInteger = (TempInteger + 1)
          • Set VariableSet TempPoint = (Position of (Triggering unit))
          • Item - Create Axe at TempPoint
          • Set VariableSet TempItem[TempInteger] = (Last created item)
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Game - Display to (All players) the text: |cffffff00Loot:|r A...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 7
        • Then - Actions
          • Set VariableSet TempInteger = (TempInteger + 1)
          • Set VariableSet TempPoint = (Position of (Triggering unit))
          • Item - Create Superior Axe at TempPoint
          • Set VariableSet TempItem[TempInteger] = (Last created item)
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Game - Display to (All players) the text: |cffffff00Loot:|r S...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 7
        • Then - Actions
          • Set VariableSet TempInteger = (TempInteger + 1)
          • Set VariableSet TempPoint = (Position of (Triggering unit))
          • Item - Create Superior Axe at TempPoint
          • Set VariableSet TempItem[TempInteger] = (Last created item)
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Game - Display to (All players) the text: |cffffff00Loot:|r S...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 7
        • Then - Actions
          • Set VariableSet TempInteger = (TempInteger + 1)
          • Set VariableSet TempPoint = (Position of (Triggering unit))
          • Item - Create Superior Hammer at TempPoint
          • Set VariableSet TempItem[TempInteger] = (Last created item)
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Game - Display to (All players) the text: |cffffff00Loot:|r S...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 7
        • Then - Actions
          • Set VariableSet TempInteger = (TempInteger + 1)
          • Set VariableSet TempPoint = (Position of (Triggering unit))
          • Item - Create Superior Hammer at TempPoint
          • Set VariableSet TempItem[TempInteger] = (Last created item)
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Game - Display to (All players) the text: |cffffff00Loot:|r S...
        • Else - Actions
      • Game - Display to (All players) the text: Trigger Finished Ru...
      • Wait 15.00 seconds
      • Set VariableSet TempIntegerEnd = (TempIntegerEnd + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (TempItem[TempIntegerEnd] is owned) Equal to False
        • Then - Actions
          • Item - Remove TempItem[TempIntegerEnd]
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempInteger Equal to TempIntegerEnd
        • Then - Actions
          • Set VariableSet TempInteger = 0
          • Set VariableSet TempIntegerEnd = 0
        • Else - Actions
      • Game - Display to (All players) the text: Items Removed
  • [/SPOILER]
 
Last edited:
Status
Not open for further replies.
Top