System Item Stacking System

Mr Zero

Junior Regular (Got the T-shirt)
Reaction score
64
  • System Name:
    Item Stacking System​
  • Author:
    Mr. Zero​
  • Category:
    Gameplay Affecting, Item Manipulation​
  • Current Version:
    1.0.7​
  • Features:
    • Stacking of items
    • Split of items
    • Merging of items
  • Description:
    Item Stacking System is a triggered system for Warcraft 3 maps. (TFT and RoC as well.) That it does is 'stack' items. Instead you have two healing potions with three charges each, the Item Stacking System will stack them and make one healing potion with six charges. Very useful when you need lots of healing potions... or mana potions.

    You can also double right click on the item and it will drop the default charge and place it in the inventory. Right clicking on one item and another item will cause them to merge if they are of same type and one of them is not above iteml level.​
  • Warcraft 3 Test:
    The Frozen Throne, Version 1.21
    Works

    Reign of Chaos, Version 1.21
    Works​
  • Required Functions/Systems:
    None​
  • Configurable Variables:
    None​
  • Globals Variables Required:
    gg_trg_Item_Stacking_System​
  • Credits:
  • Comments:
    How to install and use:
    Copy the folder called "Item Stacking System" into your map. To copy; mark the folder and press CTRL+C (The hotkey for Copy) or mark the folder and go in the menu line under "Edit" and select "Copy".

    copyandpastevn7.gif

    Now go to your map's trigger editor and either press CTRL+V (The hotkey for Paste) or go in the menu line under "Edit" and select "Paste". You should now see the folder in your map.

    Item Stacking System uses Item Level for know how much it can be stacked.

    Example; Lets say that my mana potion is a level 5 item, and I get one each time I pick one up (1 charge). When I have four in my inventory and I pick one more up, the Item Stacking System goes and look at the item level of the item.

    itemlevelxt3.png

    If the item's charges equals to item level, it will not stack the items. So all you have to is set the item level on the item you want to stack.
    (Remember to set "Number of Charges" as well.)
    Frequently Asked Questions:
    Question 1. said:
    Is it MUI (MultiUnit Instantiable) and MPI (MultiPlayer Instantiable)?

    Yes. Multi players can use it on multi units at the same time.

    Question 2. said:
    Why can I not set item level higher then 8?

    Hold down shift and double click on Stats - Item Level. Now you should be able to write higher values.

    Question 3. said:
    Why will the system not stack? I have set the item level.

    Remember to set charges as well. No charges means no stacking.
  • Changelog:
    Current Version:
    • Version 1.0.7 - Date 01/01-2008
      • Changes / Additions
        • Changed from a few integer variables to one integer array in both functions.
        • Instead of checking if the created item "c" is needed, it removes item "c" completly, once the needed information has been recorded. The system will first create a new item when the condition is fulfilled.
        • Removed "return" from both functions, since the functions is not returning anything.

    Older Versions:
    • Version 1.06 - Date 12/23-2007
      • Changes / Additions
        • "GetItemTypeId" function call changed to variable.
      • Fixes
        • Minor fixes on clean up after use of item.
    • Version 1.05a - Date 11/20-2007
      • Changes / Additions
        • Lots of native function calls changed to stored variables
    • Version 1.05 - Date 11/20-2007
      • Changes / Additions
        • Right click, with a non-full charged item, on a full charged item will cause the two items to trade charges.
    • Version 1.04b - Date 11/18-2007
      • Fixes
        • Didn't remove item
    • Version 1.04a - Date 11/18-2007
      • Changes / Additions
        • Optimized for a smaller size
        • Removed; when double right click on item with less then default charges it won't drop the item any more.
    • Version: 1.03 - Date: 06/28-07
      • Changes / Additions
        • Optimizied the code
        • Removed unneeded spaces
    • Version: 1.02 - Date: 06/27-07
      • Changes / Additions
        • Replaced Location with Real
    • Version: 1.01 - Date: 05/08-07
      • Changes / Additions
        • Merged Loop in the event
    • Version: 1.00 - Date: 05/07-07
      • Changes / Additions
        • No Longer Beta
        • Optimized all the code
        • Do no longer uses variables
        • All leaks founded and cleaned
        • All BJs founded and made to negatives
        • Fixed an endless loop
    • Version: 0.65 - Date: 03/06-07
      • Changes / Additions
        • "Set Charges" trigger is reduced by 48% (Old: 50 lines, New: 27 lines)
        • "Remove Charges" trigger is reduced by 48% (Old: 120 lines, New: 56 lines)
    • Version: 0.63 - Date: 03/05-07
      • Changes / Additions
        • Removed GUI Setup and Settings trigger
        • Removed almost every variable
      • Fixes
        • Fixed a bug that a player could drop items outside boundary
        • Fixed a small errors in the code
    • Version: 0.50 - Date: 02/11-07
      • Changes / Additions
        • Entered Beta Stage
        • Optimized the code
        • Added a GUI Setup and Settings trigger
        • Remove all remaining unneeded functions
    • Version: 0.45 - Date: 02/10-07
      • Changes / Additions
        • "Remove Charges" trigger has been rewritten
        • "Set Charges" trigger has been rewritten
        • Added new variables for "Remove Charges" trigger
        • "Remove Charges" trigger do no longer use custom value of item
      • Fixes
        • Fixed a bug that would cause a endless loop
    • Version: 0.17 - Date: 02/05-07
      • Changes / Additions
        • Optimized the "Set Charges" trigger
        • "Set Charges" trigger no longer uses custom value of the item
      • Fixes
        • Fixed a bug that could get the player a full charges of the item
    • Version: 0.15 - Date: 02/05-07
      • Changes / Additions
        • Now 100% JASS for "Set Charges" trigger
        • Optimized the "Set Charges" trigger
        • Added new variables for "Set Charges" trigger
        • Removed the old "Set Charges" variables
      • Fixes
        • Fixed a bug that could terminate the loop in "Set Charges" trigger
        • Fixed a bug that non-hero units couldn't pick up items
    • Version: 0.10 - Date: 02/03-07
      • Changes / Additions
        • Entered Alpha Stage
  • Source Code:
    Trigger: gg_trg_Item_Stacking_System 102 lines ~ 3.56 KB.
    JASS:
    //***************************************************************************
    //*
    //*  Item Stacking System
    //*  Version 1.0.7, 01/01-08
    //*
    //*  Coded by Mr. Zero - [email protected]
    //*
    //***************************************************************************
    function ISS_SC takes nothing returns nothing
        local integer array i
        local item a=GetManipulatedItem()
        local unit b=GetManipulatingUnit()
        local item c
        set i[0]=0
        set i[1]=GetItemLevel(a)
        set i[2]=GetItemCharges(a)
        set i[3]=GetItemTypeId(a)
        if(i[2]!=0)then
            loop
                exitwhen i[0]>5
                set c=UnitItemInSlot(b,i[0])
                set i[4]=GetItemCharges(c)
                set i[5]=GetItemTypeId(c)
                if(((c!=a)and(i[5]==i[3]))and(i[4]<i[1]))then
                    if((i[4]+i[2])<=i[1])then
                        call SetItemCharges(c,(i[4]+i[2]))
                        call RemoveItem(a)
                        exitwhen true
                    else
                        call SetItemCharges(a,(i[4]+i[2])-i[1])
                        call SetItemCharges(c,i[1])
                        call UnitAddItem(b,a)
                        exitwhen true
                    endif
                endif
                set i[0]=i[0]+1
            endloop
        endif
        set a=null
        set b=null
        set c=null
    endfunction
    function ISS_RC takes nothing returns nothing
        local integer array i
        local unit a=GetOrderedUnit()
        local item b=GetOrderTargetItem()
        local item c=UnitItemInSlot(a,(GetIssuedOrderId()-852002))
        set i[0]=0
        set i[1]=GetItemCharges(b)
        set i[2]=GetItemLevel(b)
        set i[3]=GetItemTypeId(b)
        set i[4]=GetItemCharges(c)
        set i[5]=GetItemTypeId(c)
        if((((GetIssuedOrderId()>=852002)and(GetIssuedOrderId()<=852007))and(i[1]!=0)and(c!=null)))then
            if(b==c)then
                set c=CreateItem(i[3],0,0)
                set i[4]=GetItemCharges(c)
                call RemoveItem(c)
                if(i[1]>i[4])then
                    loop
                        exitwhen i[0]>5
                        if(UnitItemInSlot(a,i[0])==null)then
                            call SetItemCharges(b,(i[1]-i[4]))
                            set b=CreateItem(i[3],0,0)
                            call DisableTrigger(gg_trg_Item_Stacking_System)
                            call UnitAddItem(a,b)
                            call EnableTrigger(gg_trg_Item_Stacking_System)
                            exitwhen true
                        endif
                        set i[0]=i[0]+1
                    endloop
                endif
            else
                if((i[5]==i[3])and(i[4]<i[2]))then
                    if((i[1]+i[4])<=i[2])then
                        call SetItemCharges(b,(i[1]+i[4]))
                        call RemoveItem(c)
                    else
                        call SetItemCharges(c,(i[1]+i[4])-i[2])
                        call SetItemCharges(b,i[2])
                    endif
                endif
            endif
        endif
        set a=null
        set b=null
        set c=null
    endfunction
    function InitTrig_Item_Stacking_System takes nothing returns nothing
        local integer i=0
        local trigger t=CreateTrigger()
        set gg_trg_Item_Stacking_System=CreateTrigger()
        loop
            exitwhen i==16
            call TriggerRegisterPlayerUnitEvent(gg_trg_Item_Stacking_System,Player(i),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
            call TriggerRegisterPlayerUnitEvent(t,Player(i),EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER,null)
            set i=i+1
        endloop
        call TriggerAddAction(gg_trg_Item_Stacking_System,function ISS_SC)
        call TriggerAddAction(t,function ISS_RC)
        set t=null
    endfunction
    Statistics: 102 lines ~ 3.56 KB, 1 trigger.
  • Download:
    Attached below.

    Download views in total: 149
    (From last version)
 

Attachments

  • Item Stacking System.w3m
    13.8 KB · Views: 863

substance

New Member
Reaction score
34
Why do you use local locations when you just get their X and Y anyway? Just use reals IMO.

Anyway, goodjob. +rep
 
T

Trigath

Guest
It isn't working at all, I can't event test the example map....:S ???
It just won't start playing the map...
plus once copied to my map it gives tons of compile errors....

I checked the errors, and it seems that the "GetItemCharges" doesn't exist in the editor...:S ???
Same goes for the "SetItemCharges".....I really don't get it...
 

Mr Zero

Junior Regular (Got the T-shirt)
Reaction score
64
Why do you use local locations when you just get their X and Y anyway? Just use reals IMO.

Anyway, goodjob. +rep

Because I'm lazy...? :eek:

this wont work for me, they wont stack even though i changed the level :confused:

Solved though PM.

Problem: Won't stack!?
Solution: Make sure your item has charges! No charges, no stacking.

Add to FAQ.

It isn't working at all, I can't event test the example map....:S ???
It just won't start playing the map...
plus once copied to my map it gives tons of compile errors....

I checked the errors, and it seems that the "GetItemCharges" doesn't exist in the editor...:S ???
Same goes for the "SetItemCharges".....I really don't get it...

Hmm... I can't tell why the example map isn't working on your computer, works fine for me and a j j bones.

When you are copying the code what have you called the trigger?
It is needed to be called "Item Stacking System" (Without " and case sensitive ). If you want to change the name when do the same above and then change it's name. The Editor should change the code for you then.

The errors can be because the trigger isn't name correctly. The functions you have mention is existing both for TFT and RoC, so no problems there.

Otherwise I have no idea.
 

Mr Zero

Junior Regular (Got the T-shirt)
Reaction score
64
Update

  • Version 1.02 - Date 06/27-2007
    • Changes / Additions
      • Replaced Location with Real
        (Thanks to substance for suggestion!)

Edit some spelling mistakes, replaced a picture and updated update log and source code.
Previous Download: TFT-Map: 24, RoC-Map: 7

EDIT:

  • Version 1.03 - Date 06/28-2007
    • Changes / Additions
      • Optimized the code
      • Removed unneeded spaces

Previous Download: 1
 

Mr Zero

Junior Regular (Got the T-shirt)
Reaction score
64
  • Version 1.04a - Date 11/18-2007
    • Changes / Additions
      • Optimized for a smaller size
        4 whole lines! Be amazed! :p
      • Removed; when double right click on item with less then default charges it won't drop the item any more.
        Lets just say that I got some "hints" saying this feature was annoying... (Seems that people was clumsy with what they dropped :rolleyes:)

Previous Download: 49
 

Mr Zero

Junior Regular (Got the T-shirt)
Reaction score
64
NOTICE: Seems that I made a error. I will make a quick fix soon as possible (~1 hour)

Edit:
  • Version 1.04b - Date 11/18-2007
    • Fixes
      • Didn't remove item
        Forgot a line :rolleyes:

Previous Download: 0
 

Mr Zero

Junior Regular (Got the T-shirt)
Reaction score
64
  • Version 1.05 - Date 11/20-2007
    • Changes / Additions
      • Right click, with a non-full charged item, on a full charged item will cause the two items to trade charges.
        So it look like a switch between items

P.S. Five double posts for the win! :rolleyes: :p

P.S.S. Take it as a hint that I would like some feedback, or am I just wasting time here as usually..? ;)

Previous Download: 0
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
Well, there is much more to be optimized.


In the "ISS_Set_Charges" trigger, why wont you set the item in the slot to a variable and use it throughout the whole loop?

Saves a lot of function calls.

"((UnitItemInSlot(b,i) != a) and (GetItemTypeId(UnitItemInSlot(b,i))..."

"GetItemCharges(a)"

All these lines can be set to a variable.


The same applies for the "ISS_Remove_Charges" trigger.

"GetItemCharges(b)" can be set to a variable.
 

Mr Zero

Junior Regular (Got the T-shirt)
Reaction score
64
... :eek:
Heh seems that I though of so much else, that I forgot to turn them into variables.

Thanks Andrewgosu.

Sometimes you just need a finger to point at the mistake... :p

Edit:

  • Version 1.05a - Date 11/20-2007
    • Changes / Additions
      • Lots of native function calls changed to stored variables
        Wow... How to be blind!? :eek:
        Thanks to Andrewgosu
Previous Download: 0
 

Mr Zero

Junior Regular (Got the T-shirt)
Reaction score
64
Topic updated for better handle of information and quicker overview.

  • Version 1.06 - Date 12/23-2007
    • Changes / Additions
      • "GetItemTypeId" function call changed to variable.
    • Fixes
      • Minor fixes on clean up after use of item.
 

Mr Zero

Junior Regular (Got the T-shirt)
Reaction score
64
Version 1.0.7

  • Version 1.0.7, 01/01-2008
    • Changes / Additions
      • Changed from a few integer variables to one integer array in both functions.
      • Instead of checking if the created item "c" is needed, it removes item "c" completly, once the needed information has been recorded. The system will first create a new item when the condition is fulfilled.
      • Removed "return" from both functions, since the functions is not returning anything.

By the way...

HAPPY NEW YEAR! :)
 

Mr Zero

Junior Regular (Got the T-shirt)
Reaction score
64
I can't do anything about then the inventory is full and you try to pick up another thing. That is simply just how Blizzard decided to make it.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top