I am working on a sliding trigger that causes a footman to slide if he is on the tile Northrend - Ice. Here is my JASS (NOT vJASS) trigger. The problem with it is that the unit simply does not slide. He walks like normal. Can anyone see the problem?
JASS:
function Trig_Slide_Boolexpr takes location l returns boolean
return GetTerrainTypeBJ(l) == 039;Nice039;
endfunction
function Slide_CopyGroup takes group g returns group
set bj_groupAddGroupDest = CreateGroup()
call ForGroup(g, function GroupAddGroupEnum)
return bj_groupAddGroupDest
endfunction
function Trig_Sliding_UnitCheck takes nothing returns boolean
return ( GetUnitTypeId(GetTriggerUnit()) == 039;hfoo039; )
endfunction
function Trig_Sliding_Actions takes nothing returns nothing
local group a = GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function Trig_Sliding_UnitCheck))
local group c
local unit b
local location original
local location new
local real speed
local real facing
set c = Slide_CopyGroup(a)
loop
set b = FirstOfGroup(c)
exitwhen b == null
if Trig_Slide_Boolexpr(GetUnitLoc(b)) then
set original = GetUnitLoc(b)
set facing = GetUnitFacing( b )
set speed = 300
set new = PolarProjectionBJ(original, speed*0.03, facing)
call SetUnitPositionLoc( b, new )
endif
call GroupRemoveUnitSimple( b, c )
endloop
call DestroyGroup( a )
call DestroyGroup( c )
set b = null
call RemoveLocation ( original )
call RemoveLocation ( new )
endfunction
//===========================================================================
function InitTrig_Sliding takes nothing returns nothing
set gg_trg_Sliding = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Sliding, 0.03 )
call TriggerAddAction( gg_trg_Sliding, function Trig_Sliding_Actions )
endfunction