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!
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
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!
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...
You're right about the eye attraction , but i'm gonna have to disagree with you that there are loads of systems like this... i may be wrong, so if you can find a system like this (as easy to implement, completely bug & leak free, MUI & MPI, and as functional) please post a link so i can tell you why my system is still better
You're right about the eye attraction , but i'm gonna have to disagree with you that there are loads of systems like this... i may be wrong, so if you can find a system like this (as easy to implement, completely bug & leak free, MUI & MPI, and as functional) please post a link so i can tell you why my system is still better
well if you ask me like that My Bag and Advanced Item System
It does the same as yours and many more things and you just need to implement 1 trigger without any variables...
But know serious again:
Your system is very good, too, most for GUI beginners which want to learn!!
well if you ask me like that My Bag and Advanced Item System
It does the same as yours and many more things and you just need to implement 1 trigger without any variables...
Sure, it's definitely been done before, just not very well or efficiently from what I've seen... I guess the only real differences are quality and ease of use. Thanks for downloading and rating
If you have five stacks of 3 mana potions, and one stack of one mana potion, and you try to pick up more potions, it doesn't stack them. It just says inventory full.
But I guess there's no way around it unless you base the thing around runes.
Well the level is 3 by default, so it should stack up to 3 potions in the same stack. However if my inventory is full, and I try to pick up a stack of two potions, it doesn't pick it up, even though there is one inventory slot with only one mana potion.
i guess the simple way around that would be:
Drop both stacks.
Pick up stack of 2
Pick up stack of 1
Problem solved. I mean.. the system still is more than what wc3 does for you.
It doesn't tie your shoes and beat halo 3 on legendary for you though.
Yeah, the plan for this system was never really to solve the full-inventory-stacking problem, its purpose is just to add some much needed inventory capabilities to any map with little effort, and to be easily understandable by the average GUIer. A while ago i coded a system based on this one that gets around the full inventory problem, both with picking up and buying items, but as you mentioned, Maker, it works with runes which makes implementing it not so "easy" anymore...
I'm still on the lookout for easier ways of overcoming the full inv problem, so if you have a link to your system please post it so we can take a look.
I'm still on the lookout for easier ways of overcoming the full inv problem, so if you have a link to your system please post it so we can take a look.
As soon as i get some free time i'll definitely be interested in GUIing your method. it would be really nice to implement this feature without mapmakers having to make duplicate items and what not. I'll PM you..
Thanks for the comments other people, glad you enjoy the system
That is the weirdest thing ever. I've downloaded this map a couple times myself just for fun and it's worked perfectly every time. Until now. Anyway I've fixed the problem and uploaded the new version, see if it works for you now.
This is great! It's simple yet effective. However I converted it into JASS for better optimization and configureability. I hope it helps somebody.
Here's the code: (I know it's not perfect but it's better than plain GUI anyways, I guess.)
JASS:
//===========================================================================
//========================= ITEM STACKING ===================================
//===========================================================================
// - Manages items stacking and splitting
// - To make an item stackable, simple add it's rawcode to the list below
//
// - Credits:
// - Original GUI system by Dangerb0y
// - Converted to JASS by Wezthal
//===========================================================================
scope ItemStacking initializer Init
//===========================================================================
globals
constant real DEGTORAD = 0.01745327
private integer array stackable
private integer orderId = 0
private constant hashtable StackHash = InitHashtable()
endglobals
//===========================================================================
function GetItemTypeIdMaxCharges takes integer nItemTypeId returns integer
local item it = CreateItem(nItemTypeId, 0, 0)
local integer it_charges = GetItemCharges(it)
call RemoveItem(it)
set it = null
return it_charges
endfunction
//===========================================================================
private function Setup takes nothing returns nothing
local integer i = 0
local integer array it_id
//===========================================================================
//========================== SETUP START ====================================
//===========================================================================
//List stackable itemtype rawcodes here
set it_id[0] = 'I001'
set it_id[1] = 'I006'
//set it_id[2] = ' '
//set it_id[3] = ' '
// . . .
//===========================================================================
//========================== SETUP END ======================================
//===========================================================================
loop
exitwhen (it_id[i] == null)
call SaveBoolean(StackHash, StringHash("IsItemStackable"), it_id[i], true)
call SaveInteger(StackHash, StringHash("ItemTypeIdMaxCharges"), it_id[i], GetItemTypeIdMaxCharges(it_id[i]))
set i = i + 1
endloop
endfunction
//===========================================================================
private function CountItems takes unit u returns integer
local integer i = 0
local integer items = 0
loop
exitwhen (i > 5)
if (UnitItemInSlot(u, i) != null) then
set items = items + 1
endif
set i = i + 1
endloop
return items
endfunction
//===========================================================================
private function ItemStacking_Conditions takes nothing returns boolean
local item it
local integer it_id
local integer i = 0
if (GetOrderTargetItem() != null) then
set it = GetOrderTargetItem()
else
set it = GetManipulatedItem()
endif
set it_id = GetItemTypeId(it)
if (GetItemCharges(it) > 0) then
if (LoadBoolean(StackHash, StringHash("IsItemStackable"), it_id)) then
set it = null
return true
endif
endif
set it = null
return false
endfunction
//===========================================================================
private function ItemStacking_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer pl = GetPlayerId(GetOwningPlayer(u))
local integer i
local item loopItem
local integer loopItemTypeId
local integer loopItemMaxCharges
local integer loopItemCharges
local item eventItem = GetOrderTargetItem()
local integer eventItemTypeId
local integer eventItemMaxCharges
local integer eventItemCharges
local item newItem
local real X
local real Y
local real facing
if (orderId != 1) then
set orderId = GetIssuedOrderId()
if (orderId >= 852002) and (orderId <= 852007) then
if ( CountItems(u) > 0 ) and ( UnitHasItem( u, eventItem ) ) then
set i = 0
loop
exitwhen (i > UnitInventorySize(u) - 1)
set eventItem = GetOrderTargetItem()
set eventItemTypeId = GetItemTypeId(eventItem)
set eventItemMaxCharges = LoadInteger(StackHash, StringHash("ItemTypeIdMaxCharges"), eventItemTypeId)
set eventItemCharges = GetItemCharges(eventItem)
set loopItem = UnitItemInSlot(u, i)
set loopItemTypeId = GetItemTypeId(loopItem)
set loopItemMaxCharges = LoadInteger(StackHash, StringHash("ItemTypeIdMaxCharges"), loopItemTypeId)
set loopItemCharges = GetItemCharges(loopItem)
if ( orderId == 852002 + i ) then
if ( loopItemTypeId == eventItemTypeId ) then
if ( loopItem != eventItem ) then
if ( loopItemCharges + eventItemCharges > eventItemMaxCharges ) then
if ( eventItemCharges != eventItemMaxCharges ) then
if ( loopItemCharges != loopItemMaxCharges ) then
call SetItemCharges( loopItem, ( loopItemCharges + eventItemCharges ) - eventItemMaxCharges )
call SetItemCharges( eventItem, eventItemMaxCharges )
endif
endif
else
call SetItemCharges( eventItem, eventItemCharges + loopItemCharges )
call RemoveItem( loopItem )
endif
else
if ( eventItemCharges > 1) then
call SetItemCharges( eventItem, eventItemCharges - 1 )
set facing = GetUnitFacing( u )
set X = GetUnitX( u ) + 100.0 * Cos( facing * DEGTORAD )
set Y = GetUnitY( u ) + 100.0 * Sin( facing * DEGTORAD )
set newItem = CreateItem( eventItemTypeId, X, Y)
call SetItemCharges( newItem, 1 )
if ( CountItems( u ) < UnitInventorySize( u ) ) then
set orderId = 1
call UnitAddItem( u, newItem )
set orderId = 0
endif
endif
endif
endif
endif
set i = i + 1
endloop
endif
else
set i = 0
loop
exitwhen (i > UnitInventorySize(u) - 1)
set eventItem = GetManipulatedItem()
set eventItemTypeId = GetItemTypeId(eventItem)
set eventItemMaxCharges = LoadInteger(StackHash, StringHash("ItemTypeIdMaxCharges"), eventItemTypeId)
set eventItemCharges = GetItemCharges(eventItem)
set loopItem = UnitItemInSlot(u, i)
set loopItemTypeId = GetItemTypeId(loopItem)
set loopItemMaxCharges = LoadInteger(StackHash, StringHash("ItemTypeIdMaxCharges"), loopItemTypeId)
set loopItemCharges = GetItemCharges(loopItem)
if ( loopItemTypeId == eventItemTypeId ) then
if ( loopItemCharges < loopItemMaxCharges ) then
if ( loopItem != eventItem ) then
if ( loopItemCharges + eventItemCharges > eventItemMaxCharges ) then
call SetItemCharges( eventItem, (loopItemCharges + eventItemCharges) - eventItemMaxCharges )
call SetItemCharges( loopItem, eventItemMaxCharges )
else
call SetItemCharges( loopItem, loopItemCharges + eventItemCharges )
call RemoveItem( eventItem )
endif
endif
endif
endif
set i = i + 1
endloop
endif
endif
set u = null
set loopItem = null
set eventItem = null
set newItem = null
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local integer i
local trigger t = CreateTrigger()
call Setup()
set i = 0
loop
exitwhen (i > 8)
if (GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING) then
call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, null)
call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_PICKUP_ITEM, null)
endif
set i = i + 1
endloop
call TriggerAddCondition(t, Condition( function ItemStacking_Conditions ) )
call TriggerAddAction(t, function ItemStacking_Actions )
set t = null
endfunction
//===========================================================================
endscope
//===========================================================================
Well, I've got a bit of a problem with this system. I imported it exactly as the directions suggested (just copied the trigger and variables), and it seems to interfere rather severely with all timers and loops in my game. I can't seem to figure out exactly *why* this is, but it's definitely coming from this system, since disabling the item stack and split trigger fixes everything.
What could be causing such game-breaking interference? Any help would be greatly appreciated; I would love to be able to use this system without utterly breaking the rest of my game
EDIT: I seem to have found the issue... the "Integer A" loops were interfering with the "Integer A" loops already in the game. Replacing it with a unique variable loop fixed the issue. Perhaps you should consider using a unique variable for your loops (eg loop for integer variable instead of loop for integer A) so that games can't glitch from using the same variable simultaneously when newbies like me import it
Just when I thought I was cruising down bug-free lane Better to find them than not I guess... Many thanks Caedrus. That's quite the esoteric of bugs.
For anyone experiencing what Caedrus was, I've uploaded a new version of the system. Please also check out the IMPLEMENTATION steps again as I've had to add one more variable to properly iron out this bug.
P.S. I played your Last Tower map, Caedrus. Very nice.
Great GUI system, some people may use these in their maps for many uses thus also documenting each part of the trigger, therefore newbs may learn something new.
It's not really a "bug" (as there's nothing inherently wrong with using the default A/B loops on their own) so much as it's just more likely to interfere with (or be interfered with by) pre-existing systems when not using a unique variable since many people will use the default "Integer A" or "Integer B" loop triggers (and you can't run more than one of those at the same time).
Hold shift when clicking on a field in the object editor and you can input whatever value you want (including negative values). You could set the level to 50 or whatever.
It's flawless, simple to implement, easy to use or modify, and is the most flexible GUI item stacking and splitting system I have ever seen. You can expect me to use this in a few of my projects, and will be crediting you, of course. Thank you!
It's flawless, simple to implement, easy to use or modify, and is the most flexible GUI item stacking and splitting system I have ever seen. You can except me to use this in a few of my projects, and will be crediting you, of course. Thank you!
I'm glad you noticed haha. Thanks for the positive response guy, and the rep of course, much appreciated. I'm going to be working on a possible v2.0 of this system, so keep an eye out!
Sorry man, I must have missed your post. You can stack charged items that are already in your inventory when it's full, but you can't pick up items when your inventory is full. It's just one of War3's annoying limitations. There are ways to do it of course, but it gets quite complicated.
lol and to think that the last version of this system that i have is 1.4 xD
very nice man this is one of the best systems on hive workshop
keep up the good work with your awesome system ;D
lol and to think that the last version of this system that i have is 1.4 xD
very nice man this is one of the best triggers on hive workshop
keep up the good work with your awesome system ;D
Under the user's avatar, there is a thumbs up icon. Click it to give that user rep! But you have to spread the rep around first in order to rep that person once again.
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.