Im new in jass and im trying this trigger that makes a unit for 8 lanes but when there are so many units out the game crashs
Thats the code im useing i was changing it from gui to jass. Thanks for any help
JASS:
function Trig_IncomeSends_Func011Func001C takes nothing returns boolean
if ( not ( ConvertedPlayer(GetForLoopIndexA()) != GetOwningPlayer(GetTriggerUnit()) ) ) then
return false
endif
if ( not ( IsPlayerInForce(ConvertedPlayer(GetForLoopIndexA()), udg_Players) == true ) ) then
return false
endif
return true
endfunction
function Trig_IncomeSends_Actions takes nothing returns nothing
set udg_IncomeSends[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] = ( udg_IncomeSends[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] + GetUnitPointValue(GetTriggerUnit()) )
set udg_Income[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] = ( udg_Income[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] + GetUnitPointValue(GetTriggerUnit()) )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 8
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if ( Trig_IncomeSends_Func011Func001C() ) then
call CreateUnitAtLoc(Player(11), GetUnitTypeId(GetSoldUnit()), GetRectCenter(udg_PlayerSpawnPoint[GetForLoopIndexA()]), 180.00 )
call SetUnitUserData( GetTriggerUnit(), GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())) )
call SetUnitPathing( GetTriggerUnit(), false )
else
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call RemoveUnit( GetSoldUnit() )
endfunction
//===========================================================================
function InitTrig_IncomeSends takes nothing returns nothing
set gg_trg_IncomeSends = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_IncomeSends, Player(0), EVENT_PLAYER_UNIT_SELL )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_IncomeSends, Player(1), EVENT_PLAYER_UNIT_SELL )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_IncomeSends, Player(2), EVENT_PLAYER_UNIT_SELL )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_IncomeSends, Player(3), EVENT_PLAYER_UNIT_SELL )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_IncomeSends, Player(4), EVENT_PLAYER_UNIT_SELL )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_IncomeSends, Player(5), EVENT_PLAYER_UNIT_SELL )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_IncomeSends, Player(6), EVENT_PLAYER_UNIT_SELL )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_IncomeSends, Player(7), EVENT_PLAYER_UNIT_SELL )
call TriggerAddAction( gg_trg_IncomeSends, function Trig_IncomeSends_Actions )
endfunction
Thats the code im useing i was changing it from gui to jass. Thanks for any help