| 作者: Danexx | |
| 2005-03-24 | |
|
如何在魔兽3地图编辑器中制作一个判断单位是否移动的函数呢? 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 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 |
责任编辑:admin
进入论坛参与针对本文章的讨论
