HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[Lightning/SPFX] Can I...

05-21-2007, 07:25 AM#1
Tide-Arc Ephemera
Is it possible to make a lightning effect / special effect with height in GUI? Such as a bolt of lightning coming from a height to another point, like with Chain Lightning, or ball of energy with height (no examples...). If so, could somebody show me an example?
05-21-2007, 07:29 AM#2
Pyrogasm
You could attach it to a dummy unit and set its flyheight.
05-21-2007, 07:49 AM#3
Rising_Dusk
Make a Finger of Death dummy spell and shoot it between two dummies.
Or just use the custom script call to the jass function.
05-21-2007, 08:25 AM#4
Tide-Arc Ephemera
I should've been a little clearer...

Custom script is an acceptable solution.
05-21-2007, 08:46 AM#5
Silvenon
For the special effect:

I'm not sure if you can change a doodoads flying height in GUI, but if you can, you can use KaTTaNas way:

Create the invisible platform doodoad, change its flying height to how high you want your special effect to be, and then create a special effect on that invisible platform, then remove the platform (and the effect will stay on that height)
Though this doesn't work for cracks or craters (ground-texture)

In custom script, you would've called this function:

Collapse JASS:
function AddSpecialEffectZ takes string path, real x, real y, real z returns effect
    local destructable d = CreateDestructableZ( 'OTip', x, y, z, 0.00, 1, 0 )
    local effect fx = AddSpecialEffect( path, x, y )
    call RemoveDestructable( d )
    set d = null
    return fx
endfunction

For the lightning effect:

In GUI it is impossible to create via Lightning - Create lightning effect, but you can use Rising_Dusks suggestion

I think Pyrogasms suggestion is wrong, sorry Pyrogasm, it's just because you don't attach a lightning effect to a unit, but to its location

If custom script is an acceptable solution then it's easy, you just use these:

native AddLightningEx takes string codeName, boolean checkVisibility, real x1, real y1, real z1, real x2, real y2, real z2 returns lightning
and this:

native MoveLightningEx takes lightning whichBolt, boolean checkVisibility, real x1, real y1, real z1, real x2, real y2, real z2 returns boolean
example:

Collapse JASS:
local unit u1 = ......
local unit u2 =......
local real x1 = GetUnitX(u1)
local real y1 = GetUnitY(u1)
local real z1 = GetUnitFlyHeight(u1)
local real x2 = GetUnitX(u2)
local real y2 = GetUnitY(u2)
local real z2 = GetUnitFlyHeight(u2)
local lightning l = AddLightningEx("CLPB", true, x1, y1, z1, x2, y2, z2)

As for MoveLightningEx, I think it's clear what that does
05-21-2007, 04:16 PM#6
blu_da_noob
Quote:
Originally Posted by Silvenon
For the lightning effect:

...
Collapse JASS:
local unit u1 = ......
local unit u2 =......
local real x1 = GetUnitX(u1)
local real y1 = GetUnitY(u1)
local real z1 = GetUnitFlyHeight(u1)
local real x2 = GetUnitX(u2)
local real y2 = GetUnitY(u2)
local real z2 = GetUnitFlyHeight(u2)
local lightning l = AddLightningEx("CLPB", true, x1, y1, z1, x2, y2, z2)

As for MoveLightningEx, I think it's clear what that does

That's not going to work at all, seeing as you didn't take terrtain height into account, but trying to make lightnings work on flying units is dubious in its own right. That's why I suggested the FoD thing to Dusk the other day. Blizzard's internal lightning stuff can obviously adjust to the correct heights, so it's pretty much the only way at the moment.
05-21-2007, 04:22 PM#7
Rising_Dusk
Collapse JASS:
local unit u1 = ......
local unit u2 =......
local location u1l = GetUnitLoc(u1)
local location u2l = GetUnitLoc(u2)

local real x1 = GetUnitX(u1)
local real y1 = GetUnitY(u1)
local real z1 = GetUnitFlyHeight(u1) + GetLocationZ(u1l)
local real x2 = GetUnitX(u2)
local real y2 = GetUnitY(u2)
local real z2 = GetUnitFlyHeight(u2) + GetLocationZ(u2l)

local lightning l = AddLightningEx("CLPB", true, x1, y1, z1, x2, y2, z2)

call RemoveLocation(u1l)
call RemoveLocation(u2l)
That would work to a point. [GetUnitX/Y(..) could easily be flipped to GetLocationX/Y(..)]
See below.

The point is that what Blu says is correct.
Unless you're not targeting flying units, the FoD between two dummies is the ONLY way to do it perfectly.
This is because Blizzard has a flyer smoothing on flying units changing terrain heights.
However, that smoothing does not show up in GetUnitFlyHeight(..)

So yeah.
05-21-2007, 04:56 PM#8
zen87
Or- You can try my effect sys :D (click my sig) however it is not that perfect when it comes to flyer smoothing on flying units changing terrain heights, however it solve your problem with the least work i guess =\
05-22-2007, 08:32 AM#9
Silvenon
Ok, I was only trying to help, so the only thing I did wrong was the GetLocationZ? That's not too bad......

And zen87, your system looks cool, I'm gonna try it out as soon as I can
05-22-2007, 08:37 AM#10
Tide-Arc Ephemera
Um... I didn't mean a full on JASS trigger... I meant the little lines that you can call for...
05-22-2007, 09:39 AM#11
Silvenon
Oh, well, uhmmm........Then you should have this function in your map header:

Collapse JASS:
function CreateLightningWithZ takes unit u1, unit u2 returns lightning
    local location l1 = GetUnitLoc(u1)
    local location l2 = GetUnitLoc(u2)
    local real x1 = GetUnitX(u1)
    local real y1 = GetUnitY(u1)
    local real x2 = GetUnitX(u2)
    local real y2 = GetUnitY(u2)
    local real z1 = GetUnitFlyHeight(u1) + GetLocationZ(l1)
    local real z2 = GetUnitFlyHeight(u2) + GetLocationZ(l2)
    local lightning l = AddLightningEx("CLPB", true, x1, y1, z1, x2, y2, z2)
    call RemoveLocation(l1)
    call RemoveLocation(l2)
    set l1 = null
    set l2 = null
    return l
endfunction

And you just call it like this:

Custom Script: set udg_l = CreateLightningWithHeight(udg_u1, udg_u2)
This would create a lightning effect between 2 units you specified (according to their flying height) and store it in a global variable named l and type lightning, and then you can use Phyrogasms suggestion
05-22-2007, 09:45 AM#12
Tide-Arc Ephemera
Quote:
Originally Posted by Silvenon
Custom Script: set udg_l = CreateLightningWithHeight(udg_u1, udg_u2)
This would create a lightning effect between 2 units you specified (according to their flying height) and store it in a global variable named l and type lightning, and then you can use Phyrogasms suggestion

Wouldn't that place the ENTIRE bolt with height? I saw nothing in there that mentioned anything about having different Z's.

I'm just wondering, it's ok, but I'm just clarifying.
05-22-2007, 11:11 AM#13
zen87
btw, just a reminder, don't create a lighting and instantly destroy it, it will end up not showing anything...
05-22-2007, 06:29 PM#14
Silvenon
Do you know what dummy units are? If you do, then create two dummy units and set their height how much you want it to be, and then use that code to create a lightning from one dummy unit to the other according to their flying height

I don't know how to make it clearer.......if you don't want to create a lightning between to units, but between to points, just use:

Custom Script: set udg_l AddLightningEx("CLPB", true, GetLocationX(udg_loc1), GetLocationY(udg_loc1), <input starting height here>, GetLocationX(udg_loc2), GetLocationY(udg_loc2), <input ending height here>)
If something isn't clear, tell me

loc1 is the starting location (a global variable) and loc2 is the ending location (also a global variable), in JASS, all globals have a prefix udg_