1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Solved] Leak Solved: Position of Unit

Discussion in 'Triggers & Scripts' started by Veronnis, Aug 9, 2019.

  1. Veronnis

    Veronnis

    Joined:
    Jul 19, 2010
    Messages:
    139
    Resources:
    6
    Models:
    2
    Icons:
    1
    Maps:
    3
    Resources:
    6
    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.
     
  2. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,545
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    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.
     
  3. Veronnis

    Veronnis

    Joined:
    Jul 19, 2010
    Messages:
    139
    Resources:
    6
    Models:
    2
    Icons:
    1
    Maps:
    3
    Resources:
    6
    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.