Is there a leak here?

BRUTAL

I'm working
Reaction score
118
Code:
Untitled Trigger 001
    Events
        Time - Elapsed game time is 1.00 seconds
    Conditions
    Actions
        Set PSUnitGroupInt = (Units in (Entire map))
        Unit Group - Pick every unit in PSUnitGroupInt and do (Actions)
            Loop - Actions
                Trigger - Add to Thirteen <gen> the event (Unit - (Picked unit) Takes damage)
        Custom script:   call DestroyGroup(udg_PSUnitGroupInt)
Code:
Untitled Trigger 002
    Events
        Unit - A unit enters (Entire map)
    Conditions
    Actions
        Trigger - Add to Thirteen <gen> the event (Unit - (Triggering unit) Takes damage)
Code:
Eleven
    Events
        Unit - A unit Learns a skill
    Conditions
        (Learned Hero Skill) Equal to Piercing Shot 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                CV3 Less than 1000
            Then - Actions
                Set CV3 = (CV3 + 1)
            Else - Actions
                Set CV3 = 0
        Set PSCaster[CV3] = (Learning Hero)
        Unit - Set the custom value of PSCaster[CV3] to CV3
        Unit Group - Add PSCaster[CV3] to PSUg
Code:
Thirteen
    Events
    Conditions
        (Number of units in PSUg) Greater than 0
    Actions
        Unit Group - Pick every unit in PSUg and do (Actions)
            Loop - Actions
                Set TempInt3 = (Custom value of (Picked unit))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Damage source) Equal to PSCaster[TempInt3]
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (PSCaster[TempInt3] has buff Archery Mastery ) Equal to True
                            Then - Actions
                                Set PSMainTarget[TempInt3] = (Attacked unit)
                                Set PSMainPos[TempInt3] = (Position of PSMainTarget[TempInt3])
                                Set PSCasterPos[TempInt3] = (Position of PSCaster[TempInt3])
                                Set PSDummyTimer[TempInt3] = 0.00
                                Set PSCount[TempInt3] = 0
                                Set PSAngle[TempInt3] = (Angle from PSCasterPos[TempInt3] to PSMainPos[TempInt3])
                                Special Effect - Create a special effect attached to the origin of PSMainTarget[TempInt3] using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                                Special Effect - Destroy (Last created special effect)
                                Unit - Create 1 PSDummy for (Owner of PSCaster[TempInt3]) at PSMainPos[TempInt3] facing PSAngle[TempInt3] degrees
                                Set PSDummy[TempInt3] = (Last created unit)
                                Unit Group - Add (Last created unit) to PSDummyUg[TempInt3]
                                Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                                Custom script:   call RemoveLocation (udg_PSCasterPos[udg_TempInt3])
                                Custom script:   call RemoveLocation (udg_PSMainPos[udg_TempInt3])
                            Else - Actions
                                Set PSChance[TempInt3] = (Random integer number between (1 + (1 x (Level of Piercing Shot  for PSCaster[TempInt3]))) and 10)
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        PSChance[TempInt3] Less than or equal to ((1 + (1 x (Level of Piercing Shot  for PSCaster[TempInt3]))) + 1)
                                    Then - Actions
                                        Set PSMainPos[TempInt3] = (Position of PSMainTarget[TempInt3])
                                        Set PSCasterPos[TempInt3] = (Position of PSCaster[TempInt3])
                                        Set PSDummyTimer[TempInt3] = 0.00
                                        Set PSCount[TempInt3] = 0
                                        Set PSAngle[TempInt3] = (Angle from PSCasterPos[TempInt3] to PSMainPos[TempInt3])
                                        Special Effect - Create a special effect attached to the origin of PSMainTarget[TempInt3] using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                                        Special Effect - Destroy (Last created special effect)
                                        Unit - Create 1 PSDummy for (Owner of PSCaster[TempInt3]) at PSMainPos[TempInt3] facing PSAngle[TempInt3] degrees
                                        Set PSDummy[TempInt3] = (Last created unit)
                                        Unit Group - Add (Last created unit) to PSDummyUg[TempInt3]
                                        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                                        Custom script:   call RemoveLocation (udg_PSCasterPos[udg_TempInt3])
                                        Custom script:   call RemoveLocation (udg_PSMainPos[udg_TempInt3])
                                    Else - Actions
                    Else - Actions
Code:
Fourteen
    Events
        Time - Every 0.02 seconds of game time
    Conditions
        (Number of units in PSUg) Greater than 0
    Actions
        Unit Group - Pick every unit in PSUg and do (Actions)
            Loop - Actions
                Set TempInt3 = (Custom value of (Picked unit))
                Unit Group - Pick every unit in PSDummyUg[TempInt3] and do (Actions)
                    Loop - Actions
                        Set PSDummyTimer[TempInt3] = (PSDummyTimer[TempInt3] + 0.02)
                        Set PSDummyPos[TempInt3] = (Position of (Picked unit))
                        Set PSDummyTp[TempInt3] = (PSDummyPos[TempInt3] offset by 13.00 towards PSAngle[TempInt3] degrees)
                        Unit - Move (Picked unit) instantly to PSDummyTp[TempInt3], facing PSAngle[TempInt3] degrees
                        Set PSUnitGroup2[TempInt3] = (Units within 35.00 of PSDummyPos[TempInt3] matching ((((Matching unit) belongs to an enemy of (Owner of PSDummy[TempInt3])) Equal to True) and ((Matching unit) Not equal to PSMainTarget[TempInt3])))
                        Unit Group - Pick every unit in PSUnitGroup2[TempInt3] and do (Actions)
                            Loop - Actions
                                Set PSCount[TempInt3] = (PSCount[TempInt3] + 1)
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        PSCount[TempInt3] Equal to 1
                                    Then - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                (PSCaster[TempInt3] has buff Archery Mastery ) Equal to True
                                            Then - Actions
                                                Unit - Cause PSDummy[TempInt3] to damage (Picked unit), dealing (22.00 + (Real((Agility of PSCaster[TempInt3] (Include bonuses))))) damage of attack type Spells and damage type Normal
                                                Floating Text - Create floating text that reads ((String((22 + (Agility of PSCaster[TempInt3] (Include bonuses))))) + !) above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
                                                Floating Text - Change (Last created floating text): Disable permanence
                                                Floating Text - Set the velocity of (Last created floating text) to 40.00 towards 88.00 degrees
                                                Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
                                                Floating Text - Change the fading age of (Last created floating text) to 1.50 seconds
                                                Custom script:   call DestroyGroup(udg_PSUnitGroup2[udg_TempInt3])
                                            Else - Actions
                                                Unit - Cause PSDummy[TempInt3] to damage (Picked unit), dealing (12.00 + (Real((Agility of PSCaster[TempInt3] (Include bonuses))))) damage of attack type Spells and damage type Normal
                                                Floating Text - Create floating text that reads ((String((12 + (Agility of PSCaster[TempInt3] (Include bonuses))))) + !) above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
                                                Floating Text - Change (Last created floating text): Disable permanence
                                                Floating Text - Set the velocity of (Last created floating text) to 40.00 towards 88.00 degrees
                                                Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
                                                Floating Text - Change the fading age of (Last created floating text) to 1.50 seconds
                                                Custom script:   call DestroyGroup(udg_PSUnitGroup2[udg_TempInt3])
                                        Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                                        Special Effect - Destroy (Last created special effect)
                                        Unit - Remove PSDummy[TempInt3] from the game
                                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Distance between PSMainPos[TempInt3] and PSDummyPos[TempInt3]) Greater than or equal to 600.00
                            Then - Actions
                                Unit - Remove (Picked unit) from the game
                            Else - Actions
                        Custom script:   call RemoveLocation (udg_PSDummyPos[udg_TempInt3])
                        Custom script:   call RemoveLocation (udg_PSDummyTp[udg_TempInt3])
wc crashes after a few minutes of this happening over and over
so is there leaks i missed?
 

cowmenace

New Member
Reaction score
22
A unit enters (Entire Map) leak
I think it i a problem with you adding so many events. I didn't read through the triggers though so I can't diagnose it for you.
 

manofsteel

New Member
Reaction score
36
The trigger when a unit takes damage, try turning the trigger on and off everytime it runs.
 

BRUTAL

I'm working
Reaction score
118
A unit enters (Entire Map) leak
I think it i a problem with you adding so many events. I didn't read through the triggers though so I can't diagnose it for you.
okay i'll try removing that if its a leak
ya, originally i had something that added events everytime the unit attacked, but someone told me to do this, so atleast this will have less events unlike what i had, is there anyway to get the same result without the lag from events?

The trigger when a unit takes damage, try turning the trigger on and off everytime it runs.
the spell is mui, so that will mess it up
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
Unit enters playable map area is not a leak.
 

BRUTAL

I'm working
Reaction score
118
ya i read that it wasnt i think
so, the main problem is that theres too many events on one trigger?
 

MoonSlinger

I Love using Cheap Tricks... only Results matters
Reaction score
74
The problem is needlessly running too many loops:

When:
(Number of units in PSUg) Greater than 0

Trigger 14 will run:
Code:
Unit Group - Pick every unit in PSUg and do (Actions)
            Loop - Actions
                Unit Group - Pick every unit in PSDummyUg[TempInt3] and do (Actions)
                    Loop - Actions
                        Unit Group - Pick every unit in PSUnitGroup2[TempInt3] and do (Actions)
                            Loop - Actions

PSUg
when some unit learns a skill, add it to this variable. Not that bad, only a few units will be in here

PSDummyUg[X]
This unit group grows exponentially.... whenever a unit gets attacked by something, the unit is added into this group. There is no removal, so.... it gets larger and larger.

PSUnitGroup2[X]
This unit group is a temporary one which picks out all unit within a range of each unit from the above group.


Assumption:
- Lets say only 1 of your "Hero" learns this skill, and starts randomly attacking other units
- "Hero" hits 10 different "enemy" in 10 different locations
- 1 or 2 other units bypass each of the "enemy" locations
Totally number of iterations:
1 X 10 X 1.5 (1 or 2)

- Now you hero goes around and attack 10 more units.
Totally number of iterations:
1 X 20 X 1.5 (1 or 2)

- Now you hero goes around and attack 10 more units again.
Totally number of iterations:
1 X 30 X 1.5 (1 or 2)

That is a lot of work to be doing every 0.02 seconds.
Not to mention if this trigger might cause trigger-13 to fire off when your dummies deal damage.


Solve:
To solve your problem, work on the unit group: PSDummyUg[]
Find a way to remove units from it, else it will just keep growing.
 

BRUTAL

I'm working
Reaction score
118
hm
i just added a remove unit from ug function and it seems to be working okay so far
 

cowmenace

New Member
Reaction score
22
don't you have to refer to a region or region variable in any situation to make it leakless? I thought using entire map was a leak...
 

UndeadDragon

Super Moderator
Reaction score
447
Regions don't leak. Points leak.
 

Flare

Stops copies me!
Reaction score
662
Dynamically created regions do leak (such as the Region centred at point, or Convert points to region, and those sorta thing)

@cowmenace: It could be a look (I don't really know of the top of my head) but 2 leaks won't break the game (assuming it does leak, Elapsed Game-Time would leak once for the region usage in the UG definition, and and Unit Enters Entire Map would leak only once since the region is only used for the event registration)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top