HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Why doesent this work?

09-29-2006, 06:15 PM#1
zeroXD
I'm learning JASS, and im experimenting with some lightning, and i wonder: why cant i use AddLightningEx and then move it with MoveLightningLoc after creating it?

Collapse JASS:
loop
    exitwhen steps>=36
    call AddLightningEx( "DRAL", true, GetUnitX( caster ), GetUnitY( caster ), 350, GetUnitX( caster ), GetUnitY( caster ), 0 )
    set LD[steps] = GetLastCreatedLightningBJ()
    call MoveLightningLoc( LD[steps], loc, PolarProjectionBJ( loc, 300, 10*steps ) )
    set steps=steps+1
endloop

What happens is that i get 36 life drain effects stacked on each other in a pillar from the caster and upwards, they wont move at all =(.
09-29-2006, 06:16 PM#2
Vexorian
AddLightning is native, it doesn't assign to bj_lastCreatedLightning which is the variable returned by that function

Collapse JASS:
loop
    exitwhen steps>=36

    set LD[steps] = AddLightningEx( "DRAL", true, GetUnitX( caster ), GetUnitY( caster ), 350, GetUnitX( caster ), GetUnitY( caster ), 0 )
    call MoveLightningLoc( LD[steps], loc, PolarProjectionBJ( loc, 300, 10*steps ) )
    set steps=steps+1
endloop
09-29-2006, 06:18 PM#3
zeroXD
So, what shal i do to get the variable?
EDIT: sry, i see u already came up woth an answer :P

Now it works, also i changed the steps to "0" to actually get 36 effects instead of 35, but now it dont have z-offset =(.
09-29-2006, 06:19 PM#4
Chuckle_Brother
Check his post.
Collapse JASS:
set LD[steps] = AddLightningEx( "DRAL", true, GetUnitX( caster ), GetUnitY( caster ), 350, GetUnitX( caster ), GetUnitY( caster ), 0 )

This works, whereas before you were trying to move an empty variable.
09-29-2006, 06:30 PM#5
zeroXD
Uhm, if you read above thats excactly the same as vexorian came up with, but if you read my post above i got a problem with the z-offset, changing to zero when i use MoveLightningLoc... So, how can i be using angles with x-y offsets?
09-29-2006, 06:40 PM#6
Chuckle_Brother
Note that you edited 4 minutes after I posted.(wanted to make sure you go it)
09-29-2006, 07:55 PM#7
illidan92
A more suitable title would be "JASSed Lightning Effects". I've said this many times, make the title associated with the post.
09-29-2006, 08:44 PM#8
aquilla
Why do you create it at a position and then move it instantly?

Anyways, use MoveLightningEx(). The polar-projection thingy

x + distance * Cos(angle)
y + distance * Sin(angle)

Angle should be in radians not degrees (multiply by bj_DEGTORAD or whatever) and distance is ofcourse the distance you want it offset by
09-30-2006, 07:00 AM#9
zeroXD
Thanks, because i figured i couldnt use polar projection on LightningEx, and now i dont have to move the lightning. Also, this will be usefull for a lot more.