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

007

007

Level 6
Joined
May 3, 2009
Messages
175
how can i make a lightning effect which goes from position of unit A to position of unit B and which has the height of one of the units. A is flying but the lightning is on the ground.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
As far as I know, you need JASS for that.
The raw script would be:

JASS:
call AddLightningEx("Lightning Name", true, x1, y1, z1, x2, y2, z2)

"Lightning Name" is something like "AFOD" (Finger Of Death), or "CLPB" (Chain Lightning Primary).
You can easily check it by writing it in GUI and then converting it to custom script.

The "true" is for checking visibility. If this is off, you can see the effect through the fog of war (I think).

The coordinates speak for themselves I guess.
The effect goes from the point (x1, y1, z1) to (x2, y2, z2)

In GUI, it could look like this:

  • Actions
    • Set tempLoc1 = (Position of Unit 1)
    • Set tempLoc2 = (Position of Unit 2)
    • Set z1 = (Current flying height of Unit 1)
    • Set z2 = (Current flying height of Unit 2)
    • Custom script: call AddLightningEx("AFOD", true, GetLocationX(udg_tempLoc1), GetLocationY(udg_tempLoc1), udg_z1, GetLocationX(udg_tempLoc2), GetLocationY(udg_tempLoc2), udg_z2)
    • Custom script: call RemoveLocation(udg_tempLoc1)
    • Custom script: call RemoveLocation(udg_tempLoc2)
Sorry, I haven't got much time (I'm leaving right now), so I could not test this.
Hope you get it work!
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
You need to set the Z parameter in the appropiate constructor (GUI CAN NOT DO THIS).

JASS:
native AddLightningEx takes string codeName,boolean checkVisibility,real x1,real y1,real z1,real x2,real y2,real z2 returns lightning
Notice the presence of 2 z parameters. Each of these is a real for the z the lightning should have at the corrosponding point.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You need to use AddLightningEx().

For example

Loc1 = Position of unit1
Loc2 = Position of unit2

  • Custom script: set bj_lastCreatedLightning = AddLightningEx("AFOD", true, GetLocationX(udg_Loc1), GetLocationY(udg_Loc1), GetLocationZ(udg_Loc1) + 60, GetLocationX(udg_Loc2), GetLocationY(udg_Loc2), GetLocationZ(udg_Loc2) + 60)
60 will be the offset from ground. Loc1 and Loc2 are point variables. You can use the <last created lightning effect> in GUI to refer to this lightning. Don't forget to clear the point leaks.

  • Custom scrip: call RemoveLocation(udg_Loc1)
  • Custom scrip: call RemoveLocation(udg_Loc2)
AFOD is the lighnting type. Here are all the types:
  • Lightning - Create a Chain Lightning - Primary lightning effect from source (Position of (Triggering unit)) to target (Center of (Playable map area))
  • Lightning - Create a Chain Lightning - Secondary lightning effect from source (Position of (Triggering unit)) to target (Center of (Playable map area))
  • Lightning - Create a Drain lightning effect from source (Position of (Triggering unit)) to target (Center of (Playable map area))
  • Lightning - Create a Drain Life lightning effect from source (Position of (Triggering unit)) to target (Center of (Playable map area))
  • Lightning - Create a Drain Mana lightning effect from source (Position of (Triggering unit)) to target (Center of (Playable map area))
  • Lightning - Create a Finger of Death lightning effect from source (Position of (Triggering unit)) to target (Center of (Playable map area))
  • Lightning - Create a Forked Lightning lightning effect from source (Position of (Triggering unit)) to target (Center of (Playable map area))
  • Lightning - Create a Healing Wave - Primary lightning effect from source (Position of (Triggering unit)) to target (Center of (Playable map area))
  • Lightning - Create a Healing Wave - Secondary lightning effect from source (Position of (Triggering unit)) to target (Center of (Playable map area))
  • Lightning - Create a Lightning Attack lightning effect from source (Position of (Triggering unit)) to target (Center of (Playable map area))
  • Lightning - Create a Magic Leash lightning effect from source (Position of (Triggering unit)) to target (Center of (Playable map area))
  • Lightning - Create a Mana Burn lightning effect from source (Position of (Triggering unit)) to target (Center of (Playable map area))
  • Lightning - Create a Mana Flare lightning effect from source (Position of (Triggering unit)) to target (Center of (Playable map area))
  • Lightning - Create a Spirit Link lightning effect from source (Position of (Triggering unit)) to target (Center of (Playable map area))
  • -------- -------------------- --------
  • "CLPB"
  • "CLSB"
  • "DRAB"
  • "DRAL"
  • "DRAM"
  • "AFOD"
  • "FORK"
  • "HWPB"
  • "HWSB"
  • "CHIM"
  • "LEAS"
  • "MBUR"
  • "MFPB"
  • "SPLK"
  • [/hidden]
 

007

007

Level 6
Joined
May 3, 2009
Messages
175
ok i think i kind of got i now. but what do i have to type instead of AddlightningEx to move it?
 

007

007

Level 6
Joined
May 3, 2009
Messages
175
this doesnt work. it says theres an error and the trigger is deactivated. but i am using the custom script. is thst the reason?
 
Status
Not open for further replies.
Top