• 🏆 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!

Upgrading items

Status
Not open for further replies.

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
hey guys i've seen some maps where you can upgrade items, such in troll tribes, and 300, i'd like to know what's the trigger for when an unit has exact item cast ability and make it either cost gold/lumber or requiere another item (like morphing two items into one) such dota. anyone could help me create this trigger? rep+ to whoever helps
 
Level 8
Joined
Nov 9, 2008
Messages
502
event - unit aquires an item

condition - item being manipulated is item1 or item2
condition - unit has item1 in inventory and unit has item2 in inventory

action - remove item1
action - remove item2
action - make item3 and give to triggering unit

i think there's a tutorial about this
 
Level 7
Joined
May 6, 2008
Messages
284
  • Sword
  • Razorspine
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (((Hero manipulating item) has an item of type Sword) Equal to True) or ((Unit-type of (Triggering unit)) Equal to Dummy)
        • Then - Actions
          • Item - Remove (Item carried by (Hero manipulating item) of type Sword)
          • Hero - Create Swordx2 and give it to (Hero manipulating item)
          • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\AIem\AIemTarget.mdl
          • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\AIlm\AIlmTarget.mdl
          • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\AIim\AIimTarget.mdl
          • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\AIsm\AIsmTarget.mdl
          • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\AIre\AIreTarget.mdl
        • Else - Actions
          • Do nothing
that what i use if here is some problems i hope other guys will fix it
 
Level 8
Joined
Nov 9, 2008
Messages
502
First, why are you using if-then-else if u don't need to?

Your condition is inconsistent because of the 'or'. I'm assuming you want to add swordx2 only if unit has sword? At the moment the trigger is giving swordx2 to your hero (dummy?) when it aquires ANY item because the 'or' makes the trigger ingnore your first condition if the hero getting an item is Dummy. Replace 'or' with 'and'.

Remember to clean up and Special Effects you use. They are persistent and stay unless you trigger to remove them. I don't do this often so I don't know but maybe if you add an expiration to each effect that will clean them up nicely.
 
Level 8
Joined
Nov 9, 2008
Messages
502
Ah ok, it would because the if-then-else states all conditions must be true. Missed that.
You effects aren't too bad because you won't be making the trigger run hundreds of times. Still better to clean up your effects.
 
  • Like
Reactions: Ham
Level 10
Joined
May 20, 2008
Messages
433
This is the trigger I'm using for my map:
  • Barricade
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • ((Triggering unit) has an item of type Barricade_Items[1]) Equal to True
      • ((Triggering unit) has an item of type Barricade_Items[2]) Equal to True
    • Actions
      • Item - Remove (Item carried by (Triggering unit) of type Barricade_Items[1])
      • Item - Remove (Item carried by (Triggering unit) of type Barricade_Items[2])
      • Hero - Create Barricade and give it to (Triggering unit)
Barricade_Items[#] is a variable that is set to the 2 items that create the barricade.
This trigger automatically creates the item. DOTA has a third item (so I'm told) and thats just an item to ensure that you can create the item (I believe its a recipt, but then again, I don't play DOTA).
To check for resources, in conditions, add "Player #'s current (resource) is greater then or equal to (cost)" then just add "Add -# to Player #'s current (resource)". Basically, that adds negative resources (takes away) only if the player can afford it. If you need clarification, I could give it to you.
 
  • Like
Reactions: Ham

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
ok that's pretty much about combining items, but now what about upgrading items? using gold / lumber (or even mp / hp)
 
Level 8
Joined
Nov 9, 2008
Messages
502
Same principle man.

Check whether the unit getting the item has previous item if so remove it and add a new upgraded item. Then take away all cost like gold/lumber is easy.

HP/MANA just do set units hp/mana to ((triggering units hp/mana) - cost).

Have you read the tutorial by toolbox? How to make item recipes
 
Status
Not open for further replies.
Top