• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Craft item help 2

Status
Not open for further replies.
Level 10
Joined
Mar 17, 2012
Messages
579
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,240
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
579
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