• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Code returning 'Expected a Code Statement' error

Status
Not open for further replies.
Well, as the title suggests, I have some code which returns that error for no reason I know of. Here is the code:

JASS:
function Trig_EnterExitArena_Function takes nothing returns nothing
    local unit caster = GetHandleUnit( gg_trg_EnterExitArena, "Caster" )
    call PolledWait( 1 )
    local effect tele = AddSpecialEffectTarget( "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl", caster, "origin" ) //It says this line is the erronous one
    call DestroyEffect( tele )
    set tele = null
    if RectContainsUnit( gg_rct_NotArena, caster ) then
    //Todo
    endif
endfunction

function Trig_EnterExitArena_Actions takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerAddAction( t, function Trig_EnterExitArena_Function )
    call TriggerExecute( t )
    call DestroyTrigger( t )
endfunction

//===========================================================================
function InitTrig_EnterExitArena takes nothing returns nothing
    set gg_trg_EnterExitArena = CreateTrigger(  )
    call TriggerAddAction( gg_trg_EnterExitArena, function Trig_EnterExitArena_Actions )
endfunction

--Fixed

The Polled wait was making it not work. Does anyone know a way to delay it other than that?
 
Last edited:
you have a polledWait before declaring a local, that causes the error.

Write the function this way
JASS:
function Trig_EnterExitArena_Function takes nothing returns nothing   
local unit caster = GetHandleUnit( gg_trg_EnterExitArena, "Caster" )
local effect tele 
call PolledWait( 1 )
set tele = AddSpecialEffectTarget( "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl", caster, "origin" ) //It says this line is the erronous one  
//... The rest
endfunction
 
Status
Not open for further replies.
Top