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

Adding items to inventory please

Status
Not open for further replies.
Level 4
Joined
Oct 12, 2004
Messages
59
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
 
Level 8
Joined
Nov 20, 2005
Messages
372
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
 
Level 6
Joined
Feb 18, 2005
Messages
263
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.
 
Level 4
Joined
Oct 12, 2004
Messages
59
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.
 
Status
Not open for further replies.
Top