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

How to dectec if unit has 2 same type of items.

Status
Not open for further replies.
Level 10
Joined
Jul 2, 2004
Messages
690
try picking all units of unit type and use an integar variable to count how many are there.
 
Level 1
Joined
Sep 21, 2005
Messages
5
Code:
Combine Ore
    Events
        Unit - A unit owned by Player 1 (Red) Acquires an item
        Unit - A unit owned by Player 2 (Blue) Acquires an item
        Unit - A unit owned by Player 3 (Teal) Acquires an item
        Unit - A unit owned by Player 4 (Purple) Acquires an item
        Unit - A unit owned by Player 5 (Yellow) Acquires an item
    Conditions
        (Number of items carried by (Hero manipulating item)) Greater than or equal to 5
        And - All (Conditions) are true
            Conditions
                (Item-class of (Item being manipulated)) Equal to (Item-class of (Item carried by (Hero manipulating item) of type Lump of Ore))
                And - All (Conditions) are true
                    Conditions
                        (Item-type of (Item carried by (Hero manipulating item) in slot 1)) Equal to Lump of Ore
                        (Item-type of (Item carried by (Hero manipulating item) in slot 2)) Equal to Lump of Ore
                        (Item-type of (Item carried by (Hero manipulating item) in slot 3)) Equal to Lump of Ore
                        (Item-type of (Item carried by (Hero manipulating item) in slot 4)) Equal to Lump of Ore
                        (Item-type of (Item carried by (Hero manipulating item) in slot 5)) Equal to Lump of Ore
    Actions
        Hero - Drop (Item carried by (Hero manipulating item) of type Lump of Ore) from (Hero manipulating item)
        Item - Remove (Last dropped item)
        Hero - Drop (Item carried by (Hero manipulating item) of type Lump of Ore) from (Hero manipulating item)
        Item - Remove (Last dropped item)
        Hero - Drop (Item carried by (Hero manipulating item) of type Lump of Ore) from (Hero manipulating item)
        Item - Remove (Last dropped item)
        Hero - Drop (Item carried by (Hero manipulating item) of type Lump of Ore) from (Hero manipulating item)
        Item - Remove (Last dropped item)
        Hero - Drop (Item carried by (Hero manipulating item) of type Lump of Ore) from (Hero manipulating item)
        Item - Remove (Last dropped item)
        Hero - Create Lump of 5 Ore and give it to (Hero manipulating item)

I did this to create a lump of 5 ore when a player collects 5 ore and puts them in slots 1-5.  Just modify it for your items
 
Level 10
Joined
Jul 2, 2004
Messages
690
check the blizzard map called "Warchasers". they got a trigger that makes an item disappear when you pick it up, and gives gold instead. just change the trigger which gives gold to check if that unit has an item of the same type and if so, drop the item.
 
Status
Not open for further replies.
Top