Warcraft III resources & community, 2003–2006 · archived

Adding items to inventory please

5 posts
#1

Adding items to inventory please

If a unit buys or picks up say, scrap metal if the unit already has scrap metal how do you make it so it adds the scrap metal picked up to the amount already owned, and if you have an item “Blacksmiths Hammer” and try to pick up or buy another and it comes with 5 or theres one with a certain amount left on the ground how do you add the amount you have to what you try to pick up or buy even if you have a full inventory, same with the scrap metal, ill play around and see if i can figure it out. I got something but it removes both the items instead of adding it to one. thx
#2

Hey

You have to make two triggers

1st ( Unit gets an combo item ) :

Event: A unit gets an item
Conditions :
Action:
If then do else do
If All Conditons are true
item being manipulated equal to *itemtype1*
Triggering unit has an item of type *itemtype2*
equal to true
then do:
Remove items of type*itemtype1* from triggering
Unit
Remove items of type*itemtype2* from triggering
Unit
Add a item of type *comboitem1* to triggering
unit
Else do do nothing


Sorry I don't know how to make the 2nd trigger for you
#3
for the second trigger yopu can not use "aquites item" as an event. Obviously that even is not triggered, if the item is not put into the inventory -.- (hate that sometimes)
therefore you'd have to think of a way to check, whether a player wants to archieve an item, he already has, (that is stackable). I du not know whether that might be possible, but i guess if it is, it is not that easy o fa code.

for the rest you shall use the search function.
There is a tutorial in the tut section that does the "if i pick up a item it stacks towards others of the same kind" stuff.
#4
And aquires item does work if your inventory is full and you buy an item from i shop, i tested it out. I dont have time to test it picking up an item or to go to the tutorial now but i will tomorrow thx.
#5
2nd trigger? LOL
Stacking items - 1 trigger
Dota Style Mixing - 2 triggers (constants + trigger)

Of course i may make a tutorial,but i made universal triggers for all maps and don't wanna give it to anyone.