Cokemonkey11
New Member
- Reaction score
- 18
Or perhaps a better question, why isn't the function with the loop being called correctly?
JASS:
function moveInCircle takes unit centerUnit, unit rifleAttacker, unit footAttacked returns nothing
local integer i = 0
local location posCenter = GetUnitLoc(centerUnit)
local location posCenterOff
local real posRifleOffX
local real posRifleOffY
local location posCenterOff2
local real posFootOffX
local real posFootOffY
loop
exitwhen i > 359
set i = i+1
set posCenterOff = PolarProjectionBJ(posCenter,512,i)
set posRifleOffX = GetLocationX(posCenterOff)
set posRifleOffY = GetLocationY(posCenterOff)
set posCenterOff2 = PolarProjectionBJ(posCenter,450,i)
set posFootOffX = GetLocationX(posCenterOff2)
set posFootOffY = GetLocationY(posCenterOff2)
call SetUnitX(rifleAttacker,posRifleOffX)
call SetUnitY(rifleAttacker,posRifleOffY)
call SetUnitX(footAttacked,posFootOffX)
call SetUnitY(footAttacked,posFootOffY)
call TriggerSleepAction(.1)
endloop
endfunction
function Trig_dummyCenter_Actions takes nothing returns nothing
local unit centerUnit
local unit rifleAttacker
local unit footAttacked
call CreateUnitAtLoc(Player(0),039;hfoo039;,GetRectCenter(GetPlayableMapRect()),270)
set centerUnit = GetLastCreatedUnit()
call CreateUnitAtLoc(Player(15),039;hrif039;,PolarProjectionBJ(GetRectCenter(GetPlayableMapRect()),512,0),270)
set rifleAttacker = GetLastCreatedUnit()
call CreateUnitAtLoc(Player(15),039;hfoo039;,PolarProjectionBJ(GetRectCenter(GetPlayableMapRect()),390,0),270)
set footAttacked = GetLastCreatedUnit()
call IssueTargetOrder(rifleAttacker,"attack",footAttacked)
call moveInCircle(centerUnit,rifleAttacker,footAttacked)
endfunction
function InitTrig_dummyCenter takes nothing returns nothing
set gg_trg_dummyCenter = CreateTrigger()
call TriggerRegisterTimerEventSingle(gg_trg_dummyCenter,3)
call TriggerAddAction(gg_trg_dummyCenter, function Trig_dummyCenter_Actions)
endfunction