- Joined
- Sep 12, 2008
- Messages
- 657
hey.. i made a loop to find a right value out of an array..
so i did this:
im pretty sure that this will lag heavly if ill call it many times, (many unit's using the function)
cuz of my old projectiles system.
so i want to know if theres a better way to make it?
oh yeah, AS[2] = Table
thanks in advance.
so i did this:
JASS:
private function GetUnitDataCount takes unit u returns integer
loop
if AS[2] == AS[1] then
set AS[2] = 1
else
set AS[2] = AS[2] + 1
endif
exitwhen AS[2] == AS[1] or GetUnitTypeId(u) == UnitType[AS[2]]
if AS[2] == AS[1] and GetUnitTypeId(u) != UnitType[AS[2]] then
call BJDebugMsg("You have not initialized the unit type trying to attack.")
call BJDebugMsg(" Unit name is: " + GetUnitName(u))
endif
endloop
return AS[2]
endfunction
im pretty sure that this will lag heavly if ill call it many times, (many unit's using the function)
cuz of my old projectiles system.
so i want to know if theres a better way to make it?
oh yeah, AS[2] = Table
thanks in advance.