HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

This is REALLY frustrating

10-30-2004, 02:42 AM#1
a thing
Code:
function GoldPart2Actions2 takes nothing returns nothing
local integer i
    // calculate how much gold each player gets
    set udg_GoldToBeGivenToTeam[1] = udg_GoldToBeGivenToTeam[1] / udg_NumberOfPlayersOnTeam[1]
    set udg_GoldToBeGivenToTeam[2] = udg_GoldToBeGivenToTeam[2] / udg_NumberOfPlayersOnTeam[2]
    // give out the gold
    set i = 1
    call msg(I2S(i))
        if PlayerIsPlaying(i) then
            call msg("test")
            call AdjustPlayerStateBJ( udg_GoldToBeGivenToTeam[1], plyer(i), PLAYER_STATE_RESOURCE_GOLD )
        endif
        set i = i + 1
    set i = 6
    loop
        exitwhen i > 10
        if PlayerIsPlaying(i) then
            call AdjustPlayerStateBJ( udg_GoldToBeGivenToTeam[2], plyer(i), PLAYER_STATE_RESOURCE_GOLD )
        endif
        set i = i + 1
    endloop
    call SetPlayerStateBJ( plyer(11), PLAYER_STATE_RESOURCE_GOLD, 0 )
    call SetPlayerStateBJ( plyer(12), PLAYER_STATE_RESOURCE_GOLD, 0 )
endfuntion

function GoldPart2Actions takes nothing returns nothing
local integer i = 1
    set udg_GoldToBeGivenToTeam[1] = GetPlayerState(plyer(11), PLAYER_STATE_RESOURCE_GOLD)
    set udg_GoldToBeGivenToTeam[2] = GetPlayerState(plyer(12), PLAYER_STATE_RESOURCE_GOLD)
    call msg(I2S(udg_GoldToBeGivenToTeam[1]))
    call msg(I2S(udg_GoldToBeGivenToTeam[2]))
    // find out how many players are on each team
    set udg_NumberOfPlayersOnTeam[1] = 0
    set udg_NumberOfPlayersOnTeam[2] = 0
    loop
        exitwhen i > 5
        if PlayerIsPlaying(i) then
            set udg_NumberOfPlayersOnTeam[1] = udg_NumberOfPlayersOnTeam[1] + 1
        endif
        set i = i + 1
    endloop
    set i = 6
    loop
        exitwhen i > 10
        if PlayerIsPlaying(i) then
            set udg_NumberOfPlayersOnTeam[2] = udg_NumberOfPlayersOnTeam[2] + 1
        endif
        set i = i + 1
    endloop
    call GoldPart2Actions2()
endfunction

//===========================================================================
function InitTrig_gold_part_2 takes nothing returns nothing
    set gg_trg_gold_part_2 = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_gold_part_2, 10.03 )
    call TriggerAddAction( gg_trg_gold_part_2, function GoldPart2Actions )
endfunction

When I save, the JASS compile errors comes up and highlights the line " call SetPlayerStateBJ(plyer(12), PLAYER_STATE_RESOURCE_GOLD, 0)" and says it "Expected 'endif'". When I put endif there WE highlights the line with endif and still says "Expected 'endif'".

The trigger actions is in two functions because it was just stopping in the middle of the trigger so I gave it a shot.
10-30-2004, 04:38 PM#2
n\/Cl34r
Quote:
Originally Posted by a thing
Code:
    call SetPlayerStateBJ( plyer(11), PLAYER_STATE_RESOURCE_GOLD, 0 )
    call SetPlayerStateBJ( plyer(12), PLAYER_STATE_RESOURCE_GOLD, 0 )

Shouldn't it say player(11) and player(12) ?
10-30-2004, 04:52 PM#3
a thing
plyer is a little function I made so I didn't have to type out ConvertedPlayer :god_help_us:

Oh yeah, I tried replacing plyer with Player and ConvertedPlayer
10-30-2004, 05:46 PM#4
n\/Cl34r
Quote:
Originally Posted by a thing
Code:
endfuntion

How about that ? And don't tell me
you've got a custom script for this
^_^
10-30-2004, 08:59 PM#5
a thing
Thanks^_^

Every time I ask for JASS help the problem is always something small like that.