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

Easy Item Stack 'n Split v2.7.4 [Unmaintained]

Easy Item Stack 'n Split v2.7.4
by Dangerb0y



This system is outdated and unmaintained as I'm no longer making WC3 maps. Thank you to everyone who's used and supported this system over the years. I enjoyed it so much that I became a full-time developer and have no free time anymore :gg:

If anyone would like to take over development and maintenance, please feel free to
PM me.



FEATURES:
- Automatically stacks obtained items to an optional stack limit.
- Allows stacking items within a unit's inventory.
- Allows splitting item stacks within a unit's inventory.
- Allows units to seamlessly pick up items regardless of a full inventory.
- Copy-paste implementation.

STACKING ITEMS:
- Obtained items are automatically stacked with same-type items in a unit's inventory.
- Placing same-type items on top of each other will stack them together.

SPLITTING ITEMS:
- Double right-clicking or dropping an item stack on itself will split 1 off the pile. (optional)
- Consecutively split items will stack together. (optional)
- If a unit's inventory slots are full when splitting an item stack, the split item will be dropped on the ground in front of the unit. (optional)

ITEM STACKS:
- The maximum stack size is set by the item's level in the Object Editor (Shift+Double-click allows entering levels greater than 8).
- Setting an item's level to 0 will give it an unlimited stack size.
- Items must have charges in order to be stacked; non-charged items will function as Blizzard intended.

RELEASE NOTES:
- This system can be implemented into just about any map.
- This system is completely leak-free.
- This system is completely lag-free.
- This system is fully MUI and MPI.
- This system works with all inventory sizes.
- This system does NOT use hashtables or gamecache, i.e. it is much faster.
- This system is available in vJASS and GUI.

IMPLEMENTATION (vJASS):
1) Copy the trigger "EasyItemStacknSplit" to your Trigger Editor.
You must have JNGP + The Latest JassHelper to implement this version!

IMPLEMENTATION (GUI):
1) In map view, go to File > Preferences... and tick "Automatically create unknown variables while pasting trigger data" under the General tab.
2) Copy the trigger "EasyItemStacknSplitGUI" to your Trigger Editor.

UPDATING? Make sure to first delete old EasyItemStacknSplit triggers and, if you use the GUI version, all the variables with the "EasyItem" prefix.

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. :)
v2.7.4:
--> Fixed a bug causing powerups to double up. Thank you to pks9067 for picking this up.
v2.7.3:
--> Added functionality for item stacks larger than their set stack size.
v2.7.2:
--> Fixed a split-stacking bug in GUI version. Thank you to xorkatoss for picking this up.
v2.7.1:
--> Fixed a stacking overflow bug in GUI version. Thank you to ABM for picking this up.
v2.7:
--> Consecutively split items now stack together!
--> Added parameters for split-stacking.
--> Majorly optimized GUI version.
v2.6.1:
--> Minor item cooldown incongruity fixed.
--> Minor code optimization.
v2.6:
--> Added parameter to enable/disable using item levels to determine stack limit.
--> Removed the full inventory error message. It's just not worth the ClearTextMessages.
--> Got rid of custom scripts in the GUI version where possible.
--> Reworked sounds a bit.
v2.5:
--> Modernized vJASS version a bit.
--> Condensed GUI version into a single trigger.
--> Fixed 1 or 2 potential bugs.
v2.4.2:
--> Another desync issue fixed (both versions). Looks like we're finally out of the woods.
v2.4.1:
--> System parameter added for enabling/disabling item split-dropping.
--> Desync issue fixed in GUI version. Thank you to gadina_prokleta for picking this up.
v2.4:
--> System parameter added for enabling/disabling item splitting.
--> System parameters added to GUI version.
--> Some much needed security added.
v2.3.2:
--> Timer cycle performance enhanced.
v2.3.1:
--> Minor lag issue fixed.
--> Some minor bugs fixed.
v2.3:
--> Optimized timer recycling.
--> Minor sound bugs fixed.
--> Some other important bugs fixed.
v2.2:
--> Major bug fix regarding desyncs in multiplayer maps.
--> Fixed a stacking issue in GUI version.
--> Minor code optimization.
v2.1:
--> Added the ability to have unlimited stack sizes by setting item level to 0.
v2.0.1:
--> Fixed minor sound bug in vJASS version.
--> Optimized code a bit more in vJASS version.
v2.0:
--> Completely revamped code to allow full inventory usage!
--> Removed the JASS version and added a vJASS version. Anyone coding in JASS should be doing it in vJASS anyway.
v1.7:
--> Optimized code slightly more.
--> Added GUI version for the GUIers.
v1.6:
--> Converted to JASS for better optimization and easier implementation.
--> Optimized code for slightly faster execution.
--> Added more comments.
v1.5:
--> Changed loops to use a set variable to avoid any conflict with other loops in a map. Thank you to Caedrus for picking this up.
v1.4:
--> Fixed a bug (which somehow created itself after months of working fine) causing items not to split properly. Thank you to 88WaRCraFT3 for picking this up.
v1.3:
--> Added several comments to the script to make it easier to understand.
v1.2:
--> Fixed a bug causing split-off-stack-and-auto-dropped items to be placed at position of unit instead of in front of it.
v1.1:
--> Fixed point leaks caused by creating items at points with polar offsets. This system is now 100% leak-free!
+REP for anyone who finds a bug or leak for me to fix :)

Keywords:
item, stack, split, inventory, full, items, system, simple, easy, everything, unit, jass, vjass, gui, warcraft, editor, wc3
Contents

Easy Item Stack 'n Split v2.7.4 (Map)

Reviews
11:23, 22nd Dec 2009 TriggerHappy: Review for Spell I suppose it can be useful for other GUI users. The other GUI ones IIRC aren't as advanced as this, therefor I will approve this. Status Feel free to message me here if you...
Level 20
Joined
Jul 12, 2010
Messages
1,717
hey dude, it's been a while...
as you already know, this is the best stacking system available BUT it takes more space than it's supposed to be...(IMO)
a normal stacking system takes about 5-6kb and yours is about 25kb...
i know that 20kb is not that much BUT im making a roc map for b.net with tft data...
so as you can see even 1kb lower is good 4 me since i want players to download my map fast...

what im trying to say:
could you please add a bonus stacking system that can:
1)stack items
2)split into half
3)unlimited stacks
4)pick up regardless of full inventory
5)no parameters and comments(to reduce size)
6)call it Item Stack and Split Lite? :D
7)make it in GUI if possible...(i don't like vJass sry)
8)use as less actions as possible (ofc :p)

thnx for wasting your time to read this!
and a bigger thnx plus rep if you do my request!!^^

EDIT:
oh well i guess you are not interested in my idea *_*
 
Last edited:
Level 8
Joined
Oct 11, 2009
Messages
40
Hey man. Sorry for the extremely late reply. To be honest I'm not really supporting this system anymore. I just don't have time for it these days. So i'm gonna have to turn down your request unfortunately.

If you wanna get your map size down, you could just use Wc3mapoptimizer by Vexorian. It'll automatically remove comments and anything else it can to reduce the size of your map as much as possible. I completely understand your concern, but I really don't think 5-25kB makes much of a difference anyway.

Cheers dude, and good luck with your map. If you send me a link I'll be happy to add it under "Maps Using This System."
 
Level 8
Joined
Mar 12, 2008
Messages
437
Alright, let's necropost.

In the test map, when I pick up a tome with a full inventory, it plays the error sound. (using the GUI trigger)

Though it seems like an easy fix, just by throwing an item check condition before playing the sound.
 

Sverkerman

Hosted Project: BoW
Level 17
Joined
Feb 28, 2010
Messages
1,325
Kind of a late reply, but perhaps I'll find an answer to my question.

This system makes the event "Unit Generic - Unit Acquires an item" run twice instead of once when picking up an item.
Anyone with a fix?

EDIT: Found a good workaround, added a boolean variable and set it to true when the item stack system is giving items/removing items and to false when it is not to track if the Acquire Item/Lose Item event is player based or system based.
 
Last edited:
Level 11
Joined
Jan 25, 2017
Messages
213
@Sverkerman Hey, can you explain what your workaround is more completely? I'm unfamiliar with boolean variables but the way I would have done it is turning off/on triggers relating to 'unit acquires (or loses) an item' when appropriate... but it seems like your solution may be more simple.

EDIT: Err... nvm, I think I figured it out- Turning off/on other triggers can be problematic (?) but if I set boolean to true and false before and after the system uses 'give- item' then put a condition: 'is variable false?' than it should work. Thanks :)
 
Last edited:
Level 22
Joined
Jul 25, 2009
Messages
3,091
Alright, something which is peeving me is, when you try to pick up power ups with a full inventory it says "Inventory is full." even though I removed this message from gameplay interface and it orders the unit to stop. How do I fix this.
 
Level 11
Joined
Jan 25, 2017
Messages
213
But how to put an error message when inventory is really full?
You can't both have your cake and eat it

Can I ask how to disable stacking on a specific item?
This only affects charged items but if you set the system to 'useitemlevel' as the cap you can set the item level to one for just one charge. Otherwise you can edit the code directly and put conditions for your specific item(s)

---
Question: Jass checker says this trigger leaks a point. Is it a false positive? Is it the jass condition where it checks to see if pointtargetcommand = null (can't remember actual wording) or something else?
 
Level 4
Joined
Oct 1, 2017
Messages
99
You can't both have your cake and eat it


This only affects charged items but if you set the system to 'useitemlevel' as the cap you can set the item level to one for just one charge. Otherwise you can edit the code directly and put conditions for your specific item(s)

---
Question: Jass checker says this trigger leaks a point. Is it a false positive? Is it the jass condition where it checks to see if pointtargetcommand = null (can't remember actual wording) or something else?
Ok,good idea...Thanks!
 
Level 2
Joined
Apr 3, 2011
Messages
8
You can't both have your cake and eat it


This only affects charged items but if you set the system to 'useitemlevel' as the cap you can set the item level to one for just one charge. Otherwise you can edit the code directly and put conditions for your specific item(s)

Im using GUI, where do i have to put that condition?
 
Level 12
Joined
Feb 27, 2019
Messages
399
I think there is an error here:

  • Actions
  • [...]
  • Then - Actions
    • Set EasyItem_string[0] = EasyItem__ERRORSOUND
    • Custom script: if GetLocalPlayer() != GetOwningPlayer(udg_EasyItem_unit) then
    • Set EasyItem_string[0] = <Empty String>
    • Custom script: endif
    • Custom script: set udg_EasyItem_sound = CreateSound( EasyItem__ERRORSOUND, false, false, false, 12700, 12700, "" )
    • Sound - Set volume of EasyItem_sound to 100.00%
    • Sound - Play EasyItem_sound
    • Sound - Destroy EasyItem_sound
    • Set EasyItem_sound = No sound
In CreateSound, you should use the udg_EasyItem_string[0] variable you just set, not the EasyItem__ERRORSOUND variable no ? :)
 
Level 12
Joined
Feb 27, 2019
Messages
399
Very good system. Just 2 suggestion for developers who implement it:

1/ Carefull, because of this system when a unit acquires an item, the event is triggered 2x
2/ The system triggers the error sound when inventory full without a "inventory is full" message
3/ The system triggers the error sound even if the picked item is a power-up or activates automatically on acquisition.

To fix 2/ and 3/ I modified a bit a part of the trigger (requires Warcraft 1.31):

  • Set EasyItem__ERRORMESSAGE = Inventory is full.
  • [...]
  • Else - Actions
    • Unit - Order EasyItem_unit to Stop
    • -------- PLAY THE FULL INVENTORY ERROR SOUND FOR TRIGGER PLAYER --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • < 2 new conditions added here >
        • (Item-class of EasyItem_item) Not equal to Powerup
        • (Item: EasyItem_item's Boolean Field: Use Automatically When Acquired ('ipow')) Equal to False
        • < -------------------------------->
        • EasyItem__ERRORSOUND Not equal to <Empty String>
      • Then - Actions
        • Set EasyItem_string[0] = EasyItem__ERRORSOUND
        • Custom script: if GetLocalPlayer() != GetOwningPlayer(udg_EasyItem_unit) then
        • Set EasyItem_string[0] = <Empty String>
        • Custom script: endif
        • Custom script: set udg_EasyItem_sound = CreateSound( udg_EasyItem_string[0], false, false, false, 12700, 12700, "" )
        • Sound - Set volume of EasyItem_sound to 100.00%
        • Sound - Play EasyItem_sound
        • Sound - Destroy EasyItem_sound
        • Set EasyItem_sound = No sound
        • < 2 new lines>
        • Custom script: call ClearTextMessages()
        • Custom script: call DisplayTimedTextToPlayer(GetOwningPlayer(udg_EasyItem_unit),0.50,-1.00,2.00,"|cffffcc00"+udg_EasyItem__ERRORMESSAGE+"|r")
        • < ------------>
      • Else - Actions
 
Level 13
Joined
Oct 18, 2013
Messages
690
Is there compatibility for preventing, say, any items of a Type from splitting? I have 'charged' items that are not meant to split in my map, and that functionality would be amazing.
 
Level 3
Joined
Apr 21, 2018
Messages
18
When my heroes pick up items it creates a Holy Light special effect, but I cant find anywhere in the trigger to disable this.
 
Level 12
Joined
Feb 27, 2019
Messages
399
For info, I'm currently asking to Dangerb0y, who retired, if I can take over the development of this system, in order for it to still be functional with Warcraft patch 1.32+.

Copy of the PM I sent to him:
Hello !

First of all thanks for your hardwork development W3 systems in the past !

I'm currently using your Easy Item Stack 'n Split v2.7.4 system in my map, Xnd Hero Siege. I did some fix for myself since W3 patch changed a few things and made the system not work properly anymore.

I saw that you've retired, so I would like to ask to you : can I take on the development of this system ? With respect of your work & credits of course, like I did with Sogat for X Hero Siege.

Sincerely,

Ricola3D
 
Level 25
Joined
Feb 2, 2006
Messages
1,686
Does this work with the native Warcraft stacking system? Every item type in Warcraft has a stack limit. Otherwise, items do not stack. Does this system check those values or does it use its own limits/flags if an item can be stacked or not? I was thinking about writing my own unstack code because Warcraft now has this native stack system but no unstacking support.
 
Top