- Joined
- Nov 30, 2007
- Messages
- 1,202
I need to move this function inside my struct, so I can use other variables after the ReplaceUnit function. I suppose I could pass the instance through a static integer in the struct. And have a static method as a ForLoop.
Here is the struct:
JASS:
private function ReplaceBarrack_T1 takes nothing returns nothing
local unit u = GetEnumUnit()
if GetUnitTypeId(u) == BARRACKS_T1 then
call ReplaceUnit(u, BARRACKS_T2)
endfunction
Here is the struct:
JASS:
method upgrade takes nothing returns nothing
set .tier = .tier + 1
if .tier == 2 then
set .radius = CITY_BR_T2
call .replace(CITY_T2)
call .addBuildingCountTot(BT.getBuildingIndexByType(CITY_T2), 1)
call SetUnitAbilityLevel(menu.u, MENU_CHANGER, 2)
call ForGroup(.g, function ReplaceBarrack_T1)
// ...
Last edited: