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

[JASS] importing multiple custom scripts

Status
Not open for further replies.
Level 8
Joined
Oct 8, 2005
Messages
409
I down loaded 2 maps from your OLD custom spells page http://www.wc3sear.ch about 2 weeks ago

the map names are "Hero Contest Hero ~Lorderon~!" &
"Paskovich Spell Pack fix3"

I wanted the "magic leash" and "vine whip" spells for my AOS

first I imported the "magic leash" with custom script and it worked

then I imported "vine whip" with custom script and now I get 6000 compile errors

I coppied and pasted the text one after another

where did I go wrong ?

this is the script:

/===============================================================================
//===============================================================================
//==BE SURE TO COPY THIS TEXT TO YOUR MAP IF YOU WANT TO USE ANY OF THE SPELLS!==
//===============================================================================
//===============================================================================

function H2I takes handle h returns integer
return h
return 0
endfunction

// ===========================
function LocalVars takes nothing returns gamecache
// Replace InitGameCache("jasslocalvars.w3v") with a global variable!!
return InitGameCache("udg_TestCache")
endfunction

function SetHandleHandle takes handle subject, string name, handle value returns nothing
if value==null then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
endif
endfunction

function SetHandleInt takes handle subject, string name, integer value returns nothing
if value==0 then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
if value==false then
call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),name)
else
call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function SetHandleReal takes handle subject, string name, real value returns nothing
if value==0 then
call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
else
call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function SetHandleString takes handle subject, string name, string value returns nothing
if value==null then
call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
else
call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function GetHandleHandle takes handle subject, string name returns handle
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction

function GetHandleUnit takes handle subject, string name returns unit
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction

function FlushHandleLocals takes handle subject returns nothing
call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction

//===============================================================================
//===============================================================================

function PolarProjectionX takes real x, real distance, real angle returns real
return x+distance*Cos(angle * (3.14159/180.0))
endfunction
function PolarProjectionY takes real y, real distance, real angle returns real
return y+distance*Sin(angle * (3.14159/180.0))
endfunction
function DistanceBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
return SquareRoot((x1 - x2)*(x1 - x2)+(y1 - y2)*(y1 - y2))
endfunction
function AngleBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
return Atan2((y2-y1),(x2-x1)) * (180.0/3.14159)
endfunction
function GetParabolaHeight takes real dist, real maxdist,real curve returns real
local real t = (dist*2)/maxdist-1
return (-t*t+1)*(maxdist/curve)
endfunction
function DistanceBetweenUnits takes unit A, unit B returns real
return SquareRoot((GetUnitX(A)-GetUnitX(B))*(GetUnitX(A)-GetUnitX(B))+(GetUnitY(A)-GetUnitY(B))*(GetUnitY(A)-GetUnitY(B)))
endfunction
function AngleBetweenUnits takes unit A, unit B returns real
return Atan2((GetUnitY(B)-GetUnitY(A)),(GetUnitX(B)-GetUnitX(A))) * (180.0/3.14159)
endfunction

//===============================================================================
// ===Vine Whip
//===============================================================================
//===============================================================================
//===============================================================================
//==BE SURE TO COPY THIS TEXT TO YOUR MAP IF YOU WANT TO USE ANY OF THE SPELLS!==
//===============================================================================
//===============================================================================

function H2I takes handle h returns integer
return h
return 0
endfunction

// ===========================
function LocalVars takes nothing returns gamecache
// Replace InitGameCache("jasslocalvars.w3v") with a global variable!!
return InitGameCache("udg_TestCache")
endfunction

function SetHandleHandle takes handle subject, string name, handle value returns nothing
if value==null then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
endif
endfunction

function SetHandleInt takes handle subject, string name, integer value returns nothing
if value==0 then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
if value==false then
call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),name)
else
call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function SetHandleReal takes handle subject, string name, real value returns nothing
if value==0 then
call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
else
call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function SetHandleString takes handle subject, string name, string value returns nothing
if value==null then
call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
else
call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function GetHandleHandle takes handle subject, string name returns handle
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction

function GetHandleUnit takes handle subject, string name returns unit
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction

function FlushHandleLocals takes handle subject returns nothing
call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction

//===============================================================================
//===============================================================================

function PolarProjectionX takes real x, real distance, real angle returns real
return x+distance*Cos(angle * (3.14159/180.0))
endfunction
function PolarProjectionY takes real y, real distance, real angle returns real
return y+distance*Sin(angle * (3.14159/180.0))
endfunction
function DistanceBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
return SquareRoot((x1 - x2)*(x1 - x2)+(y1 - y2)*(y1 - y2))
endfunction
function AngleBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
return Atan2((y2-y1),(x2-x1)) * (180.0/3.14159)
endfunction
function GetParabolaHeight takes real dist, real maxdist,real curve returns real
local real t = (dist*2)/maxdist-1
return (-t*t+1)*(maxdist/curve)
endfunction
function DistanceBetweenUnits takes unit A, unit B returns real
return SquareRoot((GetUnitX(A)-GetUnitX(B))*(GetUnitX(A)-GetUnitX(B))+(GetUnitY(A)-GetUnitY(B))*(GetUnitY(A)-GetUnitY(B)))
endfunction
function AngleBetweenUnits takes unit A, unit B returns real
return Atan2((GetUnitY(B)-GetUnitY(A)),(GetUnitX(B)-GetUnitX(A))) * (180.0/3.14159)
endfunction
 
Level 8
Joined
Oct 8, 2005
Messages
409
1) what is a "Handle Vars"
2) what line is "Handle Vars" on
3) where did you get that loop from ^, I did a search for it in my code and could not find it
4) how did you make that code box ^

5) Is this any better:

//===============================================================================
//===============================================================================
//==BE SURE TO COPY THIS TEXT TO YOUR MAP IF YOU WANT TO USE ANY OF THE SPELLS!==
//===============================================================================
//===============================================================================

function H2I takes handle h returns integer
return h
return 0
endfunction

// ===========================
function LocalVars takes nothing returns gamecache
// Replace InitGameCache("jasslocalvars.w3v") with a global variable!!
return InitGameCache("udg_TestCache")
endfunction

function SetHandleHandle takes handle subject, string name, handle value returns nothing
if value==null then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
endif
endfunction

function SetHandleInt takes handle subject, string name, integer value returns nothing
if value==0 then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
if value==false then
call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),name)
else
call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function SetHandleReal takes handle subject, string name, real value returns nothing
if value==0 then
call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
else
call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function SetHandleString takes handle subject, string name, string value returns nothing
if value==null then
call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
else
call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function GetHandleHandle takes handle subject, string name returns handle
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction

function GetHandleUnit takes handle subject, string name returns unit
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction

function FlushHandleLocals takes handle subject returns nothing
call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction

//===============================================================================
//===============================================================================

function PolarProjectionX takes real x, real distance, real angle returns real
return x+distance*Cos(angle * (3.14159/180.0))
endfunction
function PolarProjectionY takes real y, real distance, real angle returns real
return y+distance*Sin(angle * (3.14159/180.0))
endfunction
function DistanceBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
return SquareRoot((x1 - x2)*(x1 - x2)+(y1 - y2)*(y1 - y2))
endfunction
function AngleBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
return Atan2((y2-y1),(x2-x1)) * (180.0/3.14159)
endfunction
function GetParabolaHeight takes real dist, real maxdist,real curve returns real
local real t = (dist*2)/maxdist-1
return (-t*t+1)*(maxdist/curve)
endfunction
function DistanceBetweenUnits takes unit A, unit B returns real
return SquareRoot((GetUnitX(A)-GetUnitX(B))*(GetUnitX(A)-GetUnitX(B))+(GetUnitY(A)-GetUnitY(B))*(GetUnitY(A)-GetUnitY(B)))
endfunction
function AngleBetweenUnits takes unit A, unit B returns real
return Atan2((GetUnitY(B)-GetUnitY(A)),(GetUnitX(B)-GetUnitX(A))) * (180.0/3.14159)
endfunction

function SetHandleHandle takes handle subject, string name, handle value returns nothing
if value==null then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
endif
endfunction

function SetHandleInt takes handle subject, string name, integer value returns nothing
if value==0 then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
if value==false then
call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),name)
else
call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function SetHandleReal takes handle subject, string name, real value returns nothing
if value==0 then
call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
else
call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function SetHandleString takes handle subject, string name, string value returns nothing
if value==null then
call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
else
call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function GetHandleHandle takes handle subject, string name returns handle
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction

function GetHandleUnit takes handle subject, string name returns unit
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction

function FlushHandleLocals takes handle subject returns nothing
call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction

//===============================================================================
//===============================================================================

function PolarProjectionX takes real x, real distance, real angle returns real
return x+distance*Cos(angle * (3.14159/180.0))
endfunction
function PolarProjectionY takes real y, real distance, real angle returns real
return y+distance*Sin(angle * (3.14159/180.0))
endfunction
function DistanceBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
return SquareRoot((x1 - x2)*(x1 - x2)+(y1 - y2)*(y1 - y2))
endfunction
function AngleBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
return Atan2((y2-y1),(x2-x1)) * (180.0/3.14159)
endfunction
function GetParabolaHeight takes real dist, real maxdist,real curve returns real
local real t = (dist*2)/maxdist-1
return (-t*t+1)*(maxdist/curve)
endfunction
function DistanceBetweenUnits takes unit A, unit B returns real
return SquareRoot((GetUnitX(A)-GetUnitX(B))*(GetUnitX(A)-GetUnitX(B))+(GetUnitY(A)-GetUnitY(B))*(GetUnitY(A)-GetUnitY(B)))
endfunction
function AngleBetweenUnits takes unit A, unit B returns real
return Atan2((GetUnitY(B)-GetUnitY(A)),(GetUnitX(B)-GetUnitX(A))) * (180.0/3.14159)
endfunction
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
JASS:
 function H2I takes handle h returns integer
         return h
         return 0
endfunction

// ===========================
function LocalVars takes nothing returns gamecache
    // Replace InitGameCache("jasslocalvars.w3v") with a global variable!!
         return InitGameCache("udg_TestCache")
endfunction

function SetHandleHandle takes handle subject, string name, handle value returns nothing
         if value==null then
                 call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),n  ame)
         else
                 call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
         endif
endfunction

function SetHandleInt takes handle subject, string name, integer value returns nothing
         if value==0 then
                 call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),n  ame)
         else
                 call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
         endif
endfunction

function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
         if value==false then
                 call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),n  ame)
         else
                 call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
         endif
endfunction

function SetHandleReal takes handle subject, string name, real value returns nothing
         if value==0 then
                 call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
         else
                 call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
         endif
endfunction

function SetHandleString takes handle subject, string name, string value returns nothing
         if value==null then
                 call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
         else
                 call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
         endif
endfunction

function GetHandleHandle takes handle subject, string name returns handle
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
         return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
         return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
         return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction

function GetHandleUnit takes handle subject, string name returns unit
        return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction

function FlushHandleLocals takes handle subject returns nothing
    call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction

That's the handle vars.

And the "code box" is [jass ] [/jass ] (without the spaces). However, that was my signature you were looking at :p
 
Level 8
Joined
Oct 8, 2005
Messages
409
I think I have removed all of the repeated code

I'm still getting about 6000 compile errors

this is what I have now:

JASS:
//===============================================================================
//===============================================================================
//==BE SURE TO COPY THIS TEXT TO YOUR MAP IF YOU WANT TO USE ANY OF THE SPELLS!==
//===============================================================================
//===============================================================================

function H2I takes handle h returns integer
    return h
    return 0
endfunction

// ===========================
function LocalVars takes nothing returns gamecache
    // Replace InitGameCache("jasslocalvars.w3v") with a global variable!!
         return InitGameCache("udg_TestCache")
endfunction
function SetHandleHandle takes handle subject, string name, handle value returns nothing
         if value==null then
                 call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),n  ame)
         else
                 call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
         endif
endfunction
function SetHandleInt takes handle subject, string name, integer value returns nothing
         if value==0 then
                 call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),n  ame)
         else
                 call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
         endif
endfunction
function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
         if value==false then
                 call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),n  ame)
         else
                 call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
         endif
endfunction
function SetHandleReal takes handle subject, string name, real value returns nothing
         if value==0 then
                 call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
         else
                 call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
         endif
endfunction
function SetHandleString takes handle subject, string name, string value returns nothing
         if value==null then
                 call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
         else
                 call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
         endif
endfunction
function GetHandleHandle takes handle subject, string name returns handle
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
         return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
         return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
         return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleUnit takes handle subject, string name returns unit
        return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function FlushHandleLocals takes handle subject returns nothing
    call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction
//===============================================================================
//===============================================================================

function PolarProjectionX takes real x, real distance, real angle returns real
    return x+distance*Cos(angle * (3.14159/180.0))
endfunction
function PolarProjectionY takes real y, real distance, real angle returns real
    return y+distance*Sin(angle * (3.14159/180.0))
endfunction
function DistanceBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
    return SquareRoot((x1 - x2)*(x1 - x2)+(y1 - y2)*(y1 - y2))
endfunction
function AngleBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
    return Atan2((y2-y1),(x2-x1)) * (180.0/3.14159)
endfunction
function GetParabolaHeight takes real dist, real maxdist,real curve returns real
    local real t = (dist*2)/maxdist-1
    return (-t*t+1)*(maxdist/curve)
endfunction
function DistanceBetweenUnits takes unit A, unit B returns real    
    return SquareRoot((GetUnitX(A)-GetUnitX(B))*(GetUnitX(A)-GetUnitX(B))+(GetUnitY(A)-GetUnitY(B))*(GetUnitY(A)-GetUnitY(B)))
endfunction
function AngleBetweenUnits takes unit A, unit B returns real
    return Atan2((GetUnitY(B)-GetUnitY(A)),(GetUnitX(B)-GetUnitX(A))) * (180.0/3.14159)
endfunction

//===============================================================================
//===============================================================================

function PolarProjectionX takes real x, real distance, real angle returns real
    return x+distance*Cos(angle * (3.14159/180.0))
endfunction
function PolarProjectionY takes real y, real distance, real angle returns real
    return y+distance*Sin(angle * (3.14159/180.0))
endfunction
function DistanceBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
    return SquareRoot((x1 - x2)*(x1 - x2)+(y1 - y2)*(y1 - y2))
endfunction
function AngleBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
    return Atan2((y2-y1),(x2-x1)) * (180.0/3.14159)
endfunction
function GetParabolaHeight takes real dist, real maxdist,real curve returns real
    local real t = (dist*2)/maxdist-1
    return (-t*t+1)*(maxdist/curve)
endfunction
function DistanceBetweenUnits takes unit A, unit B returns real    
    return SquareRoot((GetUnitX(A)-GetUnitX(B))*(GetUnitX(A)-GetUnitX(B))+(GetUnitY(A)-GetUnitY(B))*(GetUnitY(A)-GetUnitY(B)))
endfunction
function AngleBetweenUnits takes unit A, unit B returns real
    return Atan2((GetUnitY(B)-GetUnitY(A)),(GetUnitX(B)-GetUnitX(A))) * (180.0/3.14159)
endfunction

PS: your sig was very funny after I actually read what it does instead of skimming through it
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
I think I have removed all of the repeated code

I'm still getting about 6000 compile errors

this is what I have now:

JASS:
//===============================================================================
//===============================================================================
//==BE SURE TO COPY THIS TEXT TO YOUR MAP IF YOU WANT TO USE ANY OF THE SPELLS!==
//===============================================================================
//===============================================================================

function H2I takes handle h returns integer
    return h
    return 0
endfunction

// ===========================
function LocalVars takes nothing returns gamecache
    // Replace InitGameCache("jasslocalvars.w3v") with a global variable!!
         return InitGameCache("udg_TestCache")
endfunction
function SetHandleHandle takes handle subject, string name, handle value returns nothing
         if value==null then
                 call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),n  ame)
         else
                 call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
         endif
endfunction
function SetHandleInt takes handle subject, string name, integer value returns nothing
         if value==0 then
                 call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),n  ame)
         else
                 call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
         endif
endfunction
function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
         if value==false then
                 call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),n  ame)
         else
                 call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
         endif
endfunction
function SetHandleReal takes handle subject, string name, real value returns nothing
         if value==0 then
                 call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
         else
                 call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
         endif
endfunction
function SetHandleString takes handle subject, string name, string value returns nothing
         if value==null then
                 call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
         else
                 call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
         endif
endfunction
function GetHandleHandle takes handle subject, string name returns handle
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
         return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
         return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
         return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleUnit takes handle subject, string name returns unit
        return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
         return null
endfunction
function FlushHandleLocals takes handle subject returns nothing
    call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction
//===============================================================================
//===============================================================================

function PolarProjectionX takes real x, real distance, real angle returns real
    return x+distance*Cos(angle * (3.14159/180.0))
endfunction
function PolarProjectionY takes real y, real distance, real angle returns real
    return y+distance*Sin(angle * (3.14159/180.0))
endfunction
function DistanceBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
    return SquareRoot((x1 - x2)*(x1 - x2)+(y1 - y2)*(y1 - y2))
endfunction
function AngleBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
    return Atan2((y2-y1),(x2-x1)) * (180.0/3.14159)
endfunction
function GetParabolaHeight takes real dist, real maxdist,real curve returns real
    local real t = (dist*2)/maxdist-1
    return (-t*t+1)*(maxdist/curve)
endfunction
function DistanceBetweenUnits takes unit A, unit B returns real    
    return SquareRoot((GetUnitX(A)-GetUnitX(B))*(GetUnitX(A)-GetUnitX(B))+(GetUnitY(A)-GetUnitY(B))*(GetUnitY(A)-GetUnitY(B)))
endfunction
function AngleBetweenUnits takes unit A, unit B returns real
    return Atan2((GetUnitY(B)-GetUnitY(A)),(GetUnitX(B)-GetUnitX(A))) * (180.0/3.14159)
endfunction

//===============================================================================
//===============================================================================

function PolarProjectionX takes real x, real distance, real angle returns real
    return x+distance*Cos(angle * (3.14159/180.0))
endfunction
function PolarProjectionY takes real y, real distance, real angle returns real
    return y+distance*Sin(angle * (3.14159/180.0))
endfunction
function DistanceBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
    return SquareRoot((x1 - x2)*(x1 - x2)+(y1 - y2)*(y1 - y2))
endfunction
function AngleBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
    return Atan2((y2-y1),(x2-x1)) * (180.0/3.14159)
endfunction
function GetParabolaHeight takes real dist, real maxdist,real curve returns real
    local real t = (dist*2)/maxdist-1
    return (-t*t+1)*(maxdist/curve)
endfunction
function DistanceBetweenUnits takes unit A, unit B returns real    
    return SquareRoot((GetUnitX(A)-GetUnitX(B))*(GetUnitX(A)-GetUnitX(B))+(GetUnitY(A)-GetUnitY(B))*(GetUnitY(A)-GetUnitY(B)))
endfunction
function AngleBetweenUnits takes unit A, unit B returns real
    return Atan2((GetUnitY(B)-GetUnitY(A)),(GetUnitX(B)-GetUnitX(A))) * (180.0/3.14159)
endfunction

PS: your sig was very funny after I actually read what it does instead of skimming through it

You

A) had double the functions at the bottom

B) had "n ame" instead of "name" in a few places

here's a fixed code

JASS:
//===============================================================================
//===============================================================================
//==BE SURE TO COPY THIS TEXT TO YOUR MAP IF YOU WANT TO USE ANY OF THE SPELLS!==
//===============================================================================
//===============================================================================

function H2I takes handle h returns integer
return h
return 0
endfunction

// ===========================
function LocalVars takes nothing returns gamecache
// Replace InitGameCache("jasslocalvars.w3v") with a global variable!!
return InitGameCache("udg_TestCache")
endfunction
function SetHandleHandle takes handle subject, string name, handle value returns nothing
if value==null then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
endif
endfunction
function SetHandleInt takes handle subject, string name, integer value returns nothing
if value==0 then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
if value==false then
call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),name)
else
call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleReal takes handle subject, string name, real value returns nothing
if value==0 then
call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
else
call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleString takes handle subject, string name, string value returns nothing
if value==null then
call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
else
call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function GetHandleHandle takes handle subject, string name returns handle
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleUnit takes handle subject, string name returns unit
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function FlushHandleLocals takes handle subject returns nothing
call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction
//===============================================================================
//===============================================================================

function PolarProjectionX takes real x, real distance, real angle returns real
return x+distance*Cos(angle * (3.14159/180.0))
endfunction
function PolarProjectionY takes real y, real distance, real angle returns real
return y+distance*Sin(angle * (3.14159/180.0))
endfunction
function DistanceBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
return SquareRoot((x1 - x2)*(x1 - x2)+(y1 - y2)*(y1 - y2))
endfunction
function AngleBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
return Atan2((y2-y1),(x2-x1)) * (180.0/3.14159)
endfunction
function GetParabolaHeight takes real dist, real maxdist,real curve returns real
local real t = (dist*2)/maxdist-1
return (-t*t+1)*(maxdist/curve)
endfunction
function DistanceBetweenUnits takes unit A, unit B returns real
return SquareRoot((GetUnitX(A)-GetUnitX(B))*(GetUnitX(A)-GetUnitX(B))+(GetUnitY(A)-GetUnitY(B))*(GetUnitY(A)-GetUnitY(B)))
endfunction
function AngleBetweenUnits takes unit A, unit B returns real
return Atan2((GetUnitY(B)-GetUnitY(A)),(GetUnitX(B)-GetUnitX(A))) * (180.0/3.14159)
endfunction
 
Level 8
Joined
Oct 8, 2005
Messages
409
I am not getting anymore compile errors, but now paskovich’s vine whip spell is not working

When I target a unit with the spell, purple smoke puffs out of the targeted units head (with no damage)

That is not suppose to happen ^

I do not have any spells or effects that do that ^

The vine whip spell is suppose to grab the targeted unit with a drain life effect and fling the targeted unit through the air, hurting it....

I am so confused...

I have already checked the code to the best of my abilities, the effect in the code looks fine to me and the dmg code looks fine (if not a bit imba)

I have imported the ability correctly, and the code never metions a buff or a dummy unit

Vine whip code:

JASS:
//===========================================================================================
//Vine Whip
//by Paskovich
//
//Needed objects:
// - a unit targetted spell (like Storm Bolt), but better base it on Channel. (Or simply copy
//   my spell from the object editor.)
// 
//To implement the spell, copy and paste this trigger to your map.
//Change the datas below as they are written there.
//You will also need the Local Handle Vars and the other functions(!!!),
//so copy the script from the custom script window!
//Please give me a credit if you use this spell on your map!
//
//*UPDATE*
//  - New header: Vine_Whip_LightningEffect to set the lightning easily
//  - New header: Vine_Whip_DamageDisplay if you don't want the damage to be displayed
//============================================================================================

function Trig_Vine_Whip_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A007'  //Raw code of your ability.
endfunction

function Vine_Whip_Speed takes nothing returns real
    local real speed = 1.0   //Speed of the throwing. (default 1.0)
    return 24.0 * speed
endfunction
function Vine_Whip_PlusRange takes nothing returns real
    return 150.0   //This is the offset from the caster where the target lands. (default 150.0)   
endfunction
function Vine_Whip_LightningEffect takes nothing returns string
//============================================================================================
//Lightning effects:    LEAS - Aerial Shackles
//			CLBP - Chain Lightning Primary
//			CLSB - Chain Lightning Secondary
//			DRAL - Drain Life (default)
//			DRAB - Drain Life and Mana
//			DRAM - Drain Mana
//			AFOD - Finger Of Death
//			FORK - Forked Lightning
//			HWPB - Healing Wave Primary
//			HWSB - Healing Wave Secondary
//			CHIM - Lightning Attack
//			MBUR - Mana Burn
//			MFBP - Mana Flare
//			SPLK - Spirit Link
//============================================================================================
    return "DRAL"  
endfunction

function Vine_Whip_DamageDependOnHeight takes nothing returns boolean
//============================================================================================
//If this is set to true, the damage will also depend on the unit's reached maximum height 
//while in the air.
//
//Important: the maximum height that can be reached is ~440, the minimum is ~160!
//Note: The height depends on the initial distance between the caster and target. 
//============================================================================================
    return true 
endfunction

function Vine_Whip_DamageModifier takes nothing returns real
//============================================================================================
//A little math required to understand:
//
//If Vine_Whip_DamageDependOnHeight is set to false:
//Vine_Whip_InitialDamage + Vine_Whip_BonusDamagePerLevel * Abilitylevel ==> Normal Damage
//
//But if Vine_Whip_DamageDependOnHeight is set to true:
//Damage = (Normal Damage * reached height) / Vine_Whip_DamageModifier
//
//If we count with a level 3 ability, then
//Maximum damage reachable =   325             *          440  / 330.0               ~    433
//                              |                          |
//                               -> the damage normally     -> maximum reachable height
//Minimum damage is 213.
//I recommend to leave this value at its default, and experiment with Vine_Whip_InitialDamage 
//and Vine_Whip_BonusDamagePerLevel.
//============================================================================================
    return 330.0 
endfunction

constant function Vine_Whip_InitialDamage takes nothing returns real
    return 100.0   //Damage = InitialDamage + (BonusDamagePerLevel * level of ability)
endfunction
constant function Vine_Whip_BonusDamagePerLevel takes nothing returns real
    return 75.0   //Damage = InitialDamage + (BonusDamagePerLevel * level of ability)
endfunction
function Vine_Whip_DamageDisplay takes nothing returns boolean
    return true   //Set this to false if you don't want the damage to be displayed on the screen.
endfunction





function Vine_Whip_ThrowUnit takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit ctr = GetHandleUnit(t, "caster")
    local unit trg = GetHandleUnit(t, "target")
    local real maxD = GetHandleReal(t, "maxDist")
    local real curD = GetHandleReal(t, "curDist")
    local real ang = GetHandleReal(t, "angle")
    local real hgt = GetParabolaHeight(maxD-curD, maxD, 1.8)
    local lightning l = GetHandleLightning(t, "light")
    local integer c = GetHandleInt(t, "times")
    local texttag tt
    local real dmg
    //Set the unit's position    
    call SetUnitPosition(trg, PolarProjectionX(GetUnitX(trg), Vine_Whip_Speed(), ang), PolarProjectionY(GetUnitY(trg), Vine_Whip_Speed(), ang))
    call SetUnitFlyHeight(trg, hgt, 0)
    //Get the max height reached
    if hgt > GetHandleReal(t, "maxH") then
        call SetHandleReal(t, "maxH", hgt)
    endif
    //Create the next lightning 
    call DestroyLightning(l)
    call SetHandleHandle(t, "light", AddLightningEx(Vine_Whip_LightningEffect(), false, GetUnitX(ctr), GetUnitY(ctr), GetUnitFlyHeight(ctr), GetUnitX(trg), GetUnitY(trg), GetUnitFlyHeight(trg)))
    //Set the next distance, +1 to the counter
    call SetHandleReal(t, "curDist", curD - Vine_Whip_Speed())
    call SetHandleInt(t, "times", c + 1)
    //Check if the counter reached the required value - destroy timer    
    if c > (maxD/Vine_Whip_Speed()) then
        call PauseTimer(t)
//      call DisplayTextToPlayer(Player(0), 0, 0, R2S(GetHandleReal(t, "maxH")))  //Displays the maximum height.
        call DestroyLightning(GetHandleLightning(t, "light"))
        set dmg = Vine_Whip_InitialDamage() + Vine_Whip_BonusDamagePerLevel() * GetHandleInt(t, "level")
        if Vine_Whip_DamageDependOnHeight() then
            set dmg = (dmg*GetHandleReal(t, "maxH"))/Vine_Whip_DamageModifier()
            if Vine_Whip_DamageDisplay() then
				set tt = CreateTextTagUnitBJ(R2S(R2I(dmg)*1), trg, 20, 10, 0, 255, 0, 0)
            	call SetTextTagVelocityBJ(tt, 64, 90)
            	call SetTextTagPermanent( tt, false )
            	call SetTextTagLifespan( tt, 1.00 )
            	call SetTextTagFadepoint( tt, 0.50 )
    		endif
        endif
        call UnitDamageTarget(ctr, trg, dmg, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
        call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl", GetUnitX(trg), GetUnitY(trg)))
        call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl", GetUnitX(trg), GetUnitY(trg)))
        call TerrainDeformCrater( GetUnitX(trg), GetUnitY(trg), 256.00, 34.00, R2I(0.05*1000), false) 
        call SetUnitPathing(trg, true)
         
        call FlushHandleLocals(t)
        set trg = null
        set ctr = null
        set t = null
        call DestroyTimer(t)
    endif
    
    set trg = null
    set ctr = null
    set t = null    
endfunction

function Trig_Vine_Whip_Actions takes nothing returns nothing
    local unit ctr  = GetTriggerUnit()
    local unit trg  = GetSpellTargetUnit()
    local timer t   = CreateTimer()
    local real dist = DistanceBetweenUnits(ctr, trg)
    local real ang  = AngleBetweenUnits(trg, ctr)
    //Store th caster and the target, create the first lightning       
    call SetHandleHandle(t, "caster", ctr)
    call SetHandleHandle(t, "target", trg)
    call SetHandleHandle(t, "light", AddLightningEx(Vine_Whip_LightningEffect(), false, GetUnitX(ctr), GetUnitY(ctr), GetUnitFlyHeight(ctr), GetUnitX(trg), GetUnitY(trg), GetUnitFlyHeight(trg)))
    
    //Throwning the unit
    call SetUnitPathing(trg, false)
    call SetHandleReal(t, "maxDist", dist + Vine_Whip_PlusRange())
    call SetHandleReal(t, "curDist", dist + Vine_Whip_PlusRange())
    call SetHandleReal(t, "angle", ang)    
    call SetHandleReal(t, "maxH", 0)
    call SetHandleInt(t, "level", GetUnitAbilityLevel(ctr, GetSpellAbilityId()))
    call SetHandleInt(t, "times", 0)
    call UnitAddAbility(trg, 'Arav')
    call UnitRemoveAbility(trg, 'Arav')    
    call TimerStart(t, 0.02, true, function Vine_Whip_ThrowUnit)
    
    set ctr = null
    set trg = null
    set t = null    
endfunction

//===========================================================================
function InitTrig_Vine_Whip takes nothing returns nothing
    set gg_trg_Vine_Whip = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Vine_Whip, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Vine_Whip, Condition( function Trig_Vine_Whip_Conditions ) )
    call TriggerAddAction( gg_trg_Vine_Whip, function Trig_Vine_Whip_Actions )
endfunction
 
Level 11
Joined
Jul 12, 2005
Messages
764
You have to set the raw code of YOUR ability in this field:
JASS:
function Trig_Vine_Whip_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A007'  //Raw code of your ability.
endfunction
Replace A007 to the proper one.
To check an ability's raw code, press Ctrl+D in the object editor.
 
Status
Not open for further replies.
Top