remaining charges bug?

Level 12
Joined
Jan 13, 2008
Messages
559
My hero has an ability and if he starts casting it, the following action gets triggered:

  • For each (Integer A) from 1 to 6, do (Actions)
    • Loop - Actions
      • Game - Display to (All players) the text: test
      • 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))) Greater than 1
        • Then - Actions
          • Game - Display to (All players) the text: d
          • 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))) - 1)
        • Else - Actions
          • Game - Display to (All players) the text: z
          • Item - Remove (Item carried by (Triggering unit) in slot (Integer A))
cr = charges remaining
Now if my hero has
3 cr in Slot 1
1 cr in Slot 3
3 cr in Slot 5

what happens is that 1 charges gets removed from slot 1, item in Slot 3 gets removed but item in Slot 5 is unchanged.

if my hero has 3 cr in all slots then everything works fine and he loses 1 charge of each item. I also tried other scenarios and what happens is that as soon as it spots an item with 1 cr, it removes it and then the action stops...any idea why this could happen?
 
if my hero has 3 cr in all slots then everything works fine and he loses 1 charge of each item. I also tried other scenarios and what happens is that as soon as it spots an item with 1 cr, it removes it and then the action stops...any idea why this could happen?
If you have another Trigger with the Event Unit - Loses Item, and you use the for Each Integer A loop inside this OnItem-Lose it will break.
Cause of the Loop overlapping. Easiest solution would be to use another Loop Integer in the OnLoseItem stuff.
 
Top