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

Item Stack System (vJass)

Status
Not open for further replies.
Level 12
Joined
Jan 2, 2016
Messages
973
Did you read this part?
1) Create a blank text document on your desktop and name it "blank.wav".
2) Import it with Import Manager and give it the custom path "Sound\Interface\Warning\Human\KnightInventoryFull1.wav".
Repeat this step for the following:
- "Sound\Interface\Warning\Orc\GruntInventoryFull1.wav"
- "Sound\Interface\Warning\Naga\NagaInventoryFull1.wav"
- "Sound\Interface\Warning\Undead\NecromancerInventoryFull1.wav"
- "Sound\Interface\Warning\NightElf\SentinelInventoryFull1.wav"
3) In map view, go to Advanced > Game interface... look for "Text - Message - 'Inventory is full.'" and put in a single space as its value.
4) Give yourself a firm yet gentle pat on the back. :)
 
Level 13
Joined
Mar 19, 2010
Messages
870
I have some potion items which should be stackable.
At the moment i have Heal and Mana potions and it should be possible to buy max 5x per potion.

Ex.

Itemslot: 0 == 5x Healing Potion
Itemslot: 1 == 4x Healing Potion
Itemslot: 2 == 3x Mana Potion
Itemslot: 3 == other non-stackable Item
Itemslot: 4 == other non-stackable Item
Itemslot: 5 == other non-stackable Item

What is splitting?

If the inventory is full (like in the example) and i want to buy more healing or mana potions...it should be work that "Itemslot 1 and Itemslot 2" increase up to 5x Healing and 5x Mana.

You understand me?
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
constant integer MAX_ITEM_CHARGES = 99
Sets globally for all item type ids the maximum of charges for stacking items via code.
In your example you should set it to 5.

The system starts at slot 0 ( 1 ) and ends at slot 5 ( 6 ) and fill up all items of the same type
id until the item charges are 0 or MAX_ITEM_CHARGES, then moves to the next item slot.

What is splitting?
The opposite of stacking. You split 4 charges to 2x2.

If the inventory is full (like in the example) and i want to buy more healing or mana potions...it should be work that "Itemslot 1 and Itemslot 2" increase up to 5x Healing and 5x Mana.
The native pickup item event will not fire if the inventory is full.
You would additionally have to check for the player unit buy item event.

Check on buy event if the inventory is full, therefore no will pickup event fire,
then run the same code as I posted.
 
Last edited:
Level 19
Joined
Mar 18, 2012
Messages
1,716
I made a small mistake in the code with <= operator. I've updated the code above.

Which Event do you mean? Atm i'm trying to solve "the inventory full" issue
I guess you can't. When the inventory is full no order event is fired, hence you can't detect it.
Room, gold and lumber resource seems to be basic conditions for a unit sell item event to fire at all.
 
Status
Not open for further replies.
Top