HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Getting Lightning to reach the right height

02-11-2007, 03:38 AM#1
CaptainPicard
I've noticed that when I try to use triggered lightning effects to look as if they're hiting units in flight, the lightning often does not reach the correct height if I tell it to try and hit the flying height of the unit. This happens if and only if the unit is over a cliff or otherwiser not-level ground.

For instance, if a unit is flying over a moderate slope, lightning that has an endpoint at the locaiton of the unit and the height of the unit will tend to land somewhat beneath the unit (by about 50 to 75 increments, if one tile in the terrain editor measures 128 bt 128 increments).

Is there a way to adjust for the unit's "true" flying height over uneven terrain? I think it may have something to do with the unit's sample radius and number of sample points, but I don't know.

Thanks!
Capt. Picard
02-11-2007, 04:45 AM#2
grim001
Try using GetLocationZ to find the difference between the two terrain heights and adjust the endpoint of the lightning accordingly
02-11-2007, 06:36 AM#3
blu_da_noob
http://www.wc3campaigns.net/showpost...5&postcount=21

(As I said in the post, I don't know exactly what this 'sample radius' might be, but I guess at 256. I used a rough sampling thing, checking in the 8 cardinal directions for a spell of mine. It worked better than not doing it, but it was still not perfect.)
02-16-2007, 09:11 AM#4
PandaMine
I have the same problem, even GetLocationZ isn't accurate especially when the point is on ramps or the side of cliffs (as outlined in blu_da_noobs post). There is a way to get around it, however its tedious and takes up more memeory. What i did is make 2 dummy units, each have 0 selection size, Vexorians Dummy Model and 0 collision size (the basics of a dummy unit) and give the unit the ghost ability. I then make an ability based off lifedrain (you need to remeber to change the activate/turn on order id to drain) and use the same order to make one unit life drain the other. Just change the lightning and edit the buffs (so there is no green splashy thing that comes up over there head). you can then make your one functions to move the units like you would move the lightning

It seems that there IS a function that blizzard made which gives the perfect Z height of the unit at a point however it isnt in any of the natives (you could propably only use it with dll injection and custom natives). Until then the only way to get perfect Z height is to use dummy units and make lightning effects between them