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

How to create a simple item stacking system?

Status
Not open for further replies.
Level 8
Joined
Mar 26, 2009
Messages
301
What would be the most basic and non-buggy form of item stacking?
I tried lots of methods on my own, the closest thing I got to a successful stack was items starting with 2 charges on it; if it is 2 or more, it did stack well. I thought it was easy. But when I use "Unit acquired item" event and use "Item Type of Blah owned by Blah" thing, that counts the item that've been picked up at that very moment. I've wasted the triggers since they got all too confusing.. Please someone help.
 
Level 13
Joined
Sep 13, 2010
Messages
550
It's quite old, not system and since the Unit - A unit Acquires an item event you can use 5 inventory spaces. It looks a bit complicted but as I see it doesn't have any leaks... You should set Number of charges to 1 in object editor.

  • Stack item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to (==) Campaign
      • (Item being manipulated) Not equal to (!=) (Item carried by (Triggering unit) of type (Item-type of (Item being manipulated)))
    • Actions
      • Item - Set charges remaining in (Item carried by (Triggering unit) of type (Item-type of (Item being manipulated))) to ((Charges remaining in (Item carried by (Triggering unit) of type (Item-type of (Item being manipulated)))) + (Charges remaining in (Item being manipulated)))
      • Item - Remove (Item being manipulated)
 
Maybe?
  • Events
    • Unit - A unit Acquires an item
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Item-type of (Item being manipulated)) Equal to Greater Potion of Healing
        • (Item-type of (Item being manipulated)) Equal to Greater Potion of Mana
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Hero manipulating item) has an item of type (Item-type of (Item being manipulated))) Equal to True
        • (Item being manipulated) Not equal to (Item carried by (Hero manipulating item) of type (Item-type of (Item being manipulated)))
      • Then - Actions
        • Item - Set charges remaining in (Item carried by (Hero manipulating item) of type (Item-type of (Item being manipulated))) to ((Charges remaining in (Item carried by (Hero manipulating item) of type (Item-type of (Item being manipulated)))) + (Charges remaining in (Item being manipulated)))
        • Hero - Drop (Item being manipulated) from (Hero manipulating item)
        • Item - Remove (Last dropped item)
      • Else - Actions
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
It's quite old, not system and since the Unit - A unit Acquires an item event you can use 5 inventory spaces. It looks a bit complicted but as I see it doesn't have any leaks... You should set Number of charges to 1 in object editor.

  • Stack item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to (==) Campaign
      • (Item being manipulated) Not equal to (!=) (Item carried by (Triggering unit) of type (Item-type of (Item being manipulated)))
    • Actions
      • Item - Set charges remaining in (Item carried by (Triggering unit) of type (Item-type of (Item being manipulated))) to ((Charges remaining in (Item carried by (Triggering unit) of type (Item-type of (Item being manipulated)))) + (Charges remaining in (Item being manipulated)))
      • Item - Remove (Item being manipulated)

This trigger works greatly for what I want... but i'd like to add an Stock Limit (To 12), and a Split system (Half/half), and autocast (Click->Cast on self) and not (Click->select target)...

How would we do that?

And, most important... Avoid the "Inventory is Full" having a Potion with 1 charge...
 
Last edited by a moderator:
Status
Not open for further replies.
Top