HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trouble with AddLightningEx

08-28-2006, 07:20 AM#1
CaptainPicard
I'm starting to get into Jass scripting, and it's quite a lot nicer than this junk with the GUI for some of the things I want to do.

One of those things is to create webs of lightning effects that I can manipulate mathematically in three dimensions to make it look as if walls are opening or otherwise changing. Should be impressice, once I get it to work.

The problem comes when I want to make the lightning visible selectively. I want the lightning webs to be integrated into the Bahr'Tan temple I'm designing, for which Guesst has kindly provided some roofing models (here).

However, when I try to create lightning effects within the temple, if I use this trigger:

Collapse JASS:
call AddLightningEx("LEAS", false, udg_Pt1x, udg_Pt1y, udg_Pt1z, udg_Pt2x, udg_Pt2y, udg_Pt2z)

I find that the lightning is visible from outside the temple, through what are otherwise view-obstructing, solid walls. If instead I use this script:

Collapse JASS:
call AddLightningEx("LEAS", true, udg_Pt1x, udg_Pt1y, udg_Pt1z, udg_Pt2x, udg_Pt2y, udg_Pt2z)

Setting the checkVisibility value to "true" makes it so that I can't make any lightning appear. Even when I'm looking right at where the lightning should be, inside the temple but otherwise in the middle of a wide-open room, I don't see anything.

At first I thought it might be related to whether the camera was fixed on the point where the lightning was to be created at the particular time it was to be created. But, that doesn't make a difference.

Any help much appreciated!

Capt. Picard
08-28-2006, 07:54 AM#2
Anitarf
I don't think there is a solution to this, lightning is always rendered last I believe.

You could overcome this by utilizing such camera angles where this doesn't look wierd, or by using a custom model for the lightning web.
08-28-2006, 12:44 PM#3
blademasterEXO
Hmm.. I suck at Jass reading but i can tell youre trying to create lightning effects.

It WAS hard to set them, and yet i gave up doing so. I used Ex Candy War's method of making a dummy which casts a Finger of Death with the lightning effect to another dummy. Off course, ull need to give every 300 seconds (maximum duration of FoD's Lightning) the dummy would cast it again.

Mayb dis could help? ^^
08-28-2006, 12:48 PM#4
Rising_Dusk
I remember when coding Lightning in AotZ...
You could see the lightning effects even through Fog of War, too.

So yes, from personal experience they are always rendered last.
EXO's way may work (It's worth a try), but I still think making dummy unit's haphazardly and requiring a custom Finger of Death ability is mostly sloppy.
However, if it works, it works. :P
08-28-2006, 02:52 PM#5
The)TideHunter(
There is a way, i noticed dota's lightning revenant has a red lightning, maybe you could ask them how they did it.
08-28-2006, 03:06 PM#6
Wyvernoid
Well that seems quite easy, just give a "Lightning Breath" (maybe called this)to the unit and set the ability's Art - Lightning Effect to "Finger of Death".
Hope I'm right... dunno if this helps to this thread?
08-28-2006, 05:50 PM#7
Anitarf
Perhaps spells like drain life could be made to last forever? Still, even if the fog of war hides them, that doesn't neccesarily mean terrain will too, unless spell lightning effects are drasticaly different from triggered lightning effects.
08-28-2006, 07:35 PM#8
The)TideHunter(
I think life drain with duration of 0 makes it last forever. If not, try -1.
08-28-2006, 08:23 PM#9
CaptainPicard
Thanks guys. It sounds like this lightning business is trickier than I thought. Particularly regarding Anitarf's suggestion, it sounds like I'll have to be very careful with how it's applied. But, since there's not too much of it, I think I can make a trigger to apply the lightning every quarter-second or so, then remove it. When the camera view includes the lightning, it will be included. Otherwise, it won't.

Alternatively, I suppose I could do something with units firing Spirit-tower bolts at one another...

One question, though: if I do decide to create the lightning continuously, would it leak memory to define PointX, then do a boolean tet of whether PointX was within "Current Camera Bounds" and destroy PointX? Would that leak a region?

Thanks!

Capt. Picard
08-28-2006, 09:57 PM#10
Anitarf
Depends on if the Current Camera Bounds gives you a new rect or the same one every time.

Btw, I just took a look at a drain spell in one of my maps, and the lightning rendered over a doodad that was in front of it, so, no luck there. Try a custom model, or super fast attacking dummy units so their projectiles form a line of a sort...
09-01-2006, 02:07 AM#11
PandaMine
The problem with using the dummy unit system is that units that have the locust ability cannot be target with spells (I tried it before). You can get a unit with locust to cast an ability, but you cannot cast an ability on a unit with locust (even through triggers). To get around this instead of giving the unit locust, change selection scale to 0 and make it invulnerable (as well as using the dummy model). Make sure the finger of death ability doesnt deal any damage otherwise you cant cast it on an invulnerable unit