HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

*More* Trigger Problems

06-13-2004, 02:24 AM#1
DoCa-Cola
Ok, I have this trigger ( See Below ) that is supposed to create 20 units at each of 8 spots. It works for the first spot, but not the other 7. Do any of you have any idea as to why this is happening?

--DoCa

Code:
function Trig_Start_Level_Actions takes nothing returns nothing 
  local integer x = 0 
  local integer i = 1 
  local location whichPoint = GetRectCenter(udg_SpawnPoints[x]) 
  local location whichTarget = GetRectCenter(udg_WorkerPoints[x]) 
 
  if ( GetPlayerSlotState(Player(x)) == PLAYER_SLOT_STATE_PLAYING ) then 
    loop 
      exitwhen x > 7 
        loop 
          exitwhen i > 20 
          call CreateNUnitsAtLocFacingLocBJ( 1, udg_LevelTypes[udg_CurrentLevel], udg_AttackerPlayers[x], whichPoint, whichTarget ) 
          call SetUnitUserData( GetLastCreatedUnit(), udg_CustomValues[x] ) 
          call GroupAddUnitSimple( GetLastCreatedUnit(), udg_WaypointGroups[x] ) 
          call IssuePointOrderLoc( GetLastCreatedUnit(), "move", whichTarget ) 
          set i = i + 1 
          call TriggerSleepAction( .25 ) 
        endloop 
      set x = x + 1 
    endloop 
  endif 
endfunction 
 
//=========================================================================== 
function InitTrig_Start_Level takes nothing returns nothing 
    set gg_trg_Start_Level = CreateTrigger(  ) 
    call TriggerRegisterTimerExpireEventBJ( gg_trg_Start_Level, udg_Timer ) 
    call TriggerAddAction( gg_trg_Start_Level, function Trig_Start_Level_Actions ) 
endfunction
06-13-2004, 12:13 PM#2
AIAndy
You forgot to reset i to 1 after the inner loop.