• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Lightning Issues

Status
Not open for further replies.
Level 1
Joined
Apr 9, 2008
Messages
2
Probably a simple fix, I'm working with triggered abilities. Currently it encircles my hero lightning (chain lightning animation) and when it finishes spiraling, I've used about 16 different lightning creations. However, i can't figure out how to make ALL the lightning disappear at the end of the spell. It will only allow me to get rid of the last created one. I've tried stacking the destroy last created lightning effect trigger but it doesn't work... please help?
 
Level 6
Joined
Mar 15, 2005
Messages
112
The object is to set each created lightning effect to its own variable so later you can destroy it after a wait.
JASS:
function Actions takes nothing returns nothing
local lightning array Light
local integer I
loop
exitwhen I == 16
set I = I + 1
call AddLightningLoc( "CLPB", GetUnitLoc(GetTriggerUnit()), GetRectCenter(GetPlayableMapRect()) )
set Light[I] = GetLastCreatedLightningBJ()
endloop
//later, after a wait possibly?
set I = 0
loop
exitwhen I == 16
set I = I + 1
call DestroyLightning(Light[I])
set Light[I] = null //there ya go =D
endloop
endfunction
I'll see if I can get something in GUI if you don't understand JASS.
 
Last edited:
Level 13
Joined
Sep 14, 2008
Messages
1,407
I am sure that your code helps him but I think it's better to explain what it does because not everybody understands jass.

-> IncubiProtocoL uses an "lightning array" in which he stores all created lightnings.
Later he goes throught the array destroying every lightning stored in it.
(I only know gui but when using a loop there without any wait I think the lightnings will be destroyed immediatly. So we don't see them disappering they are just gone. )
 
Level 22
Joined
Jun 24, 2008
Messages
3,050
Just save each lightning in a variable Like this:

Create lightning bblablbalba
set Lightning[1] = last created lightning
Create lightning bblablbalba
set Lightning[2] = last created lightning
Create lightning bblablbalba
set Lightning[3] = last created lightning
Wait 5 seconds.
Destroy Lightning[1]
Destroy Lightning[2]
Destroy Lightning[3]
 
Level 1
Joined
Apr 9, 2008
Messages
2
Thanks, helps tons, especially to theblooddancer, im using the world edit triggers, not gui or jass, lol. Im too simple...
 
Status
Not open for further replies.
Top