• 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] Drop Item Problem

Status
Not open for further replies.
Level 11
Joined
Mar 30, 2008
Messages
666
  • Replace Ak47
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Ak-47
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item carried by (Hero manipulating item) in slot 1)) Equal to Ak-47
          • (Item-type of (Item carried by (Hero manipulating item) in slot 2)) Equal to Ak-47
          • (Item-type of (Item carried by (Hero manipulating item) in slot 3)) Equal to Ak-47
          • (Item-type of (Item carried by (Hero manipulating item) in slot 4)) Equal to Ak-47
          • (Item-type of (Item carried by (Hero manipulating item) in slot 5)) Equal to Ak-47
          • (Item-type of (Item carried by (Hero manipulating item) in slot 6)) Equal to Ak-47
    • Actions
      • Set Pos = (Position of (Triggering unit))
      • Unit - Order (Hero manipulating item) to drop (Item being manipulated) at Pos
      • Custom script: call RemoveLocation (udg_Pos)
Can some one give me a trigger that drop items if I try to take an item that i already have in my inventory?

Thanks!
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
  • Melee Initialization
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Set loc[1] = (Position of (Item being manipulated))
      • Hero - Drop (Item being manipulated) from (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has an item of type (Item-type of (Item being manipulated))) Equal to True
        • Then - Actions
          • Item - Move (Item being manipulated) to loc[1]
          • Game - Display to (All players) for 10.00 seconds the text: You are already car...
        • Else - Actions
          • Trigger - Turn off (This trigger)
          • Hero - Give (Item being manipulated) to (Triggering unit)
          • Trigger - Turn on (This trigger)
      • Custom script: call RemoveLocation(udg_loc[1])
This may seem weird (since I instantly drop the item and then check whether he already has that item), but it works 100%
The item also won't move (I hate it when items move to the position of the unit picking up the item, then you can "drag" the item along, with this it's impossible).

The speed at which the game picks up an item is faster than at which it checks that a unit has an item, so if you do it your way, the boolean will always return true (since he alreaady has the item).
With my trigger, it will first drop the item, check whether he has an item of that type (so he would've had 2 of them) and then it reacts according to that.
 
Status
Not open for further replies.
Top