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

Check for multiple copies of an item

Status
Not open for further replies.
Level 5
Joined
Sep 1, 2010
Messages
168
Use a for loop and a variable to store the value:
set variable =0
for loop integer A from 1to 6, do:
{
if picked/triggering/whatever unit has item of type, set variable =variable +1
else (do nothing)
}
after the loop,check the variable number
if (variable >= 2)
do funky stuff
(or if you want different effects depending on number of the same item, use multiple if/else on the the else function of the other,checking for variable ==number)

Hope that helps :)
 
Level 9
Joined
Apr 23, 2011
Messages
460
So it would be something like this?
  • Mutli Item Check System
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Last created item)) Equal to Claws of Attack +15
    • Actions
      • Set temp_item = (Item-type of (Item being manipulated))
      • Set item = 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 temp_item
            • Then - Actions
              • Set item = (item + 1)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • item Equal to 2
        • Then - Actions
          • Item - Remove (Item carried by (Triggering unit) of type temp_item)
          • Item - Remove (Item carried by (Triggering unit) of type temp_item)
          • Hero - Create Claws of Attack +30 and give it to (Triggering unit)
        • Else - Actions
 
Status
Not open for further replies.
Top