HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Wgats wrong with this?

03-03-2005, 11:07 PM#1
Doomsberg
Code:
function RefreshUnitAnim takes nothing returns nothing
    local integer nAnim
    local integer nModel = GetPickModelIndex( GetUnitTypeId( udg_CameraTarget ) )

    if ( udg_MovementUp == false ) then
        set nAnim = udg_ANIM_STAND

        if ( udg_CartAnimIndex == nAnim ) then
            return
        endif

        set udg_CartAnimIndex = nAnim

        call SetUnitAnimationByIndex( udg_CameraTarget, GetModelAnimStandID( nModel ) )

        call SetUnitTimeScale( udg_CameraTarget, 5 )

    else
        set nAnim = udg_ANIM_WALK

        if ( udg_CartAnimIndex == nAnim ) then
            return
        endif

        if ( udg_CartAnimIndex != nAnim ) then
            set udg_CartAnimIndex = nAnim
            call SetUnitAnimationByIndex( udg_CameraTarget, GetModelAnimWalkID( nModel ) )
        endif

        call SetUnitTimeScale( udg_CameraTarget, 5 )
    endif
endfunction

This is some jass to keep refreshing my units animation depending on whether they are moving. When i try to save my map it keeps saying theres something wrong with it. It has 6 errors, 3 which say something about a name and 3 about endifs. To me it all seems fine with all variables declared previously etc.
If anyone has a clue whats wrong any help would be appreciated.
03-04-2005, 03:34 AM#2
Ryude
Check your InitTrig functions, sometimes you'll mess up the function names and it'll give those exact errors.
03-04-2005, 05:04 AM#3
Doomsberg
Quote:
Originally Posted by Ryude
Check your InitTrig functions, sometimes you'll mess up the function names and it'll give those exact errors.

Ok il check those. Is this the klind of problem that JASS checkers are used to find?

EDIT: Ok ive managed to fix most of it up. But i still get 2 errors, il give the whole trigger now incase its something i left out thats causing it. I also used a Jass syntax checker and it was all fine like i thought.

Code:
function Trig_Move_Fowards_Actions takes nothing returns nothing
    local integer nAnim
    local integer nModel = GetUnitTypeId( udg_CameraTarget )


    set udg_Unit_Angle = GetUnitFacing(udg_CameraTarget)
    set udg_Location = PolarProjectionBJ(GetUnitLoc(udg_CameraTarget), 2.00, udg_Unit_Angle)
    call SetUnitFacingTimed( udg_CameraTarget, udg_Unit_Angle, 0.05 )

    if ( udg_MovementUp == false ) then
        set nAnim = udg_ANIM_STAND

        if ( udg_CartAnimIndex == nAnim ) then
            return
        endif

        set udg_CartAnimIndex = nAnim

        call SetUnitAnimationByIndex( udg_CameraTarget, GetModelAnimStandID( nModel ) )

        call SetUnitTimeScale( udg_CameraTarget, 5 )

    else
        set nAnim = udg_ANIM_WALK

        if ( udg_CartAnimIndex == nAnim ) then
            return
        endif

        if ( udg_CartAnimIndex != nAnim ) then
            set udg_CartAnimIndex = nAnim
            call SetUnitAnimationByIndex( udg_CameraTarget, GetModelAnimWalkID( nModel ) )
        endif

        call SetUnitTimeScale( udg_CameraTarget, 5 )
    endif
endfunction

//===========================================================================
function InitTrig_Move_Fowards takes nothing returns nothing
    set gg_trg_Move_Fowards = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Move_Fowards, 0.02 )
    call TriggerAddAction( gg_trg_Move_Fowards, function Trig_Move_Fowards_Actions )
endfunction

The error is in the lines:
call SetUnitAnimationByIndex( udg_CameraTarget, GetModelAnimWalkID( nModel ) )
call SetUnitAnimationByIndex( udg_CameraTarget, GetModelAnimStandID( nModel ) )

Thanks in advance for all help.