I need help fo fix some leaks...

SutinG

Member
Reaction score
1
Hi,
I was reading this tutorial, about how to remove memory leaks, and I had a lot of doubts.


This is a passive ability for a hero in my map:
Code:
    Events
        Unit - A unit Is attacked
    Conditions
        (Level of Mana Break (GROM) for (Attacking unit)) Not equal to 0
        ((Attacked unit) is A structure) Equal to False
    Actions
        Set manabreak = (Level of Mana Break (GROM) for (Attacking unit))
        Unit - Set mana of (Attacked unit) to ((Mana of (Attacked unit)) - (10.00 x (Real(manabreak))))

But I don't know if "Set manabreak" each time that the condition is true will cause some leak...


Neither if this triggered skill cause some lag:
Code:
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to MyAbility
    Actions
        Special Effect - Create a special effect attached to the origin of (Target unit of ability being cast) using Some effect
        Special Effect - Destroy (Last created special effect)
        Unit - Set mana of (Casting unit) to ((Mana of (Casting unit)) + (((Life of (Target unit of ability being cast)) x 0.25) x (Real((Level of MyAbility for (Casting unit))))))
        Unit - Kill (Target unit of ability being cast)
        Special Effect - Create a special effect attached to the origin of (Casting unit) using Some effect
        Special Effect - Destroy (Last created special effect)


This is a Mode that creates tomes:
First:
Code:
    Events
        Unit - A unit Dies
    Conditions
        ((Dying unit) is A structure) Equal to False
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Dying unit) is A Hero) Equal to True
            Then - Actions
                Item - Create Item[(Random integer number between 1 and 3)] at (Position of (Dying unit))
            Else - Actions
                Item - Create Item[(Random integer number between 4 and 44)] at (Position of (Dying unit))

Second:
Code:
TC Remove
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Item - Pick every item in (Playable map area) and do (Actions)
            Loop - Actions
                Item - Set the custom value of (Picked item) to ((Custom value of (Picked item)) + 3)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Item-class of (Picked item)) Equal to Powerup
                        (Custom value of (Picked item)) Greater than or equal to 21
                    Then - Actions
                        Item - Remove (Picked item)
                    Else - Actions

Thanks in advance.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Only the third trigger there leaks, with the (Position of (Dying Unit)).
set it to a variable, for example Temp_Point, and then use this custom script line to remove the leak:

call RemoveLocation(udg_Temp_Point)

(udg_Temp_Point) is if your point variable has that name, but you should always use udg_ before a GUI global variable when you remove the leaks
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top