• 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.

[Jass/vJass] AddLightningEx (Duration)

Status
Not open for further replies.
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

I have a question about this: In my new spell (vJass) a sun (dummy) is moving from one point to another point in high of 350. Now I want create a short lightning from the sun to a random point.
I asked how to do this and get the answer with AddLightningEx because I can set the high with it.

But now the problem: How can I create it like this, that the lightning is shown only for 0.25 seconds and destroyed after this time?

I can't use "call TriggerSpellAction(0.25) and then destroy" because it in a loop. Also I tried it with
JASS:
call DestroyLightning(AddLightningEx("AFOD",false,sor.x1,sor.y1,sor.flyhigh,sor.x2,sor.y2,0.))
but then the lightning isn't shown at all. Also I didn't find something like "AddLightningExTimed" or something =(

Can someone help me with that problem or is there any other way, how I can create an effect like this?
( I tested it with 1 dummy at the dun - 1 dummy at the ground and then the upper dummy cast chain lightning on it. But first it seems to be chain lightning hasn't z and I must remove locust from the ground dummy ... and this isn't good!! )

Thanks - Peace and Greetings
Dr. Boom
 
Level 26
Joined
Aug 18, 2009
Messages
4,099
Well, export the script then in another thread and use a wait there.

JASS:
globals
    lightning TEMP_LIGHTNING
    real TEMP_REAL
endglobals

function DestroyLightningTimed_Executed takes nothing returns nothing
    local lightning whichLightning = TEMP_LIGHTNING

    call TriggerSleepAction(TEMP_REAL)

    call DestroyLightning(whichLightning)
endfunction

function DestroyLightningTimed takes lightning whichLightning, real duration returns nothing
    set TEMP_LIGHTNING = whichLightning
    set TEMP_REAL = duration

    call ExecuteFunc("DestroyLightningTimed_Executed")
endfunction

Consider that lightnings are not reference-counted, you should not destroy them from elsewhere meanwhile/use them further after destruction.

You could also use the more precise timers instead of waits but you would need an allocation method for that, assigning the lightning to the timer.
 
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =O

Again Bribe you made my day ^^, very good BUT: jashelper shows an error, when I try to use this "system" ... jasshelper show lines, that aren't existing in the scrip at all:

Jasshelper mark "struct lightningtimed" but in the script it is "struct $HANDLE$timed" and say "identifier redeclared: lightningtimed

Edit: No problem, I fixed this ;)

I have JNGP, newest jasshelper and TimerUtiles
What's this now? =O
 
Last edited:
Status
Not open for further replies.
Top