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

Inventory Duplicate Drop

Status
Not open for further replies.
Level 9
Joined
Apr 28, 2009
Messages
538
I've been trying to make a trigger that drops the item a unit picks up, if that unit already owns a similar item, but it seems i cannot find how to do this.
Could anyone help?
 
Level 9
Joined
Apr 28, 2009
Messages
538
first, it won't work...it will drop anything you pickup no matter what.
second, "item of type" makes this trigger even more useless.
 
Level 12
Joined
Jan 30, 2009
Messages
1,067
That's because you need a condition to check that item, I'm guessing. Most likely something along these lines. I've not messed with items myself, but this may help. At the very least, I think it should give you an idea on how to get it to work correctly, ^^

Though I am sure there is a much more efficient way of doing this, probably with Integer[A], loop etc, here is how I would try it first. And if this worked, I would then look into optimizing it... but, tbh, I wouldn't be too sure this works.

  • Untitled Trigger 001
    • Events
      • Unit - Blademaster 0001 <gen> Acquires an item
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-class of (Item being manipulated)) Equal to (==) (Item-class of (Item carried by Blademaster 0001 <gen> in slot 1))
        • Then - Actions
          • Unit - Order Blademaster 0001 <gen> to drop (Item being manipulated) at (Position of (Triggering unit))
        • Else - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-class of (Item being manipulated)) Equal to (==) (Item-class of (Item carried by Blademaster 0001 <gen> in slot 2))
            • Then - Actions
              • Unit - Order Blademaster 0001 <gen> to drop (Item being manipulated) at (Position of (Triggering unit))
            • Else - Actions
              • -------- And continue for every item slot. --------
Like I said...it wasn't pretty. But from a logical view it should work. Though I've been proven wrong time and again that logic doesn't always work with the bloody trigger editor, it still works a lot!

Hope I was of some help.
 
Level 8
Joined
Nov 9, 2008
Messages
502
It's a bad habit to do things in halves Vizel ;)

  • itemz
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Set temp_integer = 0
      • 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 (Triggering unit) in slot (Integer A))) Equal to (Item-type of (Item being manipulated))
            • Then - Actions
              • Set temp_integer = (temp_integer + 1)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • temp_integer Greater than 1
        • Then - Actions
          • Hero - Drop (Item being manipulated) from (Triggering unit)
        • Else - Actions
Or you could also do...

  • itemz2
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • 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 False
        • Then - Actions
          • Hero - Give (Last dropped item) to (Triggering unit)
        • Else - Actions
I dunno what effect dropping the item has though :>
EDIT: I wouldn't do the later as it crashed my game!
Seems it can't handle manipulating item bonuses so quickly. Something funny also is I put a 0.1 second wait into the trigger before the item drops; prevents game from crashing but exhibits strange behavior when trying to drop the item. It's as if when you right click the item to drop, the trigger plays and breaks the action. So right clicking an item counts as aquiring it? Oo
 
Level 9
Joined
Apr 28, 2009
Messages
538
toofless it seems like yes, if you add a "Wait", you'll get a "Pet" system. The item will follow the unit, a thing that's not bad necessarily...it's quite interesting and funny :grin:
___________________________________
Edit: I think wr can stop trying these kind of scripts since nothig without tons of variables won't work i guess.
What i mean:
[Events]
Unit - A unit Acquires an item
[Actions]
Drop Item.. bla bla
• Bla bla
Give item => the trigger will run again because of the event.
All those kind of triggers will result in an infinite cycle.
 
Level 8
Joined
Nov 9, 2008
Messages
502
Oh yeh ofcourse. I missed that.

You would then need a variable to be set at end of trigger and placed in a condition that item being aquired is not equal to previously aquired item.
 
Level 12
Joined
Jan 30, 2009
Messages
1,067
Yeah sorry about not finishing it, but as I said, there would be a more efficient way of doing it, and you posted it with the loop and integer 1-6, so I didn't bother to continue. If nobody had posted the better way, I would have looked into it when I had gotten home (which was a few mins ago) and tried to figure it out myself.

ROFL Pet system! Yay! ^^
 
Status
Not open for further replies.
Top