• 🏆 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!

Lightning Effect Height

Status
Not open for further replies.
Level 26
Joined
Oct 2, 2011
Messages
2,482
I have a question about triggered lightning effects.
I want to set the lightning effect to a custom height (Z) of 40.
Right now, I can only connect it via GUI triggers, attaching it to the ground between two points.

Let's say we have two flying units at 270 height. I want to trigger a lightning effect between them without using any abilities.

Thanks in advance! :)
 
Level 18
Joined
May 11, 2012
Messages
2,103
  • Custom script: local integer zOffset = 80
-> set the lightning height
  • Custom script: call MoveLightningEx(udg_Lightning, true, GetLocationX(udg_point1), GetLocationY(udg_point1), GetLocationZ(udg_point1)+zOffset, GetLocationX(udg_point2), GetLocationY(udg_point2), GetLocationZ(udg_point2)+zOffset)
-> moves lightning from source point1 to target point2, adding zOffset.

Something like this will do.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
To add on to what others have said, the Lightning - Create Lightning Effect calls the AddLightning() native, which only takes x and y as a parameter. This is why they "attach" to the ground. You will need to use the "JASS exclusive" AddLightningEx() that has an added parameter of z (height).

JASS:
native AddLightning takes string codeName, boolean checkVisibility, real x1, real y1, real x2, real y2 returns lightning

native AddLightningEx takes string codeName, boolean checkVisibility, real x1, real y1, real z1, real x2, real y2, real z2 returns lightning
 
Status
Not open for further replies.
Top