- Joined
- Jul 15, 2007
- Messages
- 36
Help with spawning (Edited: Now Check for leaks)
Dear all,
I am trying to make some clean spawning triggers. The goal of the trigger is:
==========={EDIT}===========
Thank-you for looking at this; I have solved my endless loop problems, and made the following code. I wonder if I've accurately cleaned up all the leaks?
Thank-you
Dear all,
I am trying to make some clean spawning triggers. The goal of the trigger is:
==========={EDIT}===========
Thank-you for looking at this; I have solved my endless loop problems, and made the following code. I wonder if I've accurately cleaned up all the leaks?
JASS:
function DoSpawn takes nothing returns nothing
local integer i = 0
local integer count = 0
local location loc = null
loop
exitwhen i == 8
set count = udg_Level1[i]
set udg_Income[i] = udg_Income[i] + ( udg_SpawnIncome[0] * count )
loop
exitwhen count == 0
set loc = GetRandomLocInRect(udg_SpawnRect[i])
call CreateUnitAtLoc(Player(i), 'n00I', loc, 90.00)
call RemoveLocation(loc)
set count = count - 1
endloop
set count = udg_Level2[i]
set udg_Income[i] = udg_Income[i] + ( udg_SpawnIncome[1] * count )
loop
exitwhen count == 0
set loc = GetRandomLocInRect(udg_SpawnRect[i])
call CreateUnitAtLoc(Player(i), 'n00J', loc, 90.00)
call RemoveLocation(loc)
set count = count - 1
endloop
set count = udg_Level3[i]
set udg_Income[i] = udg_Income[i] + ( udg_SpawnIncome[2] * count )
loop
exitwhen count == 0
set loc = GetRandomLocInRect(udg_SpawnRect[i])
call CreateUnitAtLoc(Player(i), 'n00K', loc, 90.00)
call RemoveLocation(loc)
set count = count - 1
endloop
set count = udg_Level4[i]
set udg_Income[i] = udg_Income[i] + ( udg_SpawnIncome[3] * count )
loop
exitwhen count == 0
set loc = GetRandomLocInRect(udg_SpawnRect[i])
call CreateUnitAtLoc(Player(i), 'n00L', loc, 90.00)
call RemoveLocation(loc)
set count = count - 1
endloop
set count = udg_Level5[i]
set udg_Income[i] = udg_Income[i] + ( udg_SpawnIncome[4] * count )
loop
exitwhen count == 0
set loc = GetRandomLocInRect(udg_SpawnRect[i])
call CreateUnitAtLoc(Player(i), 'n00M', loc, 90.00)
call RemoveLocation(loc)
set count = count - 1
endloop
set count = udg_Level6[i]
set udg_Income[i] = udg_Income[i] + ( udg_SpawnIncome[5] * count )
loop
exitwhen count == 0
set loc = GetRandomLocInRect(udg_SpawnRect[i])
call CreateUnitAtLoc(Player(i), 'n00N', loc, 90.00)
call RemoveLocation(loc)
set count = count - 1
endloop
set count = udg_Level7[i]
set udg_Income[i] = udg_Income[i] + ( udg_SpawnIncome[6] * count )
loop
exitwhen count == 0
set loc = GetRandomLocInRect(udg_SpawnRect[i])
call CreateUnitAtLoc(Player(i), 'n00O', loc, 90.00)
call RemoveLocation(loc)
set count = count - 1
endloop
set count = udg_Level8[i]
set udg_Income[i] = udg_Income[i] + ( udg_SpawnIncome[7] * count )
loop
exitwhen count == 0
set loc = GetRandomLocInRect(udg_SpawnRect[i])
call CreateUnitAtLoc(Player(i), 'n00P', loc, 90.00)
call RemoveLocation(loc)
set count = count - 1
endloop
set count = udg_Level9[i]
set udg_Income[i] = udg_Income[i] + ( udg_SpawnIncome[8] * count )
loop
exitwhen count == 0
set loc = GetRandomLocInRect(udg_SpawnRect[i])
call CreateUnitAtLoc(Player(i), 'n00Q', loc, 90.00)
call RemoveLocation(loc)
set count = count - 1
endloop
set count = udg_Level10[i]
set udg_Income[i] = udg_Income[i] + ( udg_SpawnIncome[9] * count )
loop
exitwhen count == 0
set loc = GetRandomLocInRect(udg_SpawnRect[i])
call CreateUnitAtLoc(Player(i), 'n00R', loc, 90.00)
call RemoveLocation(loc)
set count = count - 1
endloop
set count = udg_Level11[i]
set udg_Income[i] = udg_Income[i] + ( udg_SpawnIncome[10] * count )
loop
exitwhen count == 0
set loc = GetRandomLocInRect(udg_SpawnRect[i])
call CreateUnitAtLoc(Player(i), 'n00S', loc, 90.00)
call RemoveLocation(loc)
set count = count - 1
endloop
set count = udg_Level12[i]
set udg_Income[i] = udg_Income[i] + ( udg_SpawnIncome[11] * count )
loop
exitwhen count == 0
set loc = GetRandomLocInRect(udg_SpawnRect[i])
call CreateUnitAtLoc(Player(i), 'n00T', loc, 90.00)
call RemoveLocation(loc)
set count = count - 1
endloop
set count = udg_Level13[i]
set udg_Income[i] = udg_Income[i] + ( udg_SpawnIncome[12] * count )
loop
exitwhen count == 0
set loc = GetRandomLocInRect(udg_SpawnRect[i])
call CreateUnitAtLoc(Player(i), 'n00U', loc, 90.00)
call RemoveLocation(loc)
set count = count - 1
endloop
set count = udg_Level14[i]
set udg_Income[i] = udg_Income[i] + ( udg_SpawnIncome[13] * count )
loop
exitwhen count == 0
set loc = GetRandomLocInRect(udg_SpawnRect[i])
call CreateUnitAtLoc(Player(i), 'n00V', loc, 90.00)
call RemoveLocation(loc)
set count = count - 1
endloop
set count = udg_Level15[i]
set udg_Income[i] = udg_Income[i] + ( udg_SpawnIncome[14] * count )
loop
exitwhen count == 0
set loc = GetRandomLocInRect(udg_SpawnRect[i])
call CreateUnitAtLoc(Player(i), 'n00W', loc, 90.00)
call RemoveLocation(loc)
set count = count - 1
endloop
set i = i + 1
endloop
call updateIncome()
endfunction
Thank-you
Last edited: