function buy_item2 takes nothing returns nothing
if ((IsUnitType(GetBuyingUnit(), UNIT_TYPE_HERO) == true)) then
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 16
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if ((GetUnitTypeId(GetSoldUnit()) == T[bj_forLoopAIndex])) then
if ((bj_forLoopAIndex < 2)) then
if ((I[GetConvertedPlayerId(GetOwningPlayer(GetBuyingUnit()))] == false)) then
call UnitAddItemByIdSwapped( P[bj_forLoopAIndex], GetBuyingUnit() )
set I[GetConvertedPlayerId(GetOwningPlayer(GetBuyingUnit()))] = true
else
endif
else
if ((bj_forLoopAIndex < 4)) then
if ((II[GetConvertedPlayerId(GetOwningPlayer(GetBuyingUnit()))] == false)) then
call UnitAddItemByIdSwapped( P[bj_forLoopAIndex], GetBuyingUnit() )
set II[GetConvertedPlayerId(GetOwningPlayer(GetBuyingUnit()))] = true
else
endif
else
if ((bj_forLoopAIndex < 6)) then
if ((III[GetConvertedPlayerId(GetOwningPlayer(GetBuyingUnit()))] == false)) then
call UnitAddItemByIdSwapped( P[bj_forLoopAIndex], GetBuyingUnit() )
set III[GetConvertedPlayerId(GetOwningPlayer(GetBuyingUnit()))] = true
else
endif
else
if ((bj_forLoopAIndex < 8)) then
if ((IIII[GetConvertedPlayerId(GetOwningPlayer(GetBuyingUnit()))] == false)) then
call UnitAddItemByIdSwapped( P[bj_forLoopAIndex], GetBuyingUnit() )
set IIII[GetConvertedPlayerId(GetOwningPlayer(GetBuyingUnit()))] = true
else
endif
else
if ((bj_forLoopAIndex < 10)) then
if ((IIIII[GetConvertedPlayerId(GetOwningPlayer(GetBuyingUnit()))] == false)) then
call UnitAddItemByIdSwapped( P[bj_forLoopAIndex], GetBuyingUnit() )
set IIIII[GetConvertedPlayerId(GetOwningPlayer(GetBuyingUnit()))] = true
else
endif
else
if ((bj_forLoopAIndex < 12)) then
if ((IIIIII[GetConvertedPlayerId(GetOwningPlayer(GetBuyingUnit()))] == false)) then
call UnitAddItemByIdSwapped( P[bj_forLoopAIndex], GetBuyingUnit() )
set IIIIII[GetConvertedPlayerId(GetOwningPlayer(GetBuyingUnit()))] = true
else
endif
else
if ((bj_forLoopAIndex < 14)) then
if ((IIIIIII[GetConvertedPlayerId(GetOwningPlayer(GetBuyingUnit()))] == false)) then
call UnitAddItemByIdSwapped( P[bj_forLoopAIndex], GetBuyingUnit() )
set IIIIIII[GetConvertedPlayerId(GetOwningPlayer(GetBuyingUnit()))] = true
else
endif
else
if ((IIIIIIII[GetConvertedPlayerId(GetOwningPlayer(GetBuyingUnit()))] == false)) then
call UnitAddItemByIdSwapped( P[bj_forLoopAIndex], GetBuyingUnit() )
set IIIIIIII[GetConvertedPlayerId(GetOwningPlayer(GetBuyingUnit()))] = true
else
endif
endif
endif
endif
endif
endif
endif
endif
else
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
else
endif
endfunction
呢段好似係問題所在
我試過分開左佢地
得呢部分出現左文法錯誤