[Trigger] Does this leak, and if it does, how do i fix it?

Status
Not open for further replies.
Level 6
Joined
Apr 23, 2009
Messages
94
  • Insanity
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Insanity
    • Actions
      • For each (Integer A) from 1 to 50, do (Actions)
        • Loop - Actions
          • Set Insanity_Point = ((Position of (Target unit of ability being cast)) offset by ((Random real number between -1000.00 and 1000.00), (Random real number between -1000.00 and 1000.00)))
          • Unit - Create 1 Ghost for (Owner of (Target unit of ability being cast)) at Insanity_Point facing Insanity_Point
          • Unit - Turn collision for (Last created unit) Off
          • Unit - Order (Last created unit) to Move To (Insanity_Point offset by ((Random real number between -2000.00 and 2000.00), (Random real number between -2000.00 and 2000.00)))
          • Custom script: call RemoveLocation (udg_Insanity_Point)
      • For each (Integer B) from 1 to 30, do (Actions)
        • Loop - Actions
          • Set Insanity_Point = ((Position of (Target unit of ability being cast)) offset by ((Random real number between -1000.00 and 1000.00), (Random real number between -1000.00 and 1000.00)))
          • Unit - Create 1 Ghost for (Owner of (Target unit of ability being cast)) at Insanity_Point facing Insanity_Point
          • Unit - Order (Last created unit) to Attack (Target unit of ability being cast)
          • Custom script: call RemoveLocation (udg_Insanity_Point)
      • Set loc_Unit = (Position of (Casting unit))
      • Unit - Create 1 DUMMY for (Owner of (Casting unit)) at loc_Unit facing Default building facing degrees
      • Unit - Order (Last created unit) to Human Sorceress - Invisibility (Casting unit)
      • Custom script: call RemoveLocation (udg_loc_Unit)
      • Set loc_UnitEnemy = (Position of (Target unit of ability being cast))
      • Unit - Create 1 DUMMY for (Owner of (Casting unit)) at loc_UnitEnemy facing Default building facing degrees
      • Unit - Order (Last created unit) to Human Sorceress - Slow (Target unit of ability being cast)
      • Custom script: call RemoveLocation (udg_loc_UnitEnemy)
 
Yes it does, 80 points.
You only create them 2 times, but because of the loops, it creates 80 location leaks.
Set Insanity_Point = ((Position of (Target unit of ability being cast)) offset by ((Random real number between -1000.00 and 1000.00), (Random real number between -1000.00 and 1000.00)))
The red part is a leak, set it in an other variable, and use that one. The same for in the (Integer B) loop, creates the exact same leak.

The rest seems fine to me,,
 
  • Insanity
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Insanity
    • Actions
      • For each (Integer A) from 1 to 50, do (Actions)
        • Loop - Actions
          • Set Insanity_Point = (Insaneness offset by ((Random real number between -1000.00 and 1000.00), (Random real number between -1000.00 and 1000.00)))
          • Unit - Create 1 Ghost for (Owner of (Target unit of ability being cast)) at Insanity_Point facing Insanity_Point
          • Unit - Turn collision for (Last created unit) Off
          • Unit - Order (Last created unit) to Move To (Insanity_Point offset by ((Random real number between -2000.00 and 2000.00), (Random real number between -2000.00 and 2000.00)))
          • Custom script: call RemoveLocation (udg_Insanity_Point)
      • For each (Integer B) from 1 to 30, do (Actions)
        • Loop - Actions
          • Set Insanity_Point = (Insaneness offset by ((Random real number between -1000.00 and 1000.00), (Random real number between -1000.00 and 1000.00)))
          • Unit - Create 1 Ghost for (Owner of (Target unit of ability being cast)) at Insanity_Point facing Insanity_Point
          • Unit - Order (Last created unit) to Attack (Target unit of ability being cast)
          • Custom script: call RemoveLocation (udg_Insanity_Point)
      • Set loc_Unit = (Position of (Casting unit))
      • Unit - Create 1 DUMMY for (Owner of (Casting unit)) at loc_Unit facing Default building facing degrees
      • Unit - Order (Last created unit) to Human Sorceress - Invisibility (Casting unit)
      • Custom script: call RemoveLocation (udg_loc_Unit)
      • Set loc_UnitEnemy = (Position of (Target unit of ability being cast))
      • Unit - Create 1 DUMMY for (Owner of (Casting unit)) at loc_UnitEnemy facing Default building facing degrees
      • Unit - Order (Last created unit) to Human Sorceress - Slow (Target unit of ability being cast)
      • Custom script: call RemoveLocation (udg_loc_UnitEnemy)
Like that?
 
  • Insanity
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Insanity
    • Actions
      • Set Insaneness = (Position of (Target unit of ability being cast))
      • For each (Integer A) from 1 to 50, do (Actions)
        • Loop - Actions
          • Set Insanity_Point = (Insaneness offset by ((Random real number between -1000.00 and 1000.00), (Random real number between -1000.00 and 1000.00)))
          • Unit - Create 1 Ghost for (Owner of (Target unit of ability being cast)) at Insanity_Point facing Insanity_Point
          • Unit - Turn collision for (Last created unit) Off
          • Unit - Order (Last created unit) to Move To (Insanity_Point offset by ((Random real number between -2000.00 and 2000.00), (Random real number between -2000.00 and 2000.00)))
          • Custom script: call RemoveLocation (udg_Insanity_Point)
      • For each (Integer B) from 1 to 30, do (Actions)
        • Loop - Actions
          • Set Insanity_Point = (Insaneness offset by ((Random real number between -1000.00 and 1000.00), (Random real number between -1000.00 and 1000.00)))
          • Unit - Create 1 Ghost for (Owner of (Target unit of ability being cast)) at Insanity_Point facing Insanity_Point
          • Unit - Order (Last created unit) to Attack (Target unit of ability being cast)
          • Custom script: call RemoveLocation (udg_Insanity_Point)
      • Set loc_Unit = (Position of (Casting unit))
      • Unit - Create 1 DUMMY for (Owner of (Casting unit)) at loc_Unit facing Default building facing degrees
      • Unit - Order (Last created unit) to Human Sorceress - Invisibility (Casting unit)
      • Custom script: call RemoveLocation (udg_loc_Unit)
      • Set loc_UnitEnemy = (Position of (Target unit of ability being cast))
      • Unit - Create 1 DUMMY for (Owner of (Casting unit)) at loc_UnitEnemy facing Default building facing degrees
      • Unit - Order (Last created unit) to Human Sorceress - Slow (Target unit of ability being cast)
      • Custom script: call RemoveLocation (udg_loc_UnitEnemy)
Now it is, if you set Insaneness in the trigger to position of Target Unit, then it is fine. BTW, for some more efficiency, save it once, and not 80 times (in every loop), because it stays the same anyway,,
 
Status
Not open for further replies.
Back
Top