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

Using Lightning in JASS

Status
Not open for further replies.
Level 6
Joined
Jan 15, 2005
Messages
188
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
I don't understand how to use these functions. Could someone give me an example/tutorial involving these functions? The primary thing I don't understand is the "codeName" part.

I do give rep to those who help me.
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
The Ex one is slightly different from the first one: it takes z, which is height.

As for the functions themselves...
  • The first argument (string codeName) asks for the filename of the lightning effect. You can find it by simply turning a GUI action where you use a lightning effect to custom text to find out the path. There is also an alternative way: go to the Spell Data, find anything with lightning effects (Chain Lightning / Healing Wave), select them (as if you were to change them), and the path should be displayed in the Custom Path (last blank rectangle).
    I find the first one easier, since it has a list.
    attachment.php


  • Next, the boolean checkVisibility. Although I'm not completely sure, it most likely checks if the player has visibility of the area the lightning is on. Else the player can't see it.

  • The coordinates, (x,y), which you probably already learned in Mathematics. Imagine the maps in Warcraft III as a 2D Cartesian coordinate system. Go to the Terrain Editor (the window that shows you the terrain), move your arrow around and you will notice how the numbers in the bottom left window change. There are three numbers constantly changing. They are the abscissa (x), the ordinate (y), and the height (z).
    • If you move your arrow only to the left or the right, you'll notice that the X changes: it is the horizontal coordinate of your point.
    • If you move your mouse arrow up and down, you'll notice that the Y changes: Y defines the vertical coordinate of your point.
    • If you move your mouse arrow to a place where you used the Raise tool (to make hills for example), you'll notice that the Z changes: Z defines how high your point is.

An example of using AddLightning would be.
JASS:
call AddLightning("(somelightningpathname)", true, -250, -250, 250, 250)

This would create a diagonal lightning effect (with whatever lightning effect you use), from the bottom left of your map to the upper right. AddLightning() might as well have a preset height, so if you want to set how high your lightning effect stands in the air, you may as well use AddLightningEx().
 
Last edited:
Status
Not open for further replies.
Top