Upload a real like photo into the gallery and get rewarded forum power!

    Things that leak!

    Share

    pRo.MAPMAKER
    Admin
    Admin

    Posts: 13
    Forum Power: 2025
    Reputation: 0
    Join date: 2010-07-21
    Age: 19
    Location: England

    Things that leak!

    Post by pRo.MAPMAKER on Thu Jul 22, 2010 11:55 am

    Hello guys!
    Credit to: Wolverabid, PurplePoot, Silvenon, Paskovich

    I want to make a list of things that leak and things that optimizes.

    Dynamic Unitgroups
    This trigger will instantly destroy dynamically generated unitgroups.
    Trigger
    Events
    Event

    Conditions
    Conditions

    Actions
    Custom script: set bj_wantDestroyGroup = true
    Unit Group - Pick every unit in (Playable Map Area) and do (Unit - Hide (Picked unit))






    Another way to avoid a group leak is to store the group instantly to a variable, and then destroy it manually.
    Set GroupVar = Pick every unit in (Playable Map Area)
    Unit Group - Pick every unit in GroupVar and do (Unit - Hide (Picked unit))
    Custom script: call DestroyGroup(udg_GroupVar)


    This is useful is you want to use the group more than one time in the trigger.

    Dynamic Locations
    Unit - Create 1 unit at Somewhere



    If Somewhere is a function, like (Position of (Unit)) or (Center of (Region)), it will leak.

    Set loc = Somewhere
    Unit - Create 1 unit at loc
    Custom script: call RemoveLocation(udg_loc)




    Player Group
    Note: (All Players) does not leak, and destroying it can result in problems
    Player Groups leak also, but those are really rare. The fix:
    Player Group
    Events
    Unit - A unit Starts the effect of an ability

    Conditions
    (Ability being cast) Equal to Some Spell

    Actions
    Set PlayerGroup = (All enemies of Player 1 (Red))
    Player Group - Pick every player in PlayerGroup and do (Do nothing)
    Custom script: call DestroyForce(udg_PlayerGroup)






    Sounds
    Also sounds leak, they should be destroyed like this:
    Sound
    Events
    Unit - A unit Starts the effect of an ability

    Conditions
    (Ability being cast) Equal to Some Spell

    Actions
    Sound - Play (Some Sound)
    Sound - Destroy (Last played sound)






    Special Effects
    Speical Effect
    Events
    Unit - A unit Starts the effect of an ability

    Conditions
    (Ability being cast) Equal to Some Spell

    Actions
    Set Point = (Position of (Triggering unit))
    Special Effect - Create a special effect at Point using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
    Special Effect - Destroy (Last created special effect)





    Please add your experiences

      Current date/time is Mon Feb 06, 2012 10:27 pm