• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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)
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
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,,
 
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 = (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?
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
  • 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,,
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Insaneness does not change. You do not use waits (Good job on that!), which means the target has no time to move, so Insaneness does not change, Insanity_Point does (and should, as i see) change, but Insaneness does not.
 
Level 6
Joined
Apr 23, 2009
Messages
94
Status
Not open for further replies.
Top