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

Item Drop Trigger

Status
Not open for further replies.
Level 13
Joined
Oct 16, 2010
Messages
731
Hi all,

I've got a trigger in my map that is there to detect when an item is dropped. Then it places the item in an index with a countdown, once the countdown finishes the item gets removed from the map.

My issue is that this is also picking up items that are removed by trigger, say I "upgrade" something that then removes 1 item and replaces it with another. The original item will be placed into the index and countdown. You can see this as the numbers are in the centre of the map but there is no item. I tried checking if Item = No Item but that doesn't seem to make a difference. Any thoughts??

  • Item Dropped
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-class of (Item being manipulated)) Not equal to Powerup
    • Actions
      • Set ItemDrop_MaxIndex = (ItemDrop_MaxIndex + 1)
      • Set ItemDrop_Duration[ItemDrop_MaxIndex] = 30
      • Set ItemDrop_Item[ItemDrop_MaxIndex] = (Item being manipulated)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ItemDrop_MaxIndex Equal to 1
        • Then - Actions
          • Trigger - Turn on Item Drop Loop <gen>
        • Else - Actions

  • Item Drop Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer ItemDrop_LoopInt) from 1 to ItemDrop_MaxIndex, do (Actions)
        • Loop - Actions
          • Set ItemDrop_Duration[ItemDrop_LoopInt] = (ItemDrop_Duration[ItemDrop_LoopInt] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ItemDrop_Duration[ItemDrop_LoopInt] Equal to 0
                  • ItemDrop_Item[ItemDrop_LoopInt] Equal to No item
            • Then - Actions
              • Set TempPoint = (Position of ItemDrop_Item[ItemDrop_LoopInt])
              • Item - Remove ItemDrop_Item[ItemDrop_LoopInt]
              • Floating Text - Create floating text that reads (String(ItemDrop_Duration[ItemDrop_LoopInt])) at TempPoint with Z offset 0.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Show (Last created floating text) for (All players)
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
              • Custom script: call RemoveLocation(udg_TempPoint)
              • -------- De-Index --------
              • Set ItemDrop_Duration[ItemDrop_LoopInt] = ItemDrop_Duration[ItemDrop_MaxIndex]
              • Set ItemDrop_Item[ItemDrop_LoopInt] = ItemDrop_Item[ItemDrop_MaxIndex]
              • Set ItemDrop_MaxIndex = (ItemDrop_MaxIndex - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ItemDrop_MaxIndex Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
                  • Set ItemDrop_LoopInt = (ItemDrop_LoopInt - 1)
            • Else - Actions
              • Set TempPoint = (Position of ItemDrop_Item[ItemDrop_LoopInt])
              • Floating Text - Create floating text that reads (String(ItemDrop_Duration[ItemDrop_LoopInt])) at TempPoint with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Show (Last created floating text) for (All players)
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
              • Custom script: call RemoveLocation(udg_TempPoint)

  • Item Picked Up
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • For each (Integer ItemDrop_LoopInt) from 1 to ItemDrop_MaxIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item being manipulated) Equal to ItemDrop_Item[ItemDrop_LoopInt]
            • Then - Actions
              • -------- De-Index --------
              • Set ItemDrop_Duration[ItemDrop_LoopInt] = ItemDrop_Duration[ItemDrop_MaxIndex]
              • Set ItemDrop_Item[ItemDrop_LoopInt] = ItemDrop_Item[ItemDrop_MaxIndex]
              • Set ItemDrop_MaxIndex = (ItemDrop_MaxIndex - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ItemDrop_MaxIndex Equal to 0
                • Then - Actions
                  • Trigger - Turn off Item Drop Loop <gen>
                • Else - Actions
                  • Set ItemDrop_LoopInt = (ItemDrop_LoopInt - 1)
            • Else - Actions
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
I don't know what the GUI equivalent function is but GetItemPlayer() returns the player that owns the unit that has the item. Presumably if the item is at 0,0 it's not being held by any unit so that ought to return No Player. Might work as an additional condition?
 
Status
Not open for further replies.
Top