HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

can someone tell me how to use these....

01-03-2008, 05:06 PM#1
sarge
AddLightningEx (string codeName, boolean checkVisibility, real x1, real y1, real z1, real x2, real y2, real z2) returns lightning

and

MoveLightningEx (lightning whichBolt, boolean checkVisibility, real x1, real y1, real z1, real x2, real y2, real z2) returns boolean

please explain in detail
01-03-2008, 05:29 PM#2
redscores
AddLightningEx is to create a X,Y,Z oriented lightning (more will be described under) *HINT: Do not call this, ever set the var directly to that (example: set Lightning = AddLightningEx(etc), because it cannot be detect by GetLastCreatedLightning*

MoveLightningEx is to move the before added Lightning (from AddLighthingEx ONLY) to different coordinates.

Ok, x1,y1,z1,x2,y2,z2 are coordinates, figure out like a coordinates system, ok, there is in the wc3 editor a coordinates system which can detect the coordinates for units, the functions are GetUnitX(unit you want the x from) and GetUnitY(unit you want the y from), means you can detect without locations a units position, ok, either you can convert x and y to a location, with Location(X, Y), it returns a location. I hope you understood the coordinates.

Now, the Z is the height, means you can create a flying lightning, example, set the z2 to 1000, so you will see at the start of the lightning it is on the ground and it will raise till the defined point(with X2, Y2, and the 1000 Z) to a height of 1000. Means it will look like a bolt to the sky.

The Code Name of a lightning you can get over the object editor, create a spell in the object editor, enable raw code shown and then go where you define for example Chain Lightning the Lightning, and then write the code you want (example: AFOD is for finger of death) and put the code in with "Raw Code of the lightning here(example AFOD)". You will see the lightning will look like the finger of death.

The Boolean check visibility is simply to make hidden lightnings which can be activated through moving them, example turn the boolean at the start, in the AddLightningEx function false ,so the lightning won't be shown up. Then when you want to move the lightning to different coordinates simply turn the boolean true and the lightning is shown up.
01-04-2008, 07:10 AM#3
sarge
this is my custom script

set udg_test = AddLightningEx( "DRAL", true, GetLocationX(GetUnitLoc(udg_unit1)), GetLocationY(GetUnitLoc(udg_unit1)), GetUnitFlyHeight(udg_unit1)), GetLocationX(GetUnitLoc(udg_unit_gryphon)), GetLocationY(GetUnitLoc(udg_unit_gryphon)), GetUnitFlyHeight(udg_unit_gryphon) )

i cant copy and paste these text above into the 'custom script' trigger. it causes my editor to crash. i had to convert my trigger to custom text to prevent crashes. can explain why?

another problem: everytime i move a unit to hilly and high level terrain the lightning bolt seems to lowered down and then i move the unit back to flat terrain it raises up to the same level of the Z axis of the unit. whats the cause of this?
01-04-2008, 08:14 AM#4
Zandose
I don't know about the copy and paste thing but for the other one...

First, GetUnitFlyHeight() returns the units flying height, which is a constant valve uneffected by terrain. For instance, a flying unit might move from flat ground to a hill and you'll notice that the unit will change its height to match the new terrain. In fact the unit still has the same flying height, distance from the ground. So the native your using it wrong. I'm guessing your using GUI, in which case I don't believe blizzard added the proper native/command to it. You'll need to add one custom script, and a one real global.
Trigger:
Untitled Trigger 001
Events
Conditions
Collapse Actions
Custom script: set <Global real variable> = GetLocationZ(GetUnitLoc(<Unit>))
Remove the < and > from both parts and replace with proper stuff. For the first one use make a global real variable. To get the name of it in a trigger convert the trigger to JASS; it should be something like udg_real. For the unit part I suggest you make another global variable for a unit and in the trigger set it to whatever unit you want, or somply replace the unit with whatever.

This should work but I'm tired and going to bed so I can't really test it.
01-04-2008, 09:17 AM#5
Malf
Quote:
Originally Posted by redscore
*HINT: Do not call this, ever set the var directly to that (example: set Lightning = AddLightningEx(etc), because it cannot be detect by GetLastCreatedLightning*

GetLastCreatedLightning returns bj_lastCreatedLightning. the AddLightning function sets bj_lastCreatedLightning = AddLightningEx(etc)

You want a hint?
Collapse JASS:
function AddLightningLoc takes string codeName, location where1, location where2 returns lightning
    set bj_lastCreatedLightning = AddLightningEx(codeName, true, GetLocationX(where1), GetLocationY(where1), GetLocationZ(where1), GetLocationX(where2), GetLocationY(where2), GetLocationZ(where2))
    return bj_lastCreatedLightning
endfunction

function GetLastCreatedLightningBJ takes nothing returns lightning
    return bj_lastCreatedLightning
endfunction
01-04-2008, 09:29 AM#6
sarge
yes im using gui since i know only a thing or two about jass. heres my current custom script:

set udg_real_Z_test = ( GetLocationZ(GetUnitLoc(udg_unit_gryphon)) + GetUnitFlyHeight(udg_unit_gryphon) )

the lightning bolt is more accurate now but whenever its above certain doodads like trees the bolt appears to be misaligned from the exact position of the gryphon rider. i need a near perfect accuracy. any suggestion on how to fix it?
01-04-2008, 09:32 PM#8
darkwulfv
It won't be perfect, because things like doodads / terrain deformations / etc. can mess with a unit's Z value (height), so unless you constantly updated it (and even then it might not work), you'll likely have problems.