• 🏆 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/Split Sytem

Status
Not open for further replies.
Level 37
Joined
Aug 14, 2006
Messages
7,601
Hey.

I have little problem I would like you to look at it a little. One Serbian guy made a system for me about one and half year ago. The idea of system was to make potions stack, player could split items easily and when inventory is full, player could still pick up more items that can stack to inventory.

I'm here asking from you either how to fix this system or to make one even better system than this. In either way, I'll give you rep + credits @ the campaign(of course if you make totally own system I will give you credits as system creator).

The current bug is, when I click an item with right mouse twice, the item completely disappears.
 

Attachments

  • Item Stack System v1.5.w3x
    22.2 KB · Views: 112
Level 37
Joined
Aug 14, 2006
Messages
7,601
Have you tried this Item Stack/Split System? There's GUI and JASS versions.

It doesn't work how I want. When my inventory is full and I try to take/buy new same potions it says inventory is full.

What I want are these three things:

- Basic item stack(many specific items at same slot)
- Split system(player can easily split and combine items)
- Inventory NOT full(can buy/take more same type of items and increase the count even if the inventory is already full)
 
Last edited:
Level 19
Joined
Feb 4, 2009
Messages
1,313
I added these lines to the beginning of item split trigger
checks if the slot of issued order is the same as the one where the items are in
  • Custom script: if GetOrderTargetItem() == UnitItemInSlot(GetOrderedUnit(), GetIssuedOrderId()-852002) then
  • Skip remaining actions
  • Custom script: endif
didn't test it too though but I think it works

edit:
you said
I'm here asking from you [...] how to fix this system [...] The current bug is, when I click an item with right mouse twice, the item completely disappears.

now it's fixed
 

Attachments

  • Item Stack System v1.5.w3x
    22.3 KB · Views: 109
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
One way to avoid the Inventory full -message is to create items based on runes. Runes can be used/"picked up" even with full inventory.

Create two versions of each item. One is based on a rune and one is the normal item. The one on ground is the rune version, the one in your inventory is the normal one. When you pick up the rune version, remove it and create the inventory versiomn of the item for your unit.

Here's some code for the system. Do you need some other features in it? Max stack size? Combining items in inventory?

  • Init Items
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set Item_Types_Ground[0] = Potion of Healing
      • Set Item_Types_Ground[1] = Potion of Mana
      • Set Item_Types_Inventory[0] = Potion of Healing
      • Set Item_Types_Inventory[1] = Potion of Mana
      • Set Item_Max_Index = 1
  • Stack Get Items
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Powerup
    • Actions
      • Set u1 = (Triggering unit)
      • Set Item_Type = (Item-type of (Item being manipulated))
      • For each (Integer loopB) from 0 to Item_Max_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Item_Type Equal to Item_Types_Ground[loopB]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (u1 has an item of type Item_Types_Inventory[loopB]) Equal to True
                • Then - Actions
                  • For each (Integer loopA) 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 u1 in slot loopA)) Equal to Item_Types_Inventory[loopB]
                        • Then - Actions
                          • Item - Set charges remaining in (Item carried by u1 in slot loopA) to ((Charges remaining in (Item carried by u1 in slot loopA)) + 1)
                          • Skip remaining actions
                        • Else - Actions
                • Else - Actions
                  • Trigger - Turn off (This trigger)
                  • Hero - Create Item_Types_Inventory[loopB] and give it to u1
                  • Trigger - Turn on (This trigger)
                  • Skip remaining actions
            • Else - Actions
  • Stack Lose Items
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Charges remaining in (Item being manipulated)) Greater than 0
    • Actions
      • Set u1 = (Triggering unit)
      • Set Item = (Item being manipulated)
      • Set Item_Type = (Item-type of Item)
      • Set i1 = (Charges remaining in Item)
      • For each (Integer loopA) from 0 to Item_Max_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Item_Type Equal to Item_Types_Inventory[loopA]
            • Then - Actions
              • Custom script: call CreateItem( udg_Item_Types_Ground[udg_loopA] , GetUnitX(udg_u1) + 100 * Cos(GetUnitFacing(udg_u1) ) , GetUnitY(udg_u1) + 100 * Sin(GetUnitFacing(udg_u1) ) )
              • Item - Remove Item
              • Skip remaining actions
            • Else - Actions

 

Attachments

  • Item_Test.w3x
    20.9 KB · Views: 61
Level 13
Joined
Mar 24, 2010
Messages
950
why did you use v1.5 and not v1.7? just wondering i havent really looked at it yet.

theres a system similar to what hes asking that was done by the guy that made RvsS and he shared it with me, although i think theres an easier way to do it than his way maybe.

Anyway let me know if what you did works for him if not i'll help ya out.

not sure why skipping the actions in the trigger would let him stack items while having all 6 slots full though?

Edit: nvm guess i posted too late lol had the page open a while lol.
 
Level 37
Joined
Aug 14, 2006
Messages
7,601
why did you use v1.5 and not v1.7? just wondering i havent really looked at it yet.

theres a system similar to what hes asking that was done by the guy that made RvsS and he shared it with me, although i think theres an easier way to do it than his way maybe.

Anyway let me know if what you did works for him if not i'll help ya out.

not sure why skipping the actions in the trigger would let him stack items while having all 6 slots full though?

Edit: nvm guess i posted too late lol had the page open a while lol.

I really don't have a clue what you are talking about. I'm sure there are thousands of item stacking system but they are not what I want.

EDIT: It seems like finally I was able to talk to him and I'm sure he'll fix his own bugs in his own system so I don't need help anymore. Thanks for the help anyway and rep for the ones who actually tried to help me.

EDIT2: It seems like D4RK_G4ND4LF's fix was perfect and everything is fixed now. Thanks!
 
Last edited:
Status
Not open for further replies.
Top