魔兽首页最新地图防守地图对抗地图角色剧情TD塔类图标准战役ORPG地图其它地图
魔兽论坛攻略秘籍补丁工具RPG 录像制图教学制图资源魔兽战队新图试玩通魔作坊

您的位置:魔兽争霸U9网 >> 制图教学

[WE JASS] 关于如何判断单位是否移动的函数!

作者:Danexx    文章来源:GA    点击数:    更新时间:2005-12-13 19:04:25
作者: Danexx   
2005-03-24
如何在魔兽3地图编辑器中制作一个判断单位是否移动的函数呢?


function 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
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
进入论坛参与针对本文章的讨论
文中部分附件请进入论坛下载
本文章地址:
  • 上一篇:[WE] 影片教程,介绍了一些鲜为人知的功能!
  • 下一篇:
  • 相关文章

    进入论坛参与针对本文章的讨论用户评论

    地图 攻略
    热门搜索: 仙之侠道 真三国无双 Dota Allstar

    地图专区导航

    热门地图攻略

    热门地图周排行

    最新推荐地图

    地图下载总排行

    关于我们  -  联系我们  -  广告优势  -  广告服务
    建议意见:玩家点击留言  商务合作:客户点击留言
    西安优久数码科技有限公司 版权所有 陕ICP证08000654号