function Trig_Gjeit_Conditions takes nothing returns boolean
if ( GetBooleanOr( GetIssuedOrderIdBJ() == String2OrderIdBJ("smart") , GetIssuedOrderIdBJ() == String2OrderIdBJ("move") ) ) then
return true
endif
return false
endfunction
function Trig_Gjeit_Actions takes nothing returns nothing
local location p
local location p2
set p = GetUnitLoc(GetOrderedUnit())
if ( GetTerrainTypeBJ(p) == 'Nice' ) then
set p2 = GetOrderPointLoc()
call SetUnitPositionLocFacingBJ( GetTriggerUnit(), PolarProjectionBJ(p, 1.00, DistanceBetweenPoints(p, p2)), AngleBetweenPoints(p, p2) )
call RemoveLocation( p2 )
endif
call RemoveLocation( p )
endfunction
function InitTrig_Gjeit takes nothing returns nothing
set gg_trg_Gjeit = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Gjeit, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerAddCondition( gg_trg_Gjeit, Condition( function Trig_Gjeit_Conditions ) )
call TriggerAddAction( gg_trg_Gjeit, function Trig_Gjeit_Actions )
endfunction