• 🏆 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!

[Solved] Leak Solved: Position of Unit

Status
Not open for further replies.
Hello friends and thank you once again for your time. I've had difficulty finding and learning all the info I need to purge my spells of leaks. I thought the below trigger was clean, but it is not. Do you know what's wrong?

Terminology Notes: Pjc = Projectile, Pos = Position
Subfactors: Trigger is MUI and projectile is destroyed when it has arrived at destination (not pictured)

  • Firebolt Periodic Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PjcHomingActive[GenericLoopCount] Equal to True
        • Then - Actions
          • Custom script: call RemoveLocation(udg_PjcHomingLastPos[udg_GenericLoopCount])
          • Set PjcHomingLastPos[GenericLoopCount] = (Position of PjcRecipient[GenericLoopCount])
          • Set RandomLocation[1] = (PjcCurrentPos[GenericLoopCount] offset by ((PjcSpeed[GenericLoopCount] / 50.00) x PjcGlobalSpeed) towards (Angle from PjcCurrentPos[GenericLoopCount] to PjcHomingLastPos[GenericLoopCount]) degrees)
          • Custom script: call RemoveLocation(udg_PjcCurrentPos[udg_GenericLoopCount])
          • Set PjcCurrentPos[GenericLoopCount] = (RandomLocation[1] offset by (0.00, 0.00))
          • Custom script: call RemoveLocation(udg_RandomLocation[1])
          • Set MidPoint[GenericLoopCount] = ((Distance between PjcCastOrigin[GenericLoopCount] and (Position of PjcRecipient[GenericLoopCount])) / 2.00)
          • Set DistanceLeft[GenericLoopCount] = (Distance between PjcCurrentPos[GenericLoopCount] and (Position of PjcRecipient[GenericLoopCount]))
        • Else - Actions
          • Set RandomLocation[1] = (PjcCurrentPos[GenericLoopCount] offset by ((PjcSpeed[GenericLoopCount] / 50.00) x PjcGlobalSpeed) towards (Angle from PjcCurrentPos[GenericLoopCount] to PjcHomingLastPos[GenericLoopCount]) degrees)
          • Custom script: call RemoveLocation(udg_PjcCurrentPos[udg_GenericLoopCount])
          • Set PjcCurrentPos[GenericLoopCount] = (RandomLocation[1] offset by (0.00, 0.00))
          • Custom script: call RemoveLocation(udg_RandomLocation[1])
          • Set MidPoint[GenericLoopCount] = ((Distance between PjcCastOrigin[GenericLoopCount] and PjcHomingLastPos[GenericLoopCount]) / 2.00)
          • Set DistanceLeft[GenericLoopCount] = (Distance between PjcCurrentPos[GenericLoopCount] and PjcHomingLastPos[GenericLoopCount])
      • Special Effect - Set Position of ProjectileVisual[GenericLoopCount] to PjcCurrentPos[GenericLoopCount]
      • Special Effect - Set Position - Z of ProjectileVisual[GenericLoopCount] to RandomReal[1]
      • Special Effect - Set Yaw of ProjectileVisual[GenericLoopCount] to: (Radians((Angle from PjcCurrentPos[GenericLoopCount] to PjcHomingLastPos[GenericLoopCount])))
      • Special Effect - Set Pitch of ProjectileVisual[GenericLoopCount] to: (Radians(((-90.00 x PjcArc[GenericLoopCount]) + ((180.00 x (((Distance between PjcCastOrigin[GenericLoopCount] and PjcHomingLastPos[GenericLoopCount]) - DistanceLeft[GenericLoopCount]) / (Distance between PjcCastOrigin[GenericLoopCount] and PjcHomingLastPos[GenericLoopCount])
Side side note: If you provide a significant solution and are interested in a reward please let me know, I want to do something for you guys.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
  • empty.gif
    line.gif
    line.gif
    join.gif
    set.gif
    Set MidPoint[GenericLoopCount] = ((Distance between PjcCastOrigin[GenericLoopCount] and (Position of PjcRecipient[GenericLoopCount])) / 2.00)
  • empty.gif
    line.gif
    line.gif
    joinbottom.gif
    set.gif
    Set DistanceLeft[GenericLoopCount] = (Distance between PjcCurrentPos[GenericLoopCount] and (Position of PjcRecipient[GenericLoopCount]))
These two actions leak a location. Position of PjcRecipient creates a location which you never remove.

Like usual one must assign this location temporarily to a point variable and remove it with RemoveLocation after it is no longer useful.
 
These two actions leak a location. Position of PjcRecipient creates a location which you never remove.

Like usual one must assign this location temporarily to a point variable and remove it with RemoveLocation after it is no longer useful.
You sir, are excellent! Thank you for your keen observation. If you have any interest in amateur graphics design or free lunch/dinner (provided you live in usa) hit me up; I'd be happy to repay the favor.
 
Status
Not open for further replies.
Top