System Item Stacking

lindenkron

You can change this now in User CP
Reaction score
102
If you imported it correctly, a double right-click should split the item.

Something delusional most have been going on when i first tested this system.

Im pretty sure it did;
Right click an item, click a new slot --> Moves 1 item from the old stack to the new slot, and removes 1 item from the old stack, or when you doubble rightclick it creates a new item in the slot next to. I would really like to avoid any "item dropping" :)

Now people are saying its SUPPOSE to drop one item on the ground ? Not what i recall it did when i first tested it :nuts:.

Anyway, would there be anyway to change what you made here, to what i wrote above? :)

Thanks
-Lindenkron
 

SFilip

Gone but not forgotten
Reaction score
633
Try this.
Trigger:
  • Split
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Custom script: set udg_order = GetIssuedOrderId()
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • order Greater than or equal to 852002
          • order Less than or equal to 852007
          • (Target item of issued order) Equal to (Item carried by (Ordered unit) in slot (order - 852001))
          • (Charges remaining in (Target item of issued order)) Greater than 1
        • Then - Actions
          • Item - Set charges remaining in (Target item of issued order) to ((Charges remaining in (Target item of issued order)) - 1)
          • Trigger - Turn off Acquire <gen>
          • Hero - Create (Item-type of (Target item of issued order)) and give it to (Ordered unit)
          • Trigger - Turn on Acquire <gen>
          • Item - Set charges remaining in (Last created item) to 1
        • Else - Actions

When you double right-click on an item, 1 charge will be split and given to the Hero if he has free slots, otherwise dropped on the ground.

Here's a trigger for merging those items back:
Trigger:
  • Merge
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Custom script: set udg_order = GetIssuedOrderId()
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • order Greater than or equal to 852002
          • order Less than or equal to 852007
          • (Target item of issued order) Not equal to (Item carried by (Ordered unit) in slot (order - 852001))
          • (Item-type of (Target item of issued order)) Equal to (Item-type of (Item carried by (Ordered unit) in slot (order - 852001)))
        • Then - Actions
          • Item - Set charges remaining in (Target item of issued order) to ((Charges remaining in (Target item of issued order)) + (Charges remaining in (Item carried by (Ordered unit) in slot (order - 852001))))
          • Item - Remove (Item carried by (Ordered unit) in slot (order - 852001))
        • Else - Actions

If you drop one item of the same type over another, they will merge.
 

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
its lulzy comparing old systems to new ones

also necro
 

leon0007

New Member
Reaction score
0
Item Stacking System II​

Edit (November 8th, 2006): Replaced the item list condition with something more global, now affects all stackable items.

I decided to remake my old system in order to make it better. This one has a limit of items that can be in one slot at time. I figured that the most suitable way to define this limit would be the item level. By default the level can't go above 8, but you can bypass that by simply holding Shift when changing the level field.
Also you only need one trigger for this system while the second is optional (but recommended & useful).
There is also a demo map this time if you don't want to do everything manually. ;)

Code:
Acquire



    Events
        Unit - A unit Acquires an item
    Conditions
        (Charges remaining in (Item being manipulated)) Not equal to 0
    Actions
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to (Item-type of (Item being manipulated))
                        (Charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A))) Less than (Item level of (Item carried by (Hero manipulating item) in slot (Integer A)))
                        (Item carried by (Hero manipulating item) in slot (Integer A)) Not equal to (Item being manipulated)
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A))) + (Charges remaining in (Item being manipulated))) Greater than (Item level of (Item being manipulated))
                            Then - Actions
                                Item - Set charges remaining in (Item being manipulated) to (((Charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A))) + (Charges remaining in (Item being manipulated))) - (Item level of (Item being manipulated)))
                                Item - Set charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A)) to (Item level of (Item being manipulated))
                            Else - Actions
                                Item - Set charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A)) to ((Charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A))) + (Charges remaining in (Item being manipulated)))
                                Item - Remove (Item being manipulated)
                    Else - Actions

This is the second, optional trigger. It allows you to split stackable items by making a double right-click.
Requires 2 variables: order (of type Integer) and L (of type Point).
Code:
Split
    Events
        Unit - A unit Is issued an order targeting an object
    Conditions
    Actions
        Custom script:   set udg_order = GetIssuedOrderId()
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                order Greater than or equal to 852002
                order Less than or equal to 852007
                (Target item of issued order) Equal to (Item carried by (Ordered unit) in slot (order - 852001))
                (Charges remaining in (Target item of issued order)) Greater than 1
            Then - Actions
                Item - Set charges remaining in (Target item of issued order) to ((Charges remaining in (Target item of issued order)) - 1)
                Set L = (Position of (Ordered unit))
                Item - Create (Item-type of (Target item of issued order)) at L
                Custom script:   call RemoveLocation(udg_L)
                Item - Set charges remaining in (Last created item) to 1
            Else - Actions

If you are curious about the order...852002 is the order id used when you move the item to inventory slot 1. 852003 is the same thing, but for slot 2 etc.
The third condition checks if the slot you dropped it on is the same as the slot used by the item previously.

If you find any bugs feel free to PM me and i'll fix them right away.

Thank for your:) tutorial map
 

SanKakU

Member
Reaction score
21
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top