HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Item Stacking: Limitations...

09-16-2007, 06:10 AM#1
Ignitedstar
Here is the trigger I am using for stacking items. It works, but the problem is after it works. Just to say, I obtained this from someone in the site, but I don't remember their name at the moment.

Trigger:
Ninety Nine Stackable Items
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Item-type of (Item being manipulated)) Equal to Healing Salve
Collapse Actions
Set Caster = (Hero manipulating item)
Collapse For each (Integer A) from 1 to 6, do (Actions)
Collapse Loop - Actions
Set TempItem = (Item carried by Caster 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 Healing Salve
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

So, the point is that the trigger stacks an item called "Healing Salve". Okay, so it works perfectly. However, I'm having a problem of what I want to do with it. Since it is a weak healing item, I want to limit the stacking to 99. The problem is that the number it can stack to is endless. I was having fun stacking it up so high, but found the problems it would bring(endless healing, etc.). How am I to limit the item to a stack of 99?

I believe that there is another problem; even if I do limit the stacking process, what is there to say about what will happen if you already have a first stack of 97, then you obtain another Healing Salve? All potions come in threes, so: 97 + 3 = 100, but the limit is 99. Wouldn't the extra charge dissapear? This is just a speculation, though(I haven't confirmed it happening). I'm concerned, because when it comes to the potions that cost more... and I mean a LOT more, you don't want gold to go to waste.
09-16-2007, 09:39 AM#2
botanic
after this:

Item - Set charges remaining in TempItem to ((Charges remaining in TempItem) + (Charges remaining in (Item being manipulated)))
Item - Remove (Item being manipulated)

add an

if tempitem charges remaining > 99 then
create potion at location of triggering unit

set charges for last created item = (Charges remaining in (Item being manipulated))-99
set charges for tempitem = 99
09-17-2007, 03:39 AM#3
Ignitedstar
Bah. This is what I get from not triggering for a month. Sigh...

Anyways, thank you botanic.