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

Craft item help 2

Status
Not open for further replies.
Level 10
Joined
Mar 17, 2012
Messages
582
Hi everyone again!):goblin_yeah:
Now I have a trouble with craft "Vanguard" from dota... well it doesn't metter if anyone doesn't know what it gives...

To craft it hero needs:
2 rings of regeneration;
Poorman's shield
Recipe.

BUT

I can craft it even if I have 1 Ring of regeneration in my inventory (not two)...
here is my rtigger:

  • Vanguard
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (Item-type of (Sold Item)) Equal to Recipe: Vanguard
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (((Buying unit) has an item of type Ring of Regeneration) Equal to True) and (((Buying unit) has an item of type Ring of Regeneration) Equal to True)
          • ((Buying unit) has an item of type Poor Man's Shield) Equal to True
        • Then - Actions
          • Item - Remove (Item carried by (Buying unit) of type Ring of Regeneration)
          • Item - Remove (Item carried by (Buying unit) of type Ring of Regeneration)
          • Item - Remove (Item carried by (Buying unit) of type Poor Man's Shield)
          • Hero - Create Vanguard and give it to (Buying unit)
        • Else - Actions
          • Hero - Create Recipe: Vanguard and give it to (Buying unit)
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
set integer = 0
loop from 1 to 6
--if item type of item carried by hero in slot (integer A) == your item type 1 then
----set integer = integer + 1
endloop
if integer >= 2 and unit has item of type 2 then
--remove item of type 1 from hero
--remove item of type 1 from hero
--remove item of type 2 from hero
--create item of type 3 for hero
 
Level 10
Joined
Mar 17, 2012
Messages
582
set integer = 0
loop from 1 to 6
--if item type of item carried by hero in slot (integer A) == your item type 1 then
----set integer = integer + 1
endloop
if integer >= 2 and unit has item of type 2 then
--remove item of type 1 from hero
--remove item of type 1 from hero
--remove item of type 2 from hero
--create item of type 3 for hero

Thanks! it works!)

Listen, maybe you know how to make a trigger to combine items that way not only when hero buys it, but when he picks it up?
 
Status
Not open for further replies.
Top