• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Item problem

Status
Not open for further replies.
Level 5
Joined
Dec 7, 2008
Messages
90
I was wondering if there's a way to make more items stay in one slot of inventory.

I have an item called METAL ORE. And a quest requests that I pick up 5 Metal Ores, but when the unit picks them up, all the METAL ORES go in different slots. Can all those items (of same type and class, everything same) go to one slot in my unit's inventory?
 
Level 5
Joined
Dec 18, 2007
Messages
205
an easy item stack system would be this:

  • other stack
    • Events
      • Unit - A unit Aquires an item
    • Bedingungen
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Item-type of (Item being manipulated)) Gleich Metal Ore
              • (Item-type of (Item being manipulated)) Gleich Other items that spuld stack....
          • (Charges remaining in (Item being manipulated)) bigger than 0
        • 'THEN'-Actions
          • For each (Integer B) from 1 to 6, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Bedingungen
                  • (Item carried by (Triggering unit) in slot (Integer B)) not equal to (Item being manipulated)
                  • (Item-type of (Item being manipulated)) equal to (Item-type of (Item carried by (Triggering unit) in slot (Integer B)))
                • 'THEN'-Aktionen
                  • Item - Set charges remaining in (Item carried by (Triggering unit) in slot (Integer B)) to ((Charges remaining in (Item carried by (Triggering unit) in slot (Integer B))) + (Charges remaining in (Item being manipulated)))
                  • Item - Remove (Item being manipulated)
                  • Skip remaining actions
                • 'ELSE'-Aktionen
        • 'ELSE'-Aktionen
it is just copied/paste (german) and a little bit edited, so ask, if there's something unclear.

to your quest: just check whether the unit has an item of type metal ore with 5 (or more) stacks

greetings
 
Level 11
Joined
Jun 21, 2007
Messages
505
To stack items you can try this:
  • Item Stacking
  • Events
    • Unit - A unit acquires an item
  • Conditions
  • Actions
    • If (Conditions) Then (Then actions) Else (Else actions)
      • If - Conditions
        • Hero has item of type (Item Type of (Item being manipulated))
      • Then - Actions
        • Set A_VARIABLEOFTYPE_INTEGER = 0
        • For each integer A from 1 to 6 do actions
          • If (Item carried in slot (Integer A) of (Unit manipulating the item) Equal to item-type of (Item being manipulated)) then do (Set A_VARIABLEOFTYPE_INTEGER = A_VARIABLEOFTYPE_INTEGER + 1) else do (Do nothing)
        • Set A_VARIABLEOFTYPE_ITEMTYPE = Item-type of (Item being manipulated)
        • For each integer A from 1 to 6 do actions
          • If (Item carried in slot (Integer A) of (Unit manipulating the item) Equal to item-type of (Item being manipulated)) then do (Remove item carried in slot (Integer A) of (Hero manipulating the item) else do (Do nothing)
        • Hero - Create item of type (A_VARIABLEOFTYPE_ITEMTYPE) and give it to (Hero manipulating the item)
        • Item - Set charges of (Last created item) to (A_VARIABLEOFTYPE_INTEGER)
      • Else - Actions
        • Do nothing
 
Last edited:
Status
Not open for further replies.
Top