[Snippet] AddSpecialEffectZ

Scripts

13 years
edited 8 years
Another simple snippet. It is the good ol' technique to make an effect have a Z-coordinate, allowing it to float Z units above the ground.

It works by creating an invisible platform, adding the effect, and then removing the platform.

Note: Creating too many at a time can cause short lag spikes. If this occurs, you may want to switch to use invisible dummy units instead.
Code (jass) Select
library SpecialEffectZ /* v1.0.0.0
*******************************************************************
*
*    Allows you to add a special effect with a Z value.
*
*******************************************************************
*
*    function AddSpecialEffectZ takes string model, real x, real y, real z returns effect
*
*******************************************************************/

    globals
        private destructable platform
        private effect zEffect
    endglobals

    function AddSpecialEffectZ takes string model, real x, real y, real z returns effect
        set platform = CreateDestructableZ('OTip', x, y, z, 0, 1, 0)
        set zEffect = AddSpecialEffect(model, x, y)
        call RemoveDestructable(platform)
        return zEffect
    endfunction

endlibrary
13 years
Simplicity is the best. Approved of course :)
13 years
I just interest with the title, but i don't understand how to set it :( :( Y.Y Y.Y
But, can that special effect add on invisible unit?? But that effect will show, even the unit are invisible. ( Like DotA - Nightcrawler ultimate )
13 years
This basically allows you to have a z coordinate (elevation) for your effects. It just lets you have effects in air.

For units, you can just use the native AddSpecialEffectTarget()
13 years
Oh, ok i understand now ;) ;)
Z is ^ @.@
Thank'z ;) ;)
+ REPT