• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Where are my leaks?

Status
Not open for further replies.
Level 10
Joined
Apr 9, 2004
Messages
502
I'm tyring my best but still still seem to be having problems with this spell that i'm working on. It's the spin toss ability. No matter what i try i can't make it go any faster (by faster i mean slow down less) when it's cast. I'l, post the tirggers but i dunno. I think i've celaned up my points but it's still slwoing down eevry time so i'm sure there's leaks.

Code:
Catch unit
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Casting unit) Equal to SoulCheiftain
        (Ability being cast) Equal to Foul Swipe 
        (Distance between (Position of SoulCheiftain) and (Position of (Target unit of ability being cast))) Less than or equal to 300.00
    Actions
        Unit Group - Remove all units from Unitsalreadyhit
        Set SpinAngle = (Facing of SoulCheiftain)
        Set InitialfaceAngle = (Facing of SoulCheiftain)
        Set SpunUnit = (Target unit of ability being cast)
        Set SpinPoint = (Position of SoulCheiftain)
        Unit - Pause SoulCheiftain
        Animation - Play SoulCheiftain's Attack animation
        Animation - Queue SoulCheiftain's Attack, Two animation
        Wait 0.40 seconds
        Special Effect - Create a special effect attached to the chest of SpunUnit using Objects\Spawnmodels\Human\HumanBlood\BloodElfSpellThiefBlood.mdl
        Special Effect - Destroy (Last created special effect)
        Unit - Order SoulCheiftain to damage SpunUnit for (50.00 + (25.00 x (Real((Level of Foul Swipe  for SoulCheiftain))))) using attack type Spells and damage type Normal.
        Animation - Change SoulCheiftain's animation speed to 0.00% of its original speed
        Unit - Turn collision for SpunUnit Off
        Unit - Unpause SoulCheiftain
        Trigger - Turn on Spin <gen>




Spin
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        Unit - Order SoulCheiftain to Stop
        Unit Group - Pick every unit in Unitsalreadyhit and do (Actions)
            Loop - Actions
                Set SpinFuryPushbackPoint = ((Position of (Picked unit)) offset by 4.00 towards (Angle from (Position of SoulCheiftain) to (Position of (Picked unit))) degrees)
                Unit - Move (Picked unit) instantly to SpinFuryPushbackPoint
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Distance between SpinFuryPushbackPoint and SpinPoint) Greater than or equal to 500.00
                    Then - Actions
                        Unit Group - Remove (Picked unit) from Unitsalreadyhit
                    Else - Actions
                        Do nothing
                Custom script:   call RemoveLocation(udg_SpinFuryPushbackPoint)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                SpinAngle Greater than or equal to ((360.00 x 1.00) + (InitialfaceAngle + 75.00))
            Then - Actions
                Unit - Turn collision for SpunUnit On
                Unit - Order SoulCheiftain to damage SpunUnit for (25.00 x (Real((Level of Foul Swipe  for SoulCheiftain)))) using attack type Spells and damage type Normal.
                Special Effect - Create a special effect attached to the chest of SpunUnit using Objects\Spawnmodels\Human\HumanBlood\BloodElfSpellThiefBlood.mdl
                Special Effect - Destroy (Last created special effect)
                Animation - Change SoulCheiftain's animation speed to 100.00% of its original speed
                Animation - Reset SoulCheiftain's animation
                Custom script:   call RemoveLocation(udg_SpinPoint)
                Trigger - Turn off (This trigger)
            Else - Actions
                Set SpinAngle = (SpinAngle + 2.20)
                Unit - Move SoulCheiftain instantly to SpinPoint, facing SpinAngle degrees
                Set SpunPoint = ((Position of SoulCheiftain) offset by 160.00 towards ((Facing of SoulCheiftain) + 15.00) degrees)
                Unit - Move SpunUnit instantly to SpunPoint, facing SpinPoint
                Set UnitsHitBySwing = (Units within 75.00 of SpunPoint matching ((((Matching unit) is alive) Equal to True) and (((((Matching unit) is A structure) Equal to False) and ((Matching unit) Not equal to SpunUnit)) and ((((Matching unit) is in Unitsalreadyhit) Equal to False) and (((Own
                Unit Group - Pick every unit in UnitsHitBySwing and do (Actions)
                    Loop - Actions
                        Unit Group - Add (Picked unit) to Unitsalreadyhit
                        Unit - Order SoulCheiftain to damage (Picked unit) for (30.00 x (Real((Level of Foul Swipe  for SoulCheiftain)))) using attack type Hero and damage type Universal.
                        Special Effect - Create a special effect attached to the chest of (Picked unit) using Objects\Spawnmodels\Human\HumanBlood\BloodElfSpellThiefBlood.mdl
                        Special Effect - Destroy (Last created special effect)
                        Unit - Order SoulCheiftain to damage SpunUnit for (10.00 x (Real((Level of Foul Swipe  for SoulCheiftain)))) using attack type Spells and damage type Normal.
                        Special Effect - Create a special effect attached to the chest of SpunUnit using Objects\Spawnmodels\Human\HumanBlood\BloodElfSpellThiefBlood.mdl
                        Special Effect - Destroy (Last created special effect)
                Custom script:   call RemoveLocation(udg_SpunPoint)
                Unit Group - Remove all units from UnitsHitBySwing

Some part of the group **** (not actually a bad word, don't know why it;s bleeped out) just designates that the units are enemies or neutral hostile.

Anyways, i need some help to fix it. Hopefully someone can help me.
 
Level 13
Joined
Dec 29, 2004
Messages
597
So far, i found these leaks. (bold)

Drain Pipe said:
- (Distance between (Position of SoulCheiftain) and (Position of (Target unit of ability being cast))) Less than or equal to 300.00

- Set SpinFuryPushbackPoint = ((Position of (Picked unit)) offset by 4.00 towards (Angle from (Position of SoulCheiftain) to (Position of (Picked unit))) degrees)
 
Level 13
Joined
Dec 29, 2004
Messages
597
Drain Pipe said:
However i thought when you're setting a point, it doesn't matter if you use a unit point.

no, actually it cause leaks when you use blizzard default function which return location. That is, instead of making a lot of variables just to store this var, why don't you use JASS :wink:, so you can feel free to create more local variables. All you need is just to set those variable into 'nothing' in the end of function.
 
Level 12
Joined
Mar 11, 2004
Messages
600
It is untrue that functions that return locations leak, some blizzard.j functions leak for not setting their variables to null, but some return locations without using local variables, they don't leak.

PolarProjectionBJ is safe in this case for example. But you have to remove its returned location and its argument location once you no longer need them that's the leak.

There are 2 kinds of leaks, one is when you don't remove objects that are no longer needed, and the second one is not setting them to null at the end.

The first one is the most important leak, and yu have to always remove created objects that you will no longer need, this goes for trigger, triggeraction, triggercondition, boolexpr, location, group, effect, force, dialog, dialogbutton, image, lightning and many other handle derived types.
 
Level 10
Joined
Apr 9, 2004
Messages
502
Can i remove this with GUI or do i need some JASS custom Script? (ex: Using the "clear unit group action" to remove a unit group after using it) I can identify a few of those handles that you've shown such as point, group, effect, lighting, but i'm confused with "trigger, triggeraction, triggercondition, abnd booleanexpr". How do i remove those (what type of code whould i need to accomplish that?)

Also, i want to know if i am using a point multiple times for a short period, do i have to constantly remove and re-add it or can i simply reuse it until i've finished with my function? (this trigger sets a point at the beginning, and uses it throughout thre looping trigger and only removes it at the end)
 
Level 11
Joined
Jul 20, 2004
Messages
2,760
If you organise your code then it will be extremely easy to comprehend. Through conversion GUI->JASS you can learn functions and through other people's methods you can "steal" some new techniques.

That is why there are some tutorials available, either on this or see Vexorian's siggy. ;) If you can handle GUI very well, then it's time to advance to the next level: JASS!

~Daelin
 
Status
Not open for further replies.
Top