All right,
I am making a map with a lot of patroling units. My problem is, that the normal patrol command stops working, after the unit hits on an enemy. I decided to solve this problem, by creating a jass function, that would take unit and two patrol locations and endlessly loop the units move with attack order. Whenever the unit gets closer than 510 (or anything else) to the target point it shall turn arround and go to the other point 510 from that point it turns arround etc.. I have created the whole script, but my taken variables refuse to work. It simply writes expected unit / expected point. I am probably just missing something, somebody please help me.
I am making a map with a lot of patroling units. My problem is, that the normal patrol command stops working, after the unit hits on an enemy. I decided to solve this problem, by creating a jass function, that would take unit and two patrol locations and endlessly loop the units move with attack order. Whenever the unit gets closer than 510 (or anything else) to the target point it shall turn arround and go to the other point 510 from that point it turns arround etc.. I have created the whole script, but my taken variables refuse to work. It simply writes expected unit / expected point. I am probably just missing something, somebody please help me.
JASS:
function Trig_FuncPatrol_Func002001 takes nothing returns boolean
return ( IsUnitInGroup(PATROLER, GetUnitsInRangeOfLocAll(512, PointB)) == true )
endfunction
function Trig_FuncPatrol_Func004001 takes nothing returns boolean
return ( IsUnitInGroup(PATROLER, GetUnitsInRangeOfLocAll(512, PointA)) == true )
endfunction
function Trig_FuncPatrol_Actions takes location PointA, location PointB, unit PATROLER returns nothing
loop
call IssuePointOrderLocBJ( PATROLER, "attack", PointB )
loop
exitwhen ( Trig_FuncPatrol_Func002001() )
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 1.00))
endloop
call IssuePointOrderLocBJ( PATROLER, "attack", PointA )
loop
exitwhen ( Trig_FuncPatrol_Func004001() )
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 1.00))
endloop
endloop
endfunction
//===========================================================================
function InitTrig_FuncPatrol takes nothing returns nothing
set gg_trg_FuncPatrol = CreateTrigger( )
call TriggerAddAction( gg_trg_FuncPatrol, function Trig_FuncPatrol_Actions )
endfunction