• 🏆 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!
In-cred-ib-le
Reaction score
0

Profile posts Latest activity Postings Experience Resources About

  • Keep in mind that the gg_unit_H000_0000 must be generated by the world editor, otherwise it will register a unit which is "null", meaning, a variable which doesn't point at any unit at all.
    function ME takes nothing returns nothing
    //I never said it, but Locations are stupid. Use x/y coordinates whenever you can.
    local real tX = GetOrderPointX()
    local real tY = GetOrderPointY()
    local string s = "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl"

    //Before, you created the effect twice and never removed the first one.
    call DestroyEffect(AddSpecialEffect(s, GetUnitX(gg_unit_H000_0000), GetUnitY(gg_unit_H000_0000)))
    //SetUnitX/Y is also nice.
    call SetUnitX(gg_unit_H000_0000, tX)
    call SetUnitY(gg_unit_H000_0000, tY)
    call DestroyEffect(AddSpecialEffect(s, tX, tY))

    //And done. We didn't have to clear up anything this time :D
    endfunction

    function InitTrig_MEffects takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterUnitEvent(t, gg_unit_H000_0000, EVENT_UNIT_ISSUED_POINT_ORDER )
    call TriggerAddAction(t, function ME )
    set t = null
    endfunction
    Well, nothing gets "un-leaked" unless you dont destroy them, right?

    Also, is is depending on the effect model you are using, when you are to destroy it.

    You know ThunderClap, and WarStomp for instance. They have no specific animation index, which means, they can be removed instantly after they have been created without aborting its gfx. In cases like these, the easiest you could do is to simply:
    call DestroyEffect(AddSpecialEffectLoc(s, i))

    In other cases, you would have to store the effect in a variable, wait, and then destroy it.
    Also, dont forget, that locations leak if you dont destroy them as well (in fact, practically everything which is not code, integer, real or boolean do leak, and are called handles)

    Keep in mind, always null local handles at the end of the function.
  • Loading…
  • Loading…
  • Loading…
  • Loading…
  • Loading…
Top