HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Invalid Argument Type

07-27-2007, 05:34 PM#1
Immoralis
I get an invalid arugment type at call PauseTimer(nextpale).
Theres also an expected endif for all of the following:
Anyone know whats wrong?

Collapse JASS:
        local timer nextpale = CreateTimer()
        local integer counter = 0
        local unit caster = GetSpellAbilityUnit()
      
        call SetHandleHandle(nextpale, "counter", counter)
        call SetHandleHandle(nextpale, "caster", caster)
        call TimerStart(nextpale, 0.2, true, function EndPale)
Collapse JASS:
function EndPale takes nothing returns nothing
    local timer nextpale = GetExpiredTimer()
    local integer countess = GetHandleInt(nextpale, "counter")
    local unit caster = GetHandleUnit(nextpale, "caster")
    local location point = PolarProjectionBJ(GetUnitLoc(caster), 256.00, ( GetUnitFacing(caster) + ( I2R(countess) * 16.00 ) ))
    
    call PointSFX(point,"Abilities\\Spells\\Undead\\Impale\\ImpaleMissTarget.mdl",3)
    call SetHandleHandle(nextpale, "counter", countess + 1)
    
    call PauseTimer(nextpale)
    call DestroyTimer(nextpale)
    set caster = null
    set nextpale = null
endfunction

function Trig_Spiral_Impale_Actions takes nothing returns nothing
    if (GetSpellAbilityId() == 'A004') then
        local timer nextpale = CreateTimer()
        local integer counter = 0
        local unit caster = GetSpellAbilityUnit()
      
        call SetHandleHandle(nextpale, "counter", counter)
        call SetHandleHandle(nextpale, "caster", caster)
        call TimerStart(nextpale, 0.2, true, function EndPale)
    endif
endfunction
//===========================================================================
function InitTrig_Spiral_Impale takes nothing returns nothing
    set gg_trg_Spiral_Impale = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Spiral_Impale, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddAction( gg_trg_Spiral_Impale, function Trig_Spiral_Impale_Actions )
endfunction
07-27-2007, 05:39 PM#2
Rising_Dusk
Collapse JASS:
call SetHandleHandle(nextpale, "counter", countess + 1)
SetHandleHandle(...) requires it's third argument be a handle.
Integers aren't handles.

If you want to set an integer, use SetHandleInteger(...)

You've also got this same issue later on.
Collapse JASS:
        local integer counter = 0
        local unit caster = GetSpellAbilityUnit()
      
        call SetHandleHandle(nextpale, "counter", counter)
07-27-2007, 06:02 PM#3
Immoralis
the expected endif still persists
07-27-2007, 06:11 PM#4
Rising_Dusk
Can't believe I didn't see this before...
Collapse JASS:
    if (GetSpellAbilityId() == 'A004') then
        local timer nextpale = CreateTimer()
        local integer counter = 0
        local unit caster = GetSpellAbilityUnit()
      
        call SetHandleHandle(nextpale, "counter", counter)
        call SetHandleHandle(nextpale, "caster", caster)
        call TimerStart(nextpale, 0.2, true, function EndPale)
    endif
Your locals must be declared before any other code in the function.
That means you need to move the declarations above the "if"

To look probably like this...
Collapse JASS:
    local timer nextpale = CreateTimer()
    local integer counter = 0
    local unit caster = GetSpellAbilityUnit()
        
    if (GetSpellAbilityId() == 'A004') then
        call SetHandleHandle(nextpale, "counter", counter)
        call SetHandleHandle(nextpale, "caster", caster)
        call TimerStart(nextpale, 0.2, true, function EndPale)
    endif
07-27-2007, 06:12 PM#5
PipeDream
The local block has to be the first in the function. Using PJASS will help you avoid exposing embarassing mistakes like this.