找回密码
 点一下
查看: 1268|回复: 5

如何通过触发器关闭乌鸦形态(变身)

[复制链接]
发表于 2009-3-12 23:39:02 | 显示全部楼层 |阅读模式
想实现一个技能,当乌鸦形态开启后变成飞行,受到攻击后关闭乌鸦形态。
发表于 2009-3-12 23:39:36 | 显示全部楼层
请在动作-单位-发布命令(无目标)中寻找
回复

使用道具 举报

 楼主| 发表于 2009-3-13 00:18:53 | 显示全部楼层
[codes=jass]

//===========================================================================
function LoreleiGetHitWhenFlying3 takes nothing returns nothing
    local string tHandle = H2S(GetExpiredTimer())
    local unit hero = GetStoredUnit(tHandle, "Hero")
    local unit caster = CreateUnit(GetOwningPlayer(hero), udg_SpellCaster, GetUnitX(hero), GetUnitY(hero), bj_UNIT_FACING)
    call UnitApplyTimedLife(caster, 'BTLF', 2)
    call UnitAddAbility(caster, 'A039')
    call IssueTargetOrder(caster, "thunderbolt", hero)
    call KillTimer(GetExpiredTimer())
    call EnableTrigger(udg_loreleiSkillTwoTrigger)
    set hero = null
    set caster = null
endfunction

//===========================================================================
function LoreleiGetHitWhenFlying2 takes nothing returns nothing
    local string tHandle = H2S(GetExpiredTimer())
    local unit hero = GetStoredUnit(tHandle, "Hero")
    local timer t
    local real damage = GetStoredRealSimple(tHandle, "Damage")
    call IssueImmediateOrder(hero, "unravenform")
    if damage != 0 then
        set t = CreateTimer()
        call StoreHandle(H2S(t), "Hero", hero)
        call TimerStart(t, 0.25, false, function LoreleiGetHitWhenFlying3)
    else
        call EnableTrigger(udg_loreleiSkillTwoTrigger)
    endif   
    call KillTimer(GetExpiredTimer())
    set hero = null
    set t = null
endfunction

//===========================================================================
function LoreleiGetHitWhenFlying takes nothing returns nothing
    local string tHandle = H2S(GetTriggeringTrigger())
    local unit hero = GetStoredUnit(tHandle, "Hero")
    local timer t = CreateTimer()
    call SetPlayerAbilityAvailable(GetOwningPlayer(hero), 'A03H', true)
    call StoreHandle(H2S(t), "Hero", hero)
    call StoreRealSimple(H2S(t), "Damage", GetEventDamage())
    call TimerStart(t, 0.01, false, function LoreleiGetHitWhenFlying2)
    call KillTrigger(GetTriggeringTrigger())
    set hero = null
    set t = null
endfunction

//===========================================================================
function LoreleiSkillTwoConditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A03H'
endfunction

//===========================================================================
function LoreleiSkillTwoActions takes nothing returns nothing
    local unit hero = GetTriggerUnit()
    local trigger t = CreateTrigger()
    local string tHandle = H2S(t)
    local integer time
    local integer level = GetUnitAbilityLevel(hero, 'A03H')
    call DisableTrigger(udg_loreleiSkillTwoTrigger)
    if level < 3 then
        set time = level * 10
    else
        set time = (level - 2) * 45
    endif
    call SetPlayerAbilityAvailable(GetOwningPlayer(hero), 'A03H', false)
    call StoreHandle(tHandle, "Hero", hero)
    call TriggerRegisterTimerEvent(t, time, false)
    call TriggerRegisterUnitEvent(t, hero , EVENT_UNIT_DAMAGED)
    call TriggerAddAction(t, function LoreleiGetHitWhenFlying)
    set hero = null
    set t = null
endfunction

//===========================================================================
function LoreleiSkillTwoTrigger takes nothing returns nothing
    set udg_loreleiSkillTwoTrigger = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(udg_loreleiSkillTwoTrigger, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(udg_loreleiSkillTwoTrigger, Condition(function LoreleiSkillTwoConditions))
    call TriggerAddAction(udg_loreleiSkillTwoTrigger, function LoreleiSkillTwoActions)
    if udg_DEBUG_ON == true then
        call BJDebugMsg("夜雀技能2装载完毕")
    endif
endfunction

[/codes]



通過點擊取消烏鴉形態還原,單位會在空中轉向至左下……如何解決
如果改為使用取消單位觸碰,改變飛行高度的模擬方法,如果改變單位初始速度?
另外話說怎么使用代碼高亮……
回复

使用道具 举报

发表于 2009-3-13 00:51:46 | 显示全部楼层
由空中轉至 左 下是什麼意思呢?
您是想要實現如何的效果?
代碼高亮只要在code後加上=jass。如[code=jass]。
回复

使用道具 举报

 楼主| 发表于 2009-3-13 00:59:08 | 显示全部楼层
就是在空中取消烏鴉形態,英雄會旋轉至面向左下
回复

使用道具 举报

发表于 2009-3-13 01:15:45 | 显示全部楼层
抱歉,CODE说错了。应该是[codes=jass]。

如果只是单位面朝左下应该没有什么太大的关系吧?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-11-25 11:05 , Processed in 0.200570 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表