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

Event - Periodic Timer

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
If a trigger consist of this particular line (Event - Periodic Timer), how would the leaks be cleaned ?
Look trigger below for example:

  • Kinetic Ball Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (KineticBall is alive) Equal to True
        • Then - Actions
          • Unit Group - Pick every unit in AOE and do (Actions)
            • Loop - Actions
              • Set PickedLoc = (Position of (Picked unit))
              • Set Distance = (Integer(((Distance between KineticBallLoc and PickedLoc) - 10.00)))
              • Unit - Move (Picked unit) instantly to (KineticBallLoc offset by (Real(Distance)) towards (Angle from KineticBallLoc to PickedLoc) degrees)
              • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Orc\LightningShield\LightningShieldBuff.mdl
              • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • Trigger - Turn off (This trigger)
I would have add this to clean the leaks:

  • Custom script: call RemoveLocation(udg_PickedLoc)
  • Custom script: call RemoveLocation(udg_KineticBallLoc)
  • Custom script: call DestroyGroup(udg_AOE)
But the trigger will stop working (it doesn't move the unit per 0.1 second anymore) if I added the clean script
How can I move the unit per 0.1 second AND clean those leaks ?

EDIT:
OH I almost forgot !
The trigger works like this:
The ball will pull every picked unit per 0.1 second for 10 range/units
 
Level 6
Joined
Nov 3, 2008
Messages
117
  • Custom script: call RemoveLocation(udg_KineticBallLoc)
You need this location more than once.
If you add this here:
  • Kinetic Ball Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (KineticBall is alive) Equal to True
      • Then - Actions
        • Unit Group - Pick every unit in AOE and do (Actions)
          • Loop - Actions
            • Set PickedLoc = (Position of (Picked unit))
            • Set Distance = (Integer(((Distance between KineticBallLoc and PickedLoc) - 10.00)))
            • Unit - Move (Picked unit) instantly to (KineticBallLoc offset by (Real(Distance)) towards (Angle from KineticBallLoc to PickedLoc) degrees)
            • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Orc\LightningShield\LightningShieldBuff.mdl
            • Special Effect - Destroy (Last created special effect)
            • Custom script: call RemoveLocation(udg_KineticBallLoc)
      • Else - Actions
        • Trigger - Turn off (This trigger)
You can only execute this once, since KineticBallLoc will be null after the first execution!
 
Level 11
Joined
Sep 12, 2008
Messages
657
leak removal in else is removing it once, out of all the runs
which is bad.
since it'll leak once a 0.1 seconds.

defskull, if you want, i can make you this as a request mui + using 1 extra library,
or mui + using no extras. (1 library = alot better if you ask me..)

edit: oh yeah, either gui or vjass or jass.. you decide.
 
Level 11
Joined
Sep 12, 2008
Messages
657
kk, i really am sorry, but i had to do knockback in vjass, it shouldnt bother you,
since all you use is the example.
ill post it in around the 5 - 10 mins.. then i go continue mah own spells ^^

edit: i just figured i sux in gui/jass ;/
sry.. =[
if you still want this vjass, pm me, or post here.. (in vjass i 100% can do that.)
 
Level 11
Joined
Sep 12, 2008
Messages
657
find anachron's signature, he made a tutorial,
thats where i ussualy send my friends too^^

edit: im on last few lines..
but this is the only thing that doesnt work for me =[

JASS:
set ang = Atan2(y - y2, x - x2)
                            set x3 = x2 + dis * Cos (ang)
                            set y3 = y2 + dis * Sin (ang)
                            call SetUnitX(t, x3)
                            call SetUnitY(t, y3)
                            call DisplayTextToForce(GetPlayersAll(), "Gah6")

i set ang as the angle between the units,
then move the target to it (current x/y + dis toward caster)
the Gah6 shows up, but the unit wont move.. =[
this never happend to me before.. and i use X/Y alot, belive me..
(i made my own custom missle system.. xD)
 
Level 11
Joined
Sep 12, 2008
Messages
657
kk, its jass, and im done.
its 100% working, with 3 diffrent options of speed traveling.
1 is regular
2 is regular + (level of ability * number you choose)
3 is regular * level of ability
damage has 2 ways.
1 is regular
2 is regular * level of ability.

edit: count me in your request thread.. (i was in 1, but didnt have much time.. i guess i got alot more time now, so ill help you..)
 

Attachments

  • Pull.w3x
    20.6 KB · Views: 74
Level 37
Joined
Mar 6, 2006
Messages
9,240
The original trigger should be like this:
  • Kinetic Ball Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (KineticBall is alive) Equal to True
        • Then - Actions
          • Unit Group - Pick every unit in AOE and do (Actions)
            • Loop - Actions
              • Set PickedLoc = (Position of (Picked unit))
              • Set Point = (KineticBallLoc offset by (Real(Distance)) towards (Angle from KineticBallLoc to PickedLoc) degrees)
              • Set Distance = (Integer(((Distance between KineticBallLoc and PickedLoc) - 10.00)))
              • Unit - Move (Picked unit) instantly to Point
              • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Orc\LightningShield\LightningShieldBuff.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation(udg_Point)
              • Custom script: call RemoveLocation(udg_PickedLoc)
        • Else - Actions
          • Custom script: call RemoveLocation(udg_KineticBallLoc)
          • Trigger - Turn off (This trigger)
          • Unit Group - Remove all units from AOE
Don't destroy/crete AOE group, just add/remove units.

But that isn't MUI.

@dardas:
The ability codes should be defined in globals block, and this is bad:
JASS:
DistanceBetweenPoints(Location(x2, y2), Location(x, y)) > 30
That uses locations. You can use a function like this:
JASS:
    private function getDistance takes real x1 , real x2 , real y1 , real y2 returns real
        local real dx = x2 - x1
        local real dy = y2 - y1
        return SquareRoot(dx * dx + dy * dy )
    endfunction
 
Level 11
Joined
Jan 25, 2009
Messages
572
leak removal in else is removing it once, out of all the runs
which is bad.
since it'll leak once a 0.1 seconds.
Wrong, it doesn't leak every 0.01 second because he do only set the variable once and destroys it once if it is in the else actions.
Leaks doesn't occur just because you USE it. They occur if you overwrite it with some other location.
 
Status
Not open for further replies.
Top