Leaks?

San-D

New Member
Reaction score
15
I know that adding special effects to position of unit or at point with coordinates leaks and I know how to avoid it but does attaching a special effect leak like in :
Code:
Untitled Trigger 001
    Events
        Map initialization
    Conditions
    Actions
        Special Effect - Create a special effect attached to the overhead of Footman 0000 <gen> using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
        Special Effect - Destroy (Last created special effect)

And also, if u prperly use the leak prevent method on a frequent periodic event like in:
Code:
Whirpool Spin
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        Set Temp_Point = (Position of Caster)
        Set Point = (Position of Target)
        Unit - Move Target instantly to (Temp_Point offset by Distance towards Angle degrees)
        Unit - Create 1 Dummy for Player 1 (Red) at Point facing Default building facing degrees
        Unit - Add a 0.01 second Generic expiration timer to (Last created unit)
        Set Angle = (Angle + 1.00)
        Set Distance = (Distance - 1.00)
        Custom Script: call RemoveLocation(udg_Temp_Point)
        Custom Script: call RemoveLocation(udg_Point)
It shouldnt leak if its just one time, but it happens around 900 times in 9 seconds, does it leak, and if so how to prevent it?
 

Evoroth

New Member
Reaction score
11
Trigger 1 has no leaks.

However, (Temp_Point offset by Distance towards Angle) leaks, because it's a new location. You need another variable to deal with this.
 

Romek

Super Moderator
Reaction score
963
Except the leak already posted, neither of them leak.

I also suggest using a longer periodic timer (0.03?)
0.01 could cause lag, and... Nobody would notice the difference :D
 

San-D

New Member
Reaction score
15
But, if i use 0.01 the total time for the spell is 9 seconds, If I use 0.03 that will tahe 24 second, Its boring enough with 9 seconds, let alone 24!
 

San-D

New Member
Reaction score
15
K, I spend a lot of time reading about leaks here and leaks there an I have a request. Can someone tell me for this chain of triggers :

Code:
Begin
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Forst Gift 
    Actions
        Set Caster = (Casting unit)
        Set Temp_Point1 = (Position of Caster)
        Destructible - Pick every destructible within 3500.00 of Temp_Point1 and do (Actions)
            Loop - Actions
                Set Temp_Point2 = (Position of (Matching destructible))
                Unit - Create 1 Forest Dummy for Player 1 (Red) at Temp_Point2 facing Default building facing degrees
                Set SpiritUnit = (Last created unit)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Random integer number between 1 and 2) Equal to 1
                    Then - Actions
                        Unit Group - Add SpiritUnit to SpiritGroup1
                    Else - Actions
                        Unit Group - Add SpiritUnit to SpiritGroup2
        Trigger - Turn on Movement 90 to 270 <gen>
        Trigger - Turn on Movement 270 to 90 <gen>

Code:
Movement 90 to 270
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in SpiritGroup1 and do (Actions)
            Loop - Actions
                Set Temp_Point2 = (Position of (Picked unit))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Distance between Temp_Point1 and Temp_Point2) Greater than or equal to 1.00
                    Then - Actions
                        Set Distance = (Distance between Temp_Point1 and Temp_Point2)
                        Unit - Move (Picked unit) instantly to (Temp_Point1 offset by (Distance - 1.00) towards ((Angle from Temp_Point1 to Temp_Point2) + 1.00) degrees)
                        Animation - Change (Picked unit) flying height to ((Current flying height of (Picked unit)) - 1.00) at 30000.00
                    Else - Actions
                        Unit - Kill (Picked unit)
                        Unit - Remove (Picked unit) from the game

Code:
Movement 270 to 90
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in SpiritGroup2 and do (Actions)
            Loop - Actions
                Set Temp_Point2 = (Position of (Picked unit))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Distance between Temp_Point1 and Temp_Point2) Greater than or equal to 1.00
                    Then - Actions
                        Set Distance = (Distance between Temp_Point1 and Temp_Point2)
                        Unit - Move (Picked unit) instantly to (Temp_Point1 offset by (Distance - 1.00) towards ((Angle from Temp_Point1 to Temp_Point2) - 1.00) degrees)
                        Animation - Change (Picked unit) flying height to ((Current flying height of (Picked unit)) - 1.00) at 30000.00
                    Else - Actions
                        Unit - Kill (Picked unit)
                        Unit - Remove (Picked unit) from the game

Where am I supposed to call the Destroy point command (call RemoveLocation(udg_Temp_Point1(2)), so that it doesnt disturb the the flow of events? I tried to make a different trigger to call them when there are no more dummies left, but I dont know how to check that!
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
I tried to make a different trigger to call them when there are no more dummies left, but I dont know how to check that!

Add the dummy units to a unit group only for the dummy units, then use the "Count units in unit group" function to check if there is more than 0 units in your dummy-unit group.
 

San-D

New Member
Reaction score
15
On what event?

Code:
Movement end
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in Spirit_Group_Total) Equal to 0
            Then - Actions
                Custom script:   call RemoveLocation(udg_Temp_Point1)
                Custom script:   call RemoveLocation(udg_Temp_Point2)
            Else - Actions
                Do nothing


Is this good, where Spirit_Group_Totak is Spirt Group 1 + Spirit Group 2
 

ManyTimes

I'm so lonesome I could cry...
Reaction score
293
Code:
egin
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Forst Gift 
    Actions
        Set Caster = (Casting unit)
        Set Temp_Point1 = (Position of Caster)
        Destructible - Pick every destructible within 3500.00 of Temp_Point1 and do (Actions)
            Loop - Actions
                [COLOR="RoyalBlue"]Set Temp_Point2 = (Position of (Matching destructible))[/COLOR]
               [COLOR="Red"] Set Temp_Point2 = (Position of (Picked destructible))[/COLOR]
                Unit - Create 1 Forest Dummy for Player 1 (Red) at Temp_Point2 facing Default building facing degrees
                [COLOR="RoyalBlue"]Set SpiritUnit = (Last created unit)[/COLOR]
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Random integer number between 1 and 2) Equal to 1
                    Then - Actions
[COLOR="Blue"]                        Unit Group - Add SpiritUnit to SpiritGroup1[/COLOR]
                        [COLOR="Red"]Unit Group - Add (Last Created Unit) to SpiritGroup1[/COLOR]
                    Else - Actions
[COLOR="Blue"]                        Unit Group - Add SpiritUnit to SpiritGroup2[/COLOR]
[COLOR="Red"]                        Unit Group - Add last Created Unit to SpiritGroup2[/COLOR]
               [COLOR="Red"] Custom Script: call RemoveLocation(udg_Temp_Point2)[/COLOR]
        Trigger - Turn on Movement 90 to 270 <gen>

Code:
Movement 90 to 270
    Events
        Time - Every [COLOR="Yellow"]0.03 [/COLOR]seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in SpiritGroup1 and do (Actions)
            Loop - Actions
                Set Temp_Point2 = (Position of (Picked unit))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Distance between Temp_Point1 and Temp_Point2) Greater than or equal to 1.00
                    Then - Actions
                        Set Distance = (Distance between Temp_Point1 and Temp_Point2)
                        Unit - Move (Picked unit) instantly to (Temp_Point1 offset by (Distance - 1.00) towards ((Angle from Temp_Point1 to Temp_Point2) + 1.00) degrees)
                        Animation - Change (Picked unit) flying height to ((Current flying height of (Picked unit)) - 1.00) at 30000.00
                    Else - Actions
                        Unit - Kill (Picked unit)
                        Unit - Remove (Picked unit) from the game
                        [COLOR="Red"]Custom Script: call RemoveLocation(udg_Temp_Point1)[/COLOR]
           [COLOR="Red"]    Custom Script: call RemoveLocation(udg_Temp_Point2)[/COLOR]
Remove Blue Lines
Add red lines
Yellow lines should be changed.

Last trigger, same thing there as the second.

Edit: what happend?! I changed all three triggers..oh, doing it again :p

Edit2: your movement is a bit...odd, dont you think? It also creates a leak.

edit3: Here:
Code:
Untitled Trigger 009
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in snowmangroup and do (Actions)
            Loop - Actions
                Set p[2] = (Position of (Picked unit))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Distance between p[2] and p[1]) Greater than or equal to 100.00
                    Then - Actions
                        Set p[3] = (p[2] offset by 12.00 towards (Facing of (Picked unit)) degrees)
                        Unit - Move (Picked unit) instantly to p[3]
                        Custom script:   call RemoveLocation(udg_p[3])
                    Else - Actions
                        Unit Group - Remove (Picked unit) from snowmangroup
                        Unit - Kill (Picked unit)
                        Custom script:   call RemoveLocation(udg_p[1)
                Custom script:   call RemoveLocation(udg_p[2)

See the difference?
I use another point, p[3], it sets p[2] offset by X. You order your unit to just move to "p[2] offset by X", which causes leak.
 

San-D

New Member
Reaction score
15
What about my upper reply, the trigger there works, right? and That way, it doesnt matter if its 0.01 sec or 0.03 because it removes the anyway?
 

ManyTimes

I'm so lonesome I could cry...
Reaction score
293
You can do that (but remember, if you cast the spell again, within the leak is cleaned up...but)
event : every 1 sec
cond: if 0 units in group
actions: call RemoveLocation(udg_TempPoint1)

But, you cannot remove temppoint2 that way, it needs to be cleaned up inside the loop.

>>its 0.01 sec or 0.03 because it removes the anyway?
You as a human being, do not notice the difference of 0.01 or 0.03, but your computer does. Think about it, running that trigger 100 times per second, or 33...

Which trigger are you? huh? still need help? :)
 

San-D

New Member
Reaction score
15
Sorry ManyTimes, ur suggestion destriys the Position of the target too early, and after the first dummy reaches the caster, all other redirect to another location!

Does moving a unit to a player's start location leak?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top