[Snippet] AddSpecialEffectZ

Scripts

14 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
1
library SpecialEffectZ /* v1.0.0.0 
2
*******************************************************************
3
*
4
*    Allows you to add a special effect with a Z value.
5
*
6
*******************************************************************
7
*
8
*    function AddSpecialEffectZ takes string model, real x, real y, real z returns effect
9
*
10
*******************************************************************/
11
12
    globals
13
        private destructable platform
14
        private effect zEffect
15
    endglobals
16
17
    function AddSpecialEffectZ takes string model, real x, real y, real z returns effect
18
        set platform = CreateDestructableZ('OTip', x, y, z, 0, 1, 0)
19
        set zEffect = AddSpecialEffect(model, x, y)
20
        call RemoveDestructable(platform)
21
        return zEffect
22
    endfunction
23
24
endlibrary
14 years
Simplicity is the best. Approved of course :)
14 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 )
14 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()
14 years
Oh, ok i understand now ;) ;)
Z is ^ @.@
Thank'z ;) ;)
+ REPT