HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Expected a Function Name

01-30-2007, 02:35 AM#1
WNxCryptic
Alright, here's the correlating function definition (In the custom script area)

Collapse JASS:
//===================================================================================================
// Multiboard Update
function Trig_Multiboard_Update_Actions takes integer atimer, unit hero returns nothing
    local integer a = GetConvertedPlayerId(GetOwningPlayer(hero))
    loop
       call MultiboardSetItemValueBJ( udg_multiboard, 2, a, I2S(atimer) )
       call TriggerSleepAction( 1 )
       set atimer = atimer - 1
     exitwhen atimer == 0
    endloop
    call MultiboardSetItemValueBJ( udg_multiboard, 2, a, "" )
endfunction

function InitTrigMultiboard_Update takes nothing returns nothing
    local trigger mu = CreateTrigger(  )
    call TriggerAddAction( mu , function Trig_Multiboard_Update_Actions )
endfunction

And the function call:

Collapse JASS:
function Trig_AllianceDead_Conditions takes nothing returns boolean
    if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true ) ) then
        return false
    endif
    if ( not ( IsPlayerAlly(GetOwningPlayer(GetTriggerUnit()), Player(0)) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_AllianceDead_Actions takes nothing returns nothing
    local integer a = GetHeroLevel(GetTriggerUnit()) * 3
    set udg_multiboard_dead[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] = I2S(a)
    call Multiboard_Update(a, GetTriggerUnit())
endfunction

//===========================================================================
function InitTrig_AllianceDead takes nothing returns nothing
    set gg_trg_AllianceDead = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_AllianceDead, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_AllianceDead, Condition( function Trig_AllianceDead_Conditions ) )
    call TriggerAddAction( gg_trg_AllianceDead, function Trig_AllianceDead_Actions )
endfunction


But I get a function call problem on the line:

"call Multiboard_Update(a, GetTriggerUnit())"

This is my first attempt at writing an entire function on my own and attempting to implement it, any help would be awesome.
01-30-2007, 03:17 AM#2
Rising_Dusk
Collapse JASS:
function Trig_Multiboard_Update_Actions takes integer atimer, unit hero returns nothing
Collapse JASS:
call Multiboard_Update(a, GetTriggerUnit())
Make sure function names coincide.
01-30-2007, 03:44 AM#3
WNxCryptic
K, made the appropriate changes in both the Multiboard_Update name and the Multiboard_Update_Conditions calls.

Still get the same error message.
01-30-2007, 04:10 AM#4
Rising_Dusk
Erm...
The problem is in your second set of functions.

Collapse JASS:
function Trig_AllianceDead_Actions takes nothing returns nothing
    local integer a = GetHeroLevel(GetTriggerUnit()) * 3
    set udg_multiboard_dead[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] = I2S(a)
    call Multiboard_Update(a, GetTriggerUnit())
endfunction
This means you should do one of two things.
Change that call to call Trig_Multiboard_Update_Actions(a, GetTriggerUnit()) or change the function in the first set to Multiboard_Update
Post the updated script when you're done.
01-30-2007, 04:19 AM#5
WNxCryptic
Yep..I got rid of the "Trig_" prefix on my "Multiboard_Update" trigger and subsequently removed the InitTrigMultiboard Update trigger and the whole thing compiles fine.

Collapse JASS:
function Multiboard_Update takes integer atimer, unit hero returns nothing
    local integer a = GetConvertedPlayerId(GetOwningPlayer(hero))
    loop
       call MultiboardSetItemValueBJ( udg_multiboard, 2, a, I2S(atimer) )
       call TriggerSleepAction( 1 )
       set atimer = atimer - 1
     exitwhen atimer == 0
    endloop
    call MultiboardSetItemValueBJ( udg_multiboard, 2, a, "" )

    if IsPlayerAlly(GetOwningPlayer(hero), Player(0)) then
    call Alliance_Respawn(hero)
    elseif IsPlayerAlly(GetOwningPlayer(GetTriggerUnit()), Player(6)) then
    call Ancients_Respawn(hero)
    endif
endfunction

Collapse JASS:
function Trig_AllianceDead_Conditions takes nothing returns boolean
    return not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true )
    return not ( IsPlayerAlly(GetOwningPlayer(GetTriggerUnit()), Player(0)) == true )
    return true
endfunction

function Trig_AllianceDead_Actions takes nothing returns nothing
    local integer a = GetHeroLevel(GetTriggerUnit()) * 3
    set udg_multiboard_dead[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] = I2S(a)
    call Multiboard_Update(a, GetTriggerUnit())
endfunction

//===========================================================================
function InitTrig_AllianceDead takes nothing returns nothing
    set gg_trg_AllianceDead = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_AllianceDead, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_AllianceDead, Condition( function Trig_AllianceDead_Conditions ) )
    call TriggerAddAction( gg_trg_AllianceDead, function Trig_AllianceDead_Actions )
endfunction

One other quick thing:

Is

Collapse JASS:
    return not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true )
    return not ( IsPlayerAlly(GetOwningPlayer(GetTriggerUnit()), Player(0)) == true )

Evaluate to be the same as:

Collapse JASS:
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true ) ) then
        return false
    endif
    if ( not ( IsPlayerAlly(GetOwningPlayer(GetTriggerUnit()), Player(0)) == true ) ) then
        return false
01-30-2007, 06:16 AM#6
Captain Griffen
No. Only the first return it passes through is used.

You'll want:

Collapse JASS:
return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true and sPlayerAlly(GetOwningPlayer(GetTriggerUnit()), Player(0)) == true
01-30-2007, 04:30 PM#7
The)TideHunter(
Quote:
Originally Posted by Captain Griffen
No. Only the first return it passes through is used.

You'll want:

Collapse JASS:
return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true and sPlayerAlly(GetOwningPlayer(GetTriggerUnit()), Player(0)) == true

Collapse JASS:
return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true and IsPlayerAlly(GetOwningPlayer(GetTriggerUnit()), Player(0)) == true

Correted Typo.