如何判断单位是否移动的两个函数
RespondingActionfunction RespondingAction takes nothing returns nothing
if (GetUnitTypeId(GetDyingUnit())) == "hhdl") then
call DisplayTextToForce(GetPlayersAll(),"IsStanding = False")
call DestroyTrigger(GetTriggeringTrigger())
//自定义事件(未移动)
else
if (GetUnitTypeId(GetDyingUnit())) == "hrdh") then
call DisplayTextToForce(GetPlayersAll(),"IsStanding = True")
call DestroyTrigger(GetTriggeringTrigger())
//自定义事件(移动中)
endif
endif
endfunction
UnitStandCheck takes
function UnitStandCheck takes unit U returns nothing
local unit WitchUnit = U
local unit RespondingUnit = null
local location UnitLoc = GetUnitLoc(WitchUnit)
local boolean IsStanding = true
local trigger RespondingTrigger = null
loop
if (IsStanding == true) then
if (DistanceBetweenPoints(UnitLoc, GetUnitLoc(WitchUnit)) > 10 ) then)
set RespondingUnit = CreateUnitAtLoc(GetOwningPlayer(WitchUnit), "hhdl", Location(0, 0), 0.00)
set IsStanding = false
set RespondingTrigger = CreateTRigger()
call TriggerRegisterAnyUnitEventBJ(RespondingTrigger,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(RespondingTrigger, function RespondingAction)
call ExplodeUnitBJ(RespondingUnit)
call SetUnitUserData(WitchUnit, 0)
//自定义事件(未移动)
endif
else
if (DistanceBetweenPoints(UnitLoc, GetUnitLoc(WitchUnit)) <= 10 ) then)
set RespondingUnit = CreateUnitAtLoc(GetOwningPlayer(WitchUnit), "hrdh", Location(0, 0), 0.00)
set IsStanding = true
set RespondingTrigger = CreateTRigger()
call TriggerRegisterAnyUnitEventBJ(RespondingTrigger,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(RespondingTrigger, function RespondingAction)
call ExplodeUnitBJ(RespondingUnit)
call SetUnitUserData(WitchUnit, 0)
//自定义事件(移动中)
endif
endif
set UnitLoc = GetUnitLoc(WitchUnit)
call PolledWait(0.01)
endloop
endfunction
页:
[1]