• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[vJASS] Lightning Help

Status
Not open for further replies.
Level 17
Joined
Feb 11, 2011
Messages
1,860
Hi guys,

I am creating a spell for which I would like to add custom lightning, so I can replace the Dumm'y Manaburn with a more flexible option. Anyway, I would like to know how to determine the appropriate z1 and z2 values for the function:
JASS:
AddLightningEx takes string codeName, boolean checkVisibility, real x1, real y1, real z1, real x2, real y2, real z2 returns lightning
Also, what is the use of checkVisibility?

Thanks!
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
If checkVisibility is true, then the lightning will only be visible to players if the area in which it's created is not fogged. That means if the player can see a little bit of the lightning, the entire lightning will be shown. Note that if the player couldn't see the lightning before and later comes to the area, the lightning still won't be shown.
If it's false, the lightning will always be seen regardless of fog.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
I would recommend this for simplicity:
JASS:
library ZLoc
    globals
        private location z = Location(0, 0)
    endglobals
    
    function GetPointZ takes real x, real y returns real
        call MoveLocation(z, x, y)
        return GetLocationZ(z)
    endfunction
endlibrary

You would want to get the location's z of where you create your lightnings.
If you attach the lightning to units, you would add GetUnitFlyHeight to the z.
For instance:
JASS:
call AddLightningEx(someLightningPath, true, GetUnitX(caster), GetUnitY(caster), GetPointZ(GetUnitX(caster), GetUnitY(caster)) + GetUnitFlyHeight(caster), //etc...
 
Level 17
Joined
Feb 11, 2011
Messages
1,860
Thanks. Going back a bit...

You would want to get the location's z of where you create your lightnings.
If you attach the lightning to units, you would add GetUnitFlyHeight to the z.
For instance:
JASS:
call AddLightningEx(someLightningPath, true, GetUnitX(caster), GetUnitY(caster), GetPointZ(GetUnitX(caster), GetUnitY(caster)) + GetUnitFlyHeight(caster), //etc...

Would this be correct?

JASS:
set D.bolt[index] = AddLightningEx("MBUR", true, x, y, GetPointZ(x, y) + GetUnitFlyHeight(D.fissure), x2, y2, GetPointZ(x2, y2) + GetUnitFlyHeight(u))
Details
x = X co-ord of Fissure unit - source of lightning.
y = Y co-ord of Fissure unit - source of lightning.
x2 = X co-ord of target unit of lightning.
y2 = Y co-ord of target unit of lightning.
 
Status
Not open for further replies.
Top