• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Local handle help? (new to jass)

Status
Not open for further replies.
Level 6
Joined
Sep 9, 2006
Messages
92
So im trying to make a spell that uses kattana's local handle scripts, however i, 1, cant come across an original one directly from kattana and 2, whenever i try to copy others, i get compile errors (i have tried 2 different sources, and the first error on the list is in:
JASS:
function H2I takes handle h returns integer
    return h
    return 0
endfunction

JASS:
    return 0
Invalid type for specified operator)

I just need to learn how to use the system, and, does it require some other thing? (such as vjass or whatever, i just use the normal editor)
 
Level 6
Joined
Sep 9, 2006
Messages
92
Heres the rest of the code; the bottom portion was specific to the spells in the spellpack i got this from
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 game_cache takes nothing returns gamecache   
    if (udg_gamecache==null) then
        call FlushGameCache(InitGameCache("hax.w3v"))
        set udg_gamecache=InitGameCache("hax.w3v")
    endif
    return udg_gamecache
endfunction
 
function SetHandleHandle takes handle subject, string name, handle value returns nothing
    if value==null then
        call FlushStoredInteger(game_cache(),I2S(H2I(subject)),name)
    else
        call StoreInteger(game_cache(), 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(game_cache(),I2S(H2I(subject)),name)
    else
        call StoreInteger(game_cache(), I2S(H2I(subject)), name, value)
    endif
endfunction
 
function SetHandleReal takes handle subject, string name, real value returns nothing
    if value==0 then
        call FlushStoredReal(game_cache(), I2S(H2I(subject)), name)
    else
        call StoreReal(game_cache(), I2S(H2I(subject)), name, value)
    endif
endfunction
 
function SetHandleString takes handle subject, string name, string value returns nothing
    if value==null then
        call FlushStoredString(game_cache(), I2S(H2I(subject)), name)
    else
        call StoreString(game_cache(), I2S(H2I(subject)), name, value)
    endif
endfunction

function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
    if value==null then
        call FlushStoredBoolean(game_cache(), I2S(H2I(subject)), name)
    else
        call StoreBoolean(game_cache(), I2S(H2I(subject)), name, value)
    endif
endfunction
 
function GetHandleHandle takes handle subject, string name returns handle
    return GetStoredInteger(game_cache(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
    return GetStoredInteger(game_cache(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
    return GetStoredReal(game_cache(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
    return GetStoredString(game_cache(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
    return GetStoredBoolean(game_cache(), I2S(H2I(subject)), name)
endfunction
function GetHandleItem takes handle subject, string name returns item
    return GetStoredInteger(game_cache(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleUnit takes handle subject, string name returns unit
    return GetStoredInteger(game_cache(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandlePlayer takes handle subject, string name returns player
    return GetStoredInteger(game_cache(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
    return GetStoredInteger(game_cache(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleDialog takes handle subject, string name returns dialog
    return GetStoredInteger(game_cache(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
    return GetStoredInteger(game_cache(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
    return GetStoredInteger(game_cache(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleFogModifier takes handle subject, string name returns fogmodifier
    return GetStoredInteger(game_cache(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTextTag takes handle subject, string name returns texttag
    return GetStoredInteger(game_cache(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleLoc takes handle subject, string name returns location
    return GetStoredInteger(game_cache(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
    return GetStoredInteger(game_cache(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleLight takes handle subject, string name returns lightning
    return GetStoredInteger(game_cache(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleSound takes handle subject, string name returns sound
    return GetStoredInteger(game_cache(), I2S(H2I(subject)), name)
    return null
endfunction
 
function FlushHandleLocals takes handle subject returns nothing
    call FlushStoredMission(game_cache(), 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
 
Status
Not open for further replies.
Top