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!
of course you can stack items on picking them up, but it only makes sense to some extend since you cannot "split" them again. You can however use it for potions and scrolls, ankhs and stuff like that, but it requires some triggering work.
Also you have to decide wether you want stackable items to be stacked at the time they are being picked up or as you stack them manually. Both is possible, but I will only explain the first version:
First, make an array of item-types of items that you want to make stackable and a function that runs at map initialisation and that fills the array with those item types (i.e. Set Stackable_Items[0] = Potion of Healing, Set Stackable_Items[1] = Potion of Greater Healing, ..). Also you will need a dummy integer variable to store values, I will call it "dInteger".
Ok now the main trigger:
Code:
Events:
- A unit acquires an Item
Conditions:
- None
Actions:
- For each (Integer A) from 0 to [The number of items in your stackable_items array] Do Action:
- If ( Item-Type of (Item Being Manipulated) Equal To (Stackable_Items[Integer A]) ) Then ( Set dInteger = Integer A ) Else ( Do Nothing )
- For each (Integer A) from 1 to 6 Do Actions:
- IF:
- Item type of ( Item carried by (Triggering Unit) in slot (Integer A) ) Equal To ( Stackable_Items[dInteger] )
- Item carried by (Triggering Unit) in slot (Integer A) Not Equal To (Item Being Manipulated)
THEN:
- Set charges remaining in ( Item carried by (Triggering Unit) in slot (Integer A) ) to ( ( Charges Remaining in ( Item carried by (Triggering Unit) in slot (Integer A) ) + ( Charges Remaining in (Item Being Manipulated ) )
- Remove (Item Being Manipulated)
- Skip Remaining Actions
Short explaination of what we do: First we check wether an item being picked up is a stackable one by comparing its item-type to the item-types stored in the array.
Then we check the inventory of our triggering unit for that item-type, but since we don't want the item to be added to itself, we check, too, that the item picked up is not equal to the item in that slot.
Finally we add the charges of our picked up item to the valid existing item. Done.
Success,
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.