[Trigger] Leak in fast loop

Status
Not open for further replies.
Level 15
Joined
Oct 18, 2008
Messages
1,591
Hey guys!
I'm just really in problem... How the hell can I make a loop trigger leakless which makes 2 special effects every 0.03-0.05 seconds?
Is it okay like this?
  • Storms Wrath Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set SWRandom = (Random integer number between 1 and 500)
      • Set SWR = (SWCPos offset by (Real(SWRandom)) towards (Random angle) degrees)
      • Special Effect - Create a special effect at SWR using war3mapImported\Lightnings Long.mdx
      • Set SWSE[SWSEC] = (Last created special effect)
      • Special Effect - Create a special effect at SWR using war3mapImported\EMPBomb.mdx
      • Set SWSE[(SWSEC + 1)] = (Last created special effect)
      • Set SWTarget = (Units within 100.00 of SWR matching (((Matching unit) belongs to an enemy of (Owner of SWCaster)) Equal to True))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SWSEC Less than 8190
        • Then - Actions
          • Set SWSEC = (SWSEC + 2)
        • Else - Actions
          • Set SWSEC = 0
      • Unit Group - Pick every unit in SWTarget and do (Actions)
        • Loop - Actions
          • Unit - Cause SWCaster to damage (Picked unit), dealing ((Real((Intelligence of SWCaster (Include bonuses)))) x 1.00) damage of attack type Spells and damage type Lightning
      • Wait 0.00 seconds
      • Custom script: call DestroyGroup ( udg_SWTarget )
      • Special Effect - Destroy SWSE[SWSEC]
      • Special Effect - Destroy SWSE[(SWSEC + 1)]
 
Last edited:
Level 13
Joined
Mar 24, 2010
Messages
950
you need to remove the point leaks you have and also the unit group leak, also if you mUst wait before removing the affects try waiting 0.00 secs and see if it'll still work for you, it just may.. :)
 
>> SWSEC Less than 9998

JASS array max size is 8192, which means you have a hypothetical problem here.

The valid array values are 0 thru 8191, though the last slot in the array has a problem when saving so you shouldn't go higher than 8190 if you're using it for more than an instant (which you are, what with the wait).

I recommend you change your boolean to:

SWSEC Less than 8189

But I can't imagine you'll ever reach a value that high ;)

Edit: and don't set SWSEC to 1, set it to 0, otherwise you're cheating yourself out of an array slot.
 
Level 15
Joined
Oct 18, 2008
Messages
1,591
Thanks that's new to me :D And I think I can make it go higher :D Every 0.03s I go +2 and it lasts for 30 secs let's count it :D 30*30*2... hmm still just 1800 :D But when I started it I used 0.01s xD Anyway I've got 1 more problem... My trigger which worked 'till now now is totally dizzy... I'm sure I didn't make any mistake in the trigger, but something still removes the skill book. So I gave a unit a skill book when he uses a transform skill. It was totally OK but now I tested it and it doesn't work Oo removes the book after 2s... I won't paste all the triggers here so pls PM me :)
 
Level 9
Joined
May 30, 2008
Messages
430
Your special effects leak because every 0.03 seconds you are storing new one with name SWSE[SWSEC], SWSE[(SWSEC + 1)] and you are destroying THE LAST ONE of them every 0.50 seconds. I am not pretty sure but if the trigger run faster than the wait the wait may never get executed so i believe you aren't destroying even the last leaks within those 0.50 seconds wait time. So yes you leak
 
Level 15
Joined
Oct 18, 2008
Messages
1,591
Your special effects leak because every 0.03 seconds you are storing new one with name SWSE[SWSEC], SWSE[(SWSEC + 1)] and you are destroying THE LAST ONE of them every 0.50 seconds. I am not pretty sure but if the trigger run faster than the wait the wait may never get executed so i believe you aren't destroying even the last leaks within those 0.50 seconds wait time. So yes you leak

I rewrote the wait to 0.00 you just didn't read the other replyes xD
 
Status
Not open for further replies.
Top