Name | Type | is_array | initial_value |
MoveGroup | group | No |
function Trig_walk_speed_Actions takes nothing returns boolean
local unit u
local real def
local location loc
local location loc_tar
local real z1
local real z2
call GroupEnumUnitsInRect( udg_MoveGroup, bj_mapInitialPlayableArea, null )
loop
set u = FirstOfGroup( udg_MoveGroup )
exitwhen u == null
if not IsUnitType( u , UNIT_TYPE_STRUCTURE ) and not IsUnitType( u , UNIT_TYPE_FLYING ) then
set def = GetUnitDefaultMoveSpeed(u)
set loc = GetUnitLoc(u)
set loc_tar = PolarProjectionBJ( loc, 10.00, GetUnitFacing(u))
set z1 = GetLocationZ(loc)
set z2 = GetLocationZ(loc_tar)
if z1 < z2 then
call SetUnitMoveSpeed( u, def - (z2 - z1)*20 )
elseif z1 > z2 then
call SetUnitMoveSpeed( u, def + (z1 - z2)*10 )
else
call SetUnitMoveSpeed( u, def )
endif
call RemoveLocation(loc)
call RemoveLocation(loc_tar)
endif
call GroupRemoveUnit( udg_MoveGroup, u )
endloop
set loc_tar = null
set loc = null
return false
endfunction
//===========================================================================
function InitTrig_walk_speed takes nothing returns nothing
set gg_trg_walk_speed = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_walk_speed, 0.1 )
call TriggerAddCondition( gg_trg_walk_speed, Condition(function Trig_walk_speed_Actions) )
endfunction