function Trig_Slide_Filter takes nothing returns boolean
return true //This is basically your conditions (which type of unit can slide etc...)
endfunction
function Trig_Slide_Loop takes nothing returns nothing
local unit u=GetEnumUnit() // Here we get the picked unit.
local real r=GetUnitFacing(u)*bj_DEGTORAD // Storing the facing in a local.
call SetUnitX(u,GetUnitX(u)+5*Cos(r)) // 5 is basically the speed. Change it to whatever you want.
call SetUnitY(u,GetUnitY(u)+5*Sin(r)) // 5 is basically the speed. Must be the same speed as in the previous line.
set u=null // Nulling to prevent leaks.
endfunction
function Trig_Slide_Actions takes nothing returns nothing
local group g=CreateGroup()
call GroupEnumUnitsInRect(g,bj_mapInitialPlayableArea,Filter(function Trig_Slide_Filter)) // We get all units in bj_mapInitialPlayableArea, which is the whole map. Change this rect to whatever rect you want, for sliding.
call ForGroup(g,function Trig_Slide_Loop) // Looping through the units in the group.
call DestroyGroup(g) // Removing the group to prevent leaks.
set g=null // Nulling to prevent leaks.
endfunction
//===========================================================================
function InitTrig_Slide takes nothing returns nothing
set gg_trg_Slide = CreateTrigger( )
call TriggerRegisterTimerEvent(gg_trg_Slide,0.03,true) // This is a periodic event (every 0.03 seconds)
call TriggerAddAction( gg_trg_Slide, function Trig_Slide_Actions )
endfunction