HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Scope Error

06-06-2009, 07:25 PM#1
l46kok
Collapse JASS:
scope Moonwell initializer Moonwell_Init
    function Moonwell_Death takes nothing returns nothing
        call KillUnit(Moonwell)
        set Moonwell = null
        set MoonwellExist = false
    endfunction

    function Moonwell_Actions takes nothing returns nothing
        //Unrelated
    endfunction

    function Moonwell_Conditions takes nothing returns boolean
        return GetSpellAbilityId() == SpellID
    endfunction

//===========================================================================
    function Moonwell_Init takes nothing returns nothing
        local trigger t = CreateTrigger(  )
        call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
        call TriggerAddCondition( t, Condition(function Moonwell_Conditions))
        call TriggerAddAction(t, function Moonwell_Actions)
    endfunction
endscope

Collapse JASS:
scope KO initializer KO_Init
    function KO_Action
    call Moonwell_Death() //FUNCTION DOES NOT CALL.
    endfunction
    function KO_Condition takes nothing returns boolean
    //Unrelated
    endfunction

//===========================================================================
    function KO_Init takes nothing returns nothing
        set gg_trg_KnockoutJ = CreateTrigger()
        call TriggerAddCondition(gg_trg_KnockoutJ, Condition(function KO_Condition))
        call TriggerAddAction(gg_trg_KnockoutJ, function KO_Action)
    endfunction
endscope

The code gives me a syntax error on the second block of jass, where I try to call the Moonwell_Death(). I've commented out all the unrelated codes. The codes are written on 2 separate triggers.

I'm 100% positive that functions can be called from outside of their scope as long as they are not declared as private but this one refuses to work.

Does anyone know why? Please help :O
06-06-2009, 10:44 PM#2
Anitarf
You can only call functions that are above the calling function in the map script. That's why we have libraries.
06-07-2009, 09:10 PM#3
Dooblivion
Do that in the regular trigger editor... much simpler
06-08-2009, 01:22 PM#4
0zyx0
Quote:
Originally Posted by Dooblivion
Do that in the regular trigger editor... much simpler
Nooo...