• 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.

[vJASS] timer bugs up ?

Status
Not open for further replies.
can anyone tell me y this timer bugs up here is the whole trigger. it spawns 2 units immediately completely ignoring the timer. it should spawn 10 units the variable tht ends the loop is set in another trigger. it does set correctly.
Note the timer dialog is just to show me if it works it will be removed after everything works
JASS:
scope UnitSpawnAll initializer Unit_Spawn_all_Lvls

globals
    trigger trg_UnitSpawnsAll
    boolean array Unit_Spawns_Player
    integer array EnemiesAlive_Counter_Player
    boolean array Boss_Add_Mana_Boolean_Player
    integer array Boss_Bonus_Counter
    integer array Damage_Boss_Round_Count_Player
    unit array Unit_Spawns_Red
    unit array Unit_Spawns_Blue
    private timer array unitSpawnsTimerPlayer
    private integer array LoopIntPlayer
    private real array x
    private real array y
endglobals

private function conditions takes nothing returns boolean
    return Unit_Spawns_Player[GetPlayerId(GetTriggerPlayer())] == true
endfunction

private function BattlegroundSpawns takes integer ub, integer bs, integer p returns nothing
    local real bx = GetRectCenterX(gg_rct_P11_Battleground_Spawn)
    local real by = GetRectCenterY(gg_rct_P11_Battleground_Spawn)
    local integer Loop = 1
    local unit u
    local integer T
    loop
        exitwhen Loop > bs
        set u = CreateUnit(Player(11), ub, bx, by, 0)
        call GroupAddUnit(Battlegrounds_Group_Player[11], u)
        call SetHeroLevel( u, Round_Player, false ) // Round_Player[i]
        set T = GetHeroInt( u, true )
        if T < 20 then
        elseif T >= 20 then 
            call UnitAddAbility( u, 'ACev' )
            call SetUnitAbilityLevel(  u, 'ACev', ( T / 20 ) )
        elseif T >= 2000 then
            call UnitAddAbility( u, 'ACev' )
            call SetUnitAbilityLevel(  u, 'ACev', 99 )
        endif
        set Loop = Loop + 1
    endloop
    set u = null
endfunction

private function UnitSpawns takes integer p returns nothing
    local multiboarditem mbi
    local string color = "|r"
    local integer us
    local integer ub
    local integer bs
    set LoopIntPlayer = LoopIntPlayer + 1
    if ( Round_Player <= 31) then
        set us = Unit_Runner_Spawn[Round_Player]
        set ub = Battlegrounds_Spawn[Round_Player]
        set bs = 1
    else
        set us = Unit_Runner_Spawn[31]
        set ub = Battlegrounds_Spawn[31]
        set bs = 2
    endif 
    if p == 0 then
        set Unit_Spawns_Red[LoopIntPlayer] = CreateUnit(Player(11), us, x[0], y[0], 0)
        call GroupAddUnit(Unit_Spawns_Group_Player, Unit_Spawns_Red[LoopIntPlayer])
        call SetHeroLevel( Unit_Spawns_Red[LoopIntPlayer], ( Round_Player - 30 ), false )
    elseif p == 1 then
        set Unit_Spawns_Blue[LoopIntPlayer] = CreateUnit(Player(11), us, x[1], y[1], 0)
        call GroupAddUnit(Unit_Spawns_Group_Player, Unit_Spawns_Blue[LoopIntPlayer])
        call SetHeroLevel( Unit_Spawns_Blue[LoopIntPlayer], ( Round_Player - 30 ), false )
    endif
    set EnemiesAlive_Player = ( EnemiesAlive_Player + 1 ) //multiboard variable enemies alive
    set mbi = MultiboardGetItem( gamescoresMultiboard, 5, (p+1) )
    call MultiboardSetItemValue( mbi, playerColors + I2S(EnemiesAlive_Player) + color )
    call BattlegroundSpawns( ub, bs, p)
    call text( I2S(LoopIntPlayer), p)
    if LoopIntPlayer > Number_Of_Unit_Spawns_Player then
        set LoopIntPlayer = 0
        call PauseTimer( unitSpawnsTimerPlayer)
    endif
    set mbi = null
    set color = null
endfunction

private function p0 takes nothing returns nothing
    call UnitSpawns( 0)
endfunction

private function p1 takes nothing returns nothing
    call UnitSpawns( 1)
endfunction

private function Actions takes nothing returns nothing
    local multiboarditem mbi
    local string color = "|r"
    local integer p = GetPlayerId( GetTriggerPlayer())
    local timerdialog td
    call text( "actions", 0)
    set Unit_Spawns_Player = false
    set Damage_Boss_Round_Count_Player = Damage_Boss_Round_Count_Player + 1
    set EnemiesAlive_Counter_Player = Number_Of_Unit_Spawns_Player[0]//#of unit spawns is a selected number of spawns in the game
    set Boss_Bonus_Counter = Boss_Bonus_Counter + 1//used for giving players mana to summon a boss
    set Round_Player = Round_Player + 1
    set mbi = MultiboardGetItem( gamescoresMultiboard, 1, (p+1) )
    call MultiboardSetItemValue( mbi, playerColors + I2S(Round_Player) + color )
    if ( Boss_Bonus_Counter == 5 ) then
        set Boss_Add_Mana_Boolean_Player = true
        set Boss_Bonus_Counter = 0
    endif
    set td = CreateTimerDialog( unitSpawnsTimerPlayer)
    call ResumeTimer( unitSpawnsTimerPlayer)
    call TimerDialogDisplay( td, true)
    set mbi = null
    set color = null
endfunction

private function startup takes nothing returns nothing
    call TriggerClearActions( trg_UnitSpawnsAll)
    call TriggerAddAction( trg_UnitSpawnsAll, function Actions )
    call text( "startup", 0)
    set x[0] = GetRectCenterX(gg_rct_red_start)
    set y[0] = GetRectCenterY(gg_rct_red_start)
    set x[1] = GetRectCenterX(gg_rct_blue_start)
    set y[1] = GetRectCenterY(gg_rct_blue_start)
    set unitSpawnsTimerPlayer[0] = CreateTimer()
    set LoopIntPlayer[0] = 0
    call TimerStart( unitSpawnsTimerPlayer[0], Spawn_Speed_Player[0], true, function p0)
    call PauseTimer( unitSpawnsTimerPlayer[0])
endfunction

//===========================================================================
function Unit_Spawn_all_Lvls takes nothing returns nothing
    set trg_UnitSpawnsAll = CreateTrigger()
    call startup()
    call TriggerAddCondition( trg_UnitSpawnsAll, Condition( function conditions ) )
    call TriggerRegisterPlayerEvent( trg_UnitSpawnsAll, Player(0), EVENT_PLAYER_END_CINEMATIC)
    call TriggerRegisterPlayerEvent( trg_UnitSpawnsAll, Player(1), EVENT_PLAYER_END_CINEMATIC)
endfunction

endscope

JASS:
scope UnitSpawnAll initializer Unit_Spawn_all_Lvls

globals
    trigger trg_UnitSpawnsAll
    boolean array Unit_Spawns_Player
    integer array EnemiesAlive_Counter_Player
    boolean array Boss_Add_Mana_Boolean_Player
    integer array Boss_Bonus_Counter
    integer array Damage_Boss_Round_Count_Player
    group array Unit_Spawns_Group_Player // group for detecting units used in moving from region to region and in P1 kills and P1 spawn 
    private integer array handleID
    private integer array LoopIntPlayer
    private real array spawnx
    private real array spawny
    private integer array Unit_Runner_Spawn
    private integer array Battlegrounds_Spawn
    private real bx
    private real by
endglobals

private function BattlegroundSpawns takes integer ub, integer bs, integer p returns nothing
    local integer Loop = 1
    local unit u
    local integer T
    loop
        exitwhen Loop > bs
        call texti( Loop)
        set u = CreateUnit(Player(11), ub, bx, by, 0)
        call GroupAddUnit(Battlegrounds_Group_Player[11], u)
        call SetHeroLevel( u, Round_Player, false ) // Round_Player
        set T = GetHeroInt( u, true )
        if T >= 2000 then
            call UnitAddAbility( u, 'ACev' )
            call SetUnitAbilityLevel(  u, 'ACev', 99 )
        elseif T >= 20 then
            call UnitAddAbility( u, 'ACev' )
            call SetUnitAbilityLevel(  u, 'ACev', ( T / 20 ) )
        endif
        set Loop = Loop + 1
    endloop
    set u = null
endfunction

private function whichTimer takes timer t returns integer
    local integer i = 0
    local integer h = GetHandleId( t)
    set t = null
    loop
        exitwhen i > 3
        if handleID[i] == h then
            return i
        endif
        set i = i + 1
    endloop
    return 11
endfunction

private function UnitSpawns takes nothing returns nothing
    local multiboarditem mbi
    local integer us
    local integer ub
    local integer bs
    local timer t = GetExpiredTimer()
    local integer p = whichTimer( t)
    local unit u
    set LoopIntPlayer = LoopIntPlayer + 1
    if ( Round_Player < 31) then
        set us = Unit_Runner_Spawn[Round_Player]
        set ub = Battlegrounds_Spawn[Round_Player]
        set bs = 1
    else
        set us = Unit_Runner_Spawn[31]
        set ub = Battlegrounds_Spawn[30]
        set bs = 2
    endif 
    set u = CreateUnit( Player(11), us, spawnx, spawny, 0)
    call GroupAddUnit(Unit_Spawns_Group_Player, u)
    call SetHeroLevel( u, ( Round_Player - 30 ), false )
    set EnemiesAlive_Player = EnemiesAlive_Player + 1 //multiboard variable enemies alive
    set mbi = MultiboardGetItem( gamescoresMultiboard, 5, (p+1) )
    call MultiboardSetItemValue( mbi, playerColors + I2S(EnemiesAlive_Player) + color )
    call MultiboardReleaseItem( mbi)
    call BattlegroundSpawns( ub, bs, p)
    if LoopIntPlayer > Number_Of_Unit_Spawns_Player then
        set LoopIntPlayer = 1
        call PauseTimer( t)
        call DestroyTimer( t)
    endif
    set mbi = null
    set t = null
endfunction

private function Actions takes nothing returns nothing
    local multiboarditem mbi
    local integer p = GetPlayerId( GetTriggerPlayer())
    set Unit_Spawns_Player = false
    set Damage_Boss_Round_Count_Player = Damage_Boss_Round_Count_Player + 1
    set EnemiesAlive_Counter_Player = Number_Of_Unit_Spawns_Player[0]//#of unit spawns is a selected number of spawns in the game
    set Boss_Bonus_Counter = Boss_Bonus_Counter + 1//used for giving players mana to summon a boss
    set Round_Player = Round_Player + 1
    set mbi = MultiboardGetItem( gamescoresMultiboard, 1, (p+1) )
    call MultiboardSetItemValue( mbi, playerColors + I2S(Round_Player) + color )
    call MultiboardReleaseItem( mbi)
    if Boss_Bonus_Counter == 5 then
        set Boss_Add_Mana_Boolean_Player = true
        set Boss_Bonus_Counter = 0
    endif
    set mbi = null
endfunction

private function timersetup takes nothing returns nothing
    local timer t
    local integer p = GetPlayerId( GetTriggerPlayer())
    local integer i
    call Actions()
    set t = CreateTimer()
    set i = GetHandleId( t)
    set handleID = i
    call TimerStart( t, Spawn_Speed_Player, true, function UnitSpawns)
    set t = null
endfunction

private function Runners takes nothing returns nothing
    local integer Loop = 0
    set bx = GetRectCenterX(gg_rct_P11_Battleground_Spawn)
    set by = GetRectCenterY(gg_rct_P11_Battleground_Spawn)
    loop
        exitwhen Loop > 1
        set Battlegrounds_Group_Player[Loop] = CreateGroup()
        set Unit_Spawns_Group_Player[Loop] = CreateGroup()
        set Unit_Bosses_Group_Player[Loop] = CreateGroup()
        set Loop = Loop + 1
    endloop
    set Battlegrounds_Group_Player[11] = CreateGroup()
    //the enemy runners for all players
    set Unit_Runner_Spawn[1] = 'h00C'
    set Unit_Runner_Spawn[2] = 'h01Y'
    set Unit_Runner_Spawn[3] = 'h01Z'
    set Unit_Runner_Spawn[4] = 'h020'
    set Unit_Runner_Spawn[5] = 'h021'
    set Unit_Runner_Spawn[6] = 'h022'
    set Unit_Runner_Spawn[7] = 'h023'
    set Unit_Runner_Spawn[8] = 'h024'
    set Unit_Runner_Spawn[9] = 'h025'
    set Unit_Runner_Spawn[10] = 'h026'
    set Unit_Runner_Spawn[11] = 'h027'
    set Unit_Runner_Spawn[12] = 'h028'
    set Unit_Runner_Spawn[13] = 'h029'
    set Unit_Runner_Spawn[14] = 'h02A'
    set Unit_Runner_Spawn[15] = 'h02B'
    set Unit_Runner_Spawn[16] = 'h02C'
    set Unit_Runner_Spawn[17] = 'h02D'
    set Unit_Runner_Spawn[18] = 'h02E'
    set Unit_Runner_Spawn[19] = 'h02F'
    set Unit_Runner_Spawn[20] = 'h02G'
    set Unit_Runner_Spawn[21] = 'h02H'
    set Unit_Runner_Spawn[22] = 'h02I'
    set Unit_Runner_Spawn[23] = 'h02J'
    set Unit_Runner_Spawn[24] = 'h02K'
    set Unit_Runner_Spawn[25] = 'h02L'
    set Unit_Runner_Spawn[26] = 'h02M'
    set Unit_Runner_Spawn[27] = 'h02N'
    set Unit_Runner_Spawn[28] = 'h02O'
    set Unit_Runner_Spawn[29] = 'h02P'
    set Unit_Runner_Spawn[30] = 'h02Q'
    set Unit_Runner_Spawn[31] = 'U00A'
// battleground unit spawns
    set Battlegrounds_Spawn[1] = 'E008'
    set Battlegrounds_Spawn[2] = 'E009'
    set Battlegrounds_Spawn[3] = 'E00B'
    set Battlegrounds_Spawn[4] = 'H05M'
    set Battlegrounds_Spawn[5] = 'N019'
    set Battlegrounds_Spawn[6] = 'N01H'
    set Battlegrounds_Spawn[7] = 'O003'
    set Battlegrounds_Spawn[8] = 'O004'
    set Battlegrounds_Spawn[9] = 'N017'
    set Battlegrounds_Spawn[10] = 'N018'
    set Battlegrounds_Spawn[11] = 'H05P'
    set Battlegrounds_Spawn[12] = 'N016'
    set Battlegrounds_Spawn[13] = 'O005'
    set Battlegrounds_Spawn[14] = 'N01J'
    set Battlegrounds_Spawn[15] = 'N01I'
    set Battlegrounds_Spawn[16] = 'O002'
    set Battlegrounds_Spawn[17] = 'U00M'
    set Battlegrounds_Spawn[18] = 'U00L'
    set Battlegrounds_Spawn[19] = 'U00O'
    set Battlegrounds_Spawn[20] = 'U00N'
    set Battlegrounds_Spawn[21] = 'N01A'
    set Battlegrounds_Spawn[22] = 'H05Q'
    set Battlegrounds_Spawn[23] = 'H05N'
    set Battlegrounds_Spawn[24] = 'E00A'
    set Battlegrounds_Spawn[25] = 'N01B'
    set Battlegrounds_Spawn[26] = 'N01C'
    set Battlegrounds_Spawn[27] = 'N01G'
    set Battlegrounds_Spawn[28] = 'N01D'
    set Battlegrounds_Spawn[29] = 'N01E'
    set Battlegrounds_Spawn[30] = 'N01F'
endfunction 

private function startup takes nothing returns nothing
    call Runners()
    set spawnx[0] = GetRectCenterX(gg_rct_red_start)
    set spawny[0] = GetRectCenterY(gg_rct_red_start)
    set spawnx[1] = GetRectCenterX(gg_rct_blue_start)
    set spawny[1] = GetRectCenterY(gg_rct_blue_start)
    set LoopIntPlayer[0] = 1
    set LoopIntPlayer[1] = 1
    set LoopIntPlayer[2] = 1
    set LoopIntPlayer[3] = 1
    call TriggerClearActions( trg_UnitSpawnsAll)
    call TriggerAddAction( trg_UnitSpawnsAll, function timersetup)
endfunction

private function conditions takes nothing returns boolean
    local integer p = GetPlayerId(GetTriggerPlayer())
    return Unit_Spawns_Player == true and TimerGetRemaining( RandomEventsTimer) > (Number_Of_Unit_Spawns_Player*Spawn_Speed_Player)
endfunction

//===========================================================================
function Unit_Spawn_all_Lvls takes nothing returns nothing
    set trg_UnitSpawnsAll = CreateTrigger()
    call startup()
    call TriggerAddCondition( trg_UnitSpawnsAll, Condition( function conditions ) )
    call TriggerRegisterPlayerEvent( trg_UnitSpawnsAll, Player(0), EVENT_PLAYER_END_CINEMATIC)
    call TriggerRegisterPlayerEvent( trg_UnitSpawnsAll, Player(1), EVENT_PLAYER_END_CINEMATIC)
    call TriggerRegisterPlayerEvent( trg_UnitSpawnsAll, Player(2), EVENT_PLAYER_END_CINEMATIC)
    call TriggerRegisterPlayerEvent( trg_UnitSpawnsAll, Player(3), EVENT_PLAYER_END_CINEMATIC)
endfunction

endscope
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
You cannot pause perodic timers. Doing so causes their perodic flag to be lost. If you then resume the timer it will act like a once off timer.

You need to pause the timer but instead of resuming it you restart the timer. Yes it is more messy and slower but the only way to resume without losing the perodic nature to be lost.

Your startup also only starts a timer for player 0. If any other player uses the system it will try and pause timers that do not exist and have not been started. This may result in a thread crash.
 
Ok about the other players I just didn't make them yet and thts odd about pausing periodic timers how do I restart them is there a function for it ? I have other timers tht I pause in my map tht r periodic and I never ran across this problem yet lol thts y it's so odd.
this way seems to work can u tell me if im leaking anything to do w timer. thx
JASS:
scope UnitSpawnAll initializer Unit_Spawn_all_Lvls

globals
    trigger trg_UnitSpawnsAll
    boolean array Unit_Spawns_Player
    integer array EnemiesAlive_Counter_Player
    boolean array Boss_Add_Mana_Boolean_Player
    integer array Boss_Bonus_Counter
    integer array Damage_Boss_Round_Count_Player
    group array Unit_Spawns_Group_Player // group for detecting units used in moving from region to region and in P1 kills and P1 spawn 
    private integer array handleID
    private integer array LoopIntPlayer
    private real array spawnx
    private real array spawny
    private integer array Unit_Runner_Spawn
    private integer array Battlegrounds_Spawn
    private real bx
    private real by
endglobals

private function BattlegroundSpawns takes integer ub, integer bs, integer p returns nothing
    local integer Loop = 1
    local unit u
    local integer T
    loop
        exitwhen Loop > bs
        call texti( Loop)
        set u = CreateUnit(Player(11), ub, bx, by, 0)
        call GroupAddUnit(Battlegrounds_Group_Player[11], u)
        call SetHeroLevel( u, Round_Player, false ) // Round_Player
        set T = GetHeroInt( u, true )
        if T >= 2000 then
            call UnitAddAbility( u, 'ACev' )
            call SetUnitAbilityLevel(  u, 'ACev', 99 )
        elseif T >= 20 then
            call UnitAddAbility( u, 'ACev' )
            call SetUnitAbilityLevel(  u, 'ACev', ( T / 20 ) )
        endif
        set Loop = Loop + 1
    endloop
    set u = null
endfunction

private function whichTimer takes timer t returns integer
    local integer i = 0
    local integer h = GetHandleId( t)
    set t = null
    loop
        exitwhen i > 3
        if handleID[i] == h then
            return i
        endif
        set i = i + 1
    endloop
    return 11
endfunction

private function UnitSpawns takes nothing returns nothing
    local multiboarditem mbi
    local integer us
    local integer ub
    local integer bs
    local timer t = GetExpiredTimer()
    local integer p = whichTimer( t)
    local unit u
    set LoopIntPlayer = LoopIntPlayer + 1
    if ( Round_Player < 31) then
        set us = Unit_Runner_Spawn[Round_Player]
        set ub = Battlegrounds_Spawn[Round_Player]
        set bs = 1
    else
        set us = Unit_Runner_Spawn[31]
        set ub = Battlegrounds_Spawn[30]
        set bs = 2
    endif 
    set u = CreateUnit( Player(11), us, spawnx, spawny, 0)
    call GroupAddUnit(Unit_Spawns_Group_Player, u)
    call SetHeroLevel( u, ( Round_Player - 30 ), false )
    set EnemiesAlive_Player = EnemiesAlive_Player + 1 //multiboard variable enemies alive
    set mbi = MultiboardGetItem( gamescoresMultiboard, 5, (p+1) )
    call MultiboardSetItemValue( mbi, playerColors + I2S(EnemiesAlive_Player) + color )
    call MultiboardReleaseItem( mbi)
    call BattlegroundSpawns( ub, bs, p)
    if LoopIntPlayer > Number_Of_Unit_Spawns_Player then
        set LoopIntPlayer = 1
        call PauseTimer( t)
        call DestroyTimer( t)
    endif
    set mbi = null
    set t = null
endfunction

private function Actions takes nothing returns nothing
    local multiboarditem mbi
    local integer p = GetPlayerId( GetTriggerPlayer())
    set Unit_Spawns_Player = false
    set Damage_Boss_Round_Count_Player = Damage_Boss_Round_Count_Player + 1
    set EnemiesAlive_Counter_Player = Number_Of_Unit_Spawns_Player[0]//#of unit spawns is a selected number of spawns in the game
    set Boss_Bonus_Counter = Boss_Bonus_Counter + 1//used for giving players mana to summon a boss
    set Round_Player = Round_Player + 1
    set mbi = MultiboardGetItem( gamescoresMultiboard, 1, (p+1) )
    call MultiboardSetItemValue( mbi, playerColors + I2S(Round_Player) + color )
    call MultiboardReleaseItem( mbi)
    if Boss_Bonus_Counter == 5 then
        set Boss_Add_Mana_Boolean_Player = true
        set Boss_Bonus_Counter = 0
    endif
    set mbi = null
endfunction

private function timersetup takes nothing returns nothing
    local timer t
    local integer p = GetPlayerId( GetTriggerPlayer())
    local integer i
    call Actions()
    set t = CreateTimer()
    set i = GetHandleId( t)
    set handleID = i
    call TimerStart( t, Spawn_Speed_Player, true, function UnitSpawns)
    set t = null
endfunction

private function Runners takes nothing returns nothing
    local integer Loop = 0
    set bx = GetRectCenterX(gg_rct_P11_Battleground_Spawn)
    set by = GetRectCenterY(gg_rct_P11_Battleground_Spawn)
    loop
        exitwhen Loop > 1
        set Battlegrounds_Group_Player[Loop] = CreateGroup()
        set Unit_Spawns_Group_Player[Loop] = CreateGroup()
        set Unit_Bosses_Group_Player[Loop] = CreateGroup()
        set Loop = Loop + 1
    endloop
    set Battlegrounds_Group_Player[11] = CreateGroup()
    //the enemy runners for all players
    set Unit_Runner_Spawn[1] = 'h00C'
    set Unit_Runner_Spawn[2] = 'h01Y'
    set Unit_Runner_Spawn[3] = 'h01Z'
    set Unit_Runner_Spawn[4] = 'h020'
    set Unit_Runner_Spawn[5] = 'h021'
    set Unit_Runner_Spawn[6] = 'h022'
    set Unit_Runner_Spawn[7] = 'h023'
    set Unit_Runner_Spawn[8] = 'h024'
    set Unit_Runner_Spawn[9] = 'h025'
    set Unit_Runner_Spawn[10] = 'h026'
    set Unit_Runner_Spawn[11] = 'h027'
    set Unit_Runner_Spawn[12] = 'h028'
    set Unit_Runner_Spawn[13] = 'h029'
    set Unit_Runner_Spawn[14] = 'h02A'
    set Unit_Runner_Spawn[15] = 'h02B'
    set Unit_Runner_Spawn[16] = 'h02C'
    set Unit_Runner_Spawn[17] = 'h02D'
    set Unit_Runner_Spawn[18] = 'h02E'
    set Unit_Runner_Spawn[19] = 'h02F'
    set Unit_Runner_Spawn[20] = 'h02G'
    set Unit_Runner_Spawn[21] = 'h02H'
    set Unit_Runner_Spawn[22] = 'h02I'
    set Unit_Runner_Spawn[23] = 'h02J'
    set Unit_Runner_Spawn[24] = 'h02K'
    set Unit_Runner_Spawn[25] = 'h02L'
    set Unit_Runner_Spawn[26] = 'h02M'
    set Unit_Runner_Spawn[27] = 'h02N'
    set Unit_Runner_Spawn[28] = 'h02O'
    set Unit_Runner_Spawn[29] = 'h02P'
    set Unit_Runner_Spawn[30] = 'h02Q'
    set Unit_Runner_Spawn[31] = 'U00A'
// battleground unit spawns
    set Battlegrounds_Spawn[1] = 'E008'
    set Battlegrounds_Spawn[2] = 'E009'
    set Battlegrounds_Spawn[3] = 'E00B'
    set Battlegrounds_Spawn[4] = 'H05M'
    set Battlegrounds_Spawn[5] = 'N019'
    set Battlegrounds_Spawn[6] = 'N01H'
    set Battlegrounds_Spawn[7] = 'O003'
    set Battlegrounds_Spawn[8] = 'O004'
    set Battlegrounds_Spawn[9] = 'N017'
    set Battlegrounds_Spawn[10] = 'N018'
    set Battlegrounds_Spawn[11] = 'H05P'
    set Battlegrounds_Spawn[12] = 'N016'
    set Battlegrounds_Spawn[13] = 'O005'
    set Battlegrounds_Spawn[14] = 'N01J'
    set Battlegrounds_Spawn[15] = 'N01I'
    set Battlegrounds_Spawn[16] = 'O002'
    set Battlegrounds_Spawn[17] = 'U00M'
    set Battlegrounds_Spawn[18] = 'U00L'
    set Battlegrounds_Spawn[19] = 'U00O'
    set Battlegrounds_Spawn[20] = 'U00N'
    set Battlegrounds_Spawn[21] = 'N01A'
    set Battlegrounds_Spawn[22] = 'H05Q'
    set Battlegrounds_Spawn[23] = 'H05N'
    set Battlegrounds_Spawn[24] = 'E00A'
    set Battlegrounds_Spawn[25] = 'N01B'
    set Battlegrounds_Spawn[26] = 'N01C'
    set Battlegrounds_Spawn[27] = 'N01G'
    set Battlegrounds_Spawn[28] = 'N01D'
    set Battlegrounds_Spawn[29] = 'N01E'
    set Battlegrounds_Spawn[30] = 'N01F'
endfunction 

private function startup takes nothing returns nothing
    call Runners()
    set spawnx[0] = GetRectCenterX(gg_rct_red_start)
    set spawny[0] = GetRectCenterY(gg_rct_red_start)
    set spawnx[1] = GetRectCenterX(gg_rct_blue_start)
    set spawny[1] = GetRectCenterY(gg_rct_blue_start)
    set LoopIntPlayer[0] = 1
    set LoopIntPlayer[1] = 1
    set LoopIntPlayer[2] = 1
    set LoopIntPlayer[3] = 1
    call TriggerClearActions( trg_UnitSpawnsAll)
    call TriggerAddAction( trg_UnitSpawnsAll, function timersetup)
endfunction

private function conditions takes nothing returns boolean
    local integer p = GetPlayerId(GetTriggerPlayer())
    return Unit_Spawns_Player == true and TimerGetRemaining( RandomEventsTimer) > (Number_Of_Unit_Spawns_Player*Spawn_Speed_Player)
endfunction

//===========================================================================
function Unit_Spawn_all_Lvls takes nothing returns nothing
    set trg_UnitSpawnsAll = CreateTrigger()
    call startup()
    call TriggerAddCondition( trg_UnitSpawnsAll, Condition( function conditions ) )
    call TriggerRegisterPlayerEvent( trg_UnitSpawnsAll, Player(0), EVENT_PLAYER_END_CINEMATIC)
    call TriggerRegisterPlayerEvent( trg_UnitSpawnsAll, Player(1), EVENT_PLAYER_END_CINEMATIC)
    call TriggerRegisterPlayerEvent( trg_UnitSpawnsAll, Player(2), EVENT_PLAYER_END_CINEMATIC)
    call TriggerRegisterPlayerEvent( trg_UnitSpawnsAll, Player(3), EVENT_PLAYER_END_CINEMATIC)
endfunction

endscope
 
Last edited:
Status
Not open for further replies.
Top