[Trigger] Stacking Items Trigger

Level 7
Joined
Dec 8, 2008
Messages
243
So, here's what I'm getting at. I want players to be able to stack potions, but I dont want the stack to exceed 10 charges. Here's how I'm doing.
  • LesserHealingPotion
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to [|cff7777aaLvl 1|r] Lesser Healing Potion
    • 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
              • Or - Any (Conditions) are true
                • Conditions
                  • (Charges remaining in (Item carried by (Triggering unit) in slot (Integer A))) Equal to 10
            • Then - Actions
              • Do nothing
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to (Item-type of (Item being manipulated))
                  • (Item carried by (Triggering unit) in slot (Integer A)) Not equal to (Item being manipulated)
                • Then - Actions
                  • Item - Set charges remaining in (Item carried by (Triggering unit) in slot (Integer A)) to ((Charges remaining in (Item carried by (Triggering unit) in slot (Integer A))) + (Charges remaining in (Item being manipulated)))
                  • Item - Remove (Item being manipulated)
                • Else - Actions
 
  • Max10
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Charged
    • 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 (Triggering unit) in slot (Integer A))) Equal to (Item-type of (Item being manipulated))
              • (Item carried by (Triggering unit) 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 (Triggering unit) in slot (Integer A))) Less than 10
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Charges remaining in (Item being manipulated)) + (Charges remaining in (Item carried by (Triggering unit) in slot (Integer A)))) Less than or equal to 10
                    • Then - Actions
                      • Item - Set charges remaining in (Item carried by (Triggering unit) in slot (Integer A)) to ((Charges remaining in (Item carried by (Triggering unit) in slot (Integer A))) + (Charges remaining in (Item being manipulated)))
                      • Item - Remove (Item being manipulated)
                    • Else - Actions
                • Else - Actions
            • Else - Actions
Here is the test map: View attachment Max10 Charges.w3x
 
Level 9
Joined
May 22, 2009
Messages
276
correct me if I'm wrong, but I think you have to set max charges to 10 in object editor, then when you buy the item set the charge to one, and have a trigger to stack the items, I remember when I first tried this and add charges to an item with no charges, or even less then the max I wanted it to have it crashed my game

I gonna find my charging trigger and post it here

EDIT: nvm pharaoh beat me to it, DAMN U!!!! j/k
 
Level 7
Joined
Dec 8, 2008
Messages
243
The Pharaoh_ has spoken. *bows*
Thanks, friend. Hopefully I can easily apply to this to work for one single item.

[edit] yup, got it working for singular items. Hats off for you Pharaoh and thanks for taking an interest, Skamigo. :)
 
Top