HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Item Stacking

09-07-2006, 02:29 PM#1
Siphonized
I have this item called 'Foulwood Ration' in my map, when I pick up another one of the same item, I want to remove both and create a new item with the combined charges of both the other Rations.

My problem is that my trigger gets stuck in the loop I made somehow. Please help:

Trigger:
Foulwood Ration
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
(Item-type of (Item being manipulated)) Equal to |cff00cc66Foulwood Ration|r
Collapse Actions
Set FoulwoodRationHero = (Hero manipulating item)
Wait 0.10 seconds
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by FoulwoodRationHero of type |cff00cc66Foulwood Ration|r)) Equal to |cff00cc66Foulwood Ration|r
Collapse Then - Actions
Collapse For each (Integer A) from 1 to 6, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by FoulwoodRationHero in slot (Integer A))) Equal to |cff00cc66Foulwood Ration|r
Collapse Then - Actions
Set FoulwoodRation = (FoulwoodRation + (Charges remaining in (Item carried by FoulwoodRationHero in slot (Integer A))))
Item - Remove (Item carried by FoulwoodRationHero in slot (Integer A))
Collapse Else - Actions
Do nothing
Hero - Create |cff00cc66Foulwood Ration|r and give it to FoulwoodRationHero
Item - Set charges remaining in (Last created item) to FoulwoodRation
Set FoulwoodRation = 0
Collapse Else - Actions
Do nothing

Edit: It works, but when I use an item, the cooldown timer keeps refreshing itself over and over and over, until it finally isn't on cooldown anymore... I'm almost 100% sure this is because it keeps destroying the item I have and making a new one. Cause when I hoover the mouse over the item, I don't get a tooltip, I have to hoover over it really fast to be able to get a real brief view of the tooltip.
09-07-2006, 03:28 PM#2
grupoapunte
I have this trigger on one of my maps, u can modify it to mae it fit your needs

Trigger:
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
(Item-class of (Item being manipulated)) Equal to Purchasable
Collapse Actions
Collapse For each (Integer A) from 1 to 6, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item being manipulated)) Equal to (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A)))
(Item being manipulated) Not equal to (Item carried by (Hero manipulating item) in slot (Integer A))
Collapse Then - Actions
Item - Set charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A)) to ((Charges remaining in (Item being manipulated)) + (Charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A))))
Item - Remove (Item being manipulated)
Collapse Game - Display to (Player group((Owner of (Hero manipulating item)))) the text: (Combined + ((String((Charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A))))) + ((Name of (Item carried by (Hero manipulating item) in slot (Integer A))) + !)))
Collapse Else - Actions
Do nothing
09-07-2006, 03:30 PM#3
aquilla
I'd use something like this, added the tempitem var cause it was such a hazzle to write all that integer stuff over and over :P
Trigger:
Foulwood Ration
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
(Item-type of (Item being manipulated)) Equal to |cff00cc66Foulwood Ration|r
Collapse Actions
Set FoulwoodRationHero = (Hero manipulating item)
Collapse For each (Integer A) from 1 to 6, do (Actions)
Collapse Loop - Actions
set TempItem = (Item carried by FoulwoodRationHero in slot (Integer A))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of TempItem) Equal to |cff00cc66Foulwood Ration|r
(TempItem Not equal to (Item being manipulated))
Collapse Then - Actions
Item - Set charges remaining in TempItem to (Charges remaining in TempItem) + (Charges remaining in (Item being manipulated))
Item - Remove (Item being manipulated)
Else - Actions
09-07-2006, 04:10 PM#4
Siphonized
Edit: nvm
09-08-2006, 01:46 PM#5
[VDM]Amn
Wow, im back.
Nobody remembers "Unknown6" ^^i. well, im Amn now anyways :p

Quote:
Originally Posted by Siphonized
Events
Unit - A unit Acquires an item
Conditions
(Item-type of (Item being manipulated)) Equal to |cff00cc66Foulwood Ration|r
Actions
Set FoulwoodRationHero = (Hero manipulating item)
Wait 0.10 seconds
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-type of (Item carried by FoulwoodRationHero of type |cff00cc66Foulwood Ration|r)) Equal to |cff00cc66Foulwood Ration|r
Then - 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 FoulwoodRationHero in slot (Integer A))) Equal to |cff00cc66Foulwood Ration|r
Then - Actions
Set FoulwoodRation = (FoulwoodRation + (Charges remaining in (Item carried by FoulwoodRationHero in slot (Integer A))))
Item - Remove (Item carried by FoulwoodRationHero in slot (Integer A))
Else - Actions
Do nothing
Hero - Create |cff00cc66Foulwood Ration|r and give it to FoulwoodRationHero
Item - Set charges remaining in (Last created item) to FoulwoodRation
Set FoulwoodRation = 0
Else - Actions
Do nothing

there. in red the loop.