找回密码
 点一下
查看: 2524|回复: 8

[已解决]大家看看这个技能的问题

[复制链接]
发表于 2008-9-19 10:22:45 | 显示全部楼层 |阅读模式
这个技能,在施放的时,马上按S,就会没有CD,可以一直放,怎么解决? 是什么原因造成的呢?

[codes=jass]

    //TESH.scrollpos=12
    //TESH.alwaysfold=0
    function JW_LBLZ takes nothing returns nothing
    local unit u
    local trigger t
    local effect ef
    local integer i
    local integer iloop
    if(GetSpellAbilityId()=='A0DP')then
    set u=GetTriggerUnit()
    set i=GetUnitAbilityLevel(u,'A0DP')*4
    debug call BJDebugMsg("I:"+I2S(i))
    debug call BJDebugMsg("1")
    set iloop=0
    loop
    exitwhen iloop>=i
    debug call BJDebugMsg("X")
    set ef=AddSpecialEffectTarget("Abilities\\Spells\\Human\\Heal\\HealTarget.mdl",u,"overhead")
    call SetUnitLifeBJ( u, GetUnitStateSwap(UNIT_STATE_LIFE, u)+( ( GetUnitStateSwap(UNIT_STATE_MAX_LIFE, u) - GetUnitStateSwap(UNIT_STATE_LIFE, u) ) / 40 ) )
    call TriggerSleepAction(1)
    call DestroyEffect(ef)
    set iloop=iloop+1
    endloop
    set ef=null
    set u=null
    debug call BJDebugMsg("2")
    endif

    endfunction
    //===========================================================================
    function InitTrig_LBLZ takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_CAST)
    call TriggerAddAction(t, function JW_LBLZ)
    set t=null
    endfunction
     
[/codes]



这个技能为; 实现沉默光环的效果,但是却有一定可能会造成无限沉默,死了再复活也还是不能用技能,这是怎么回事?怎么解决?

[codes=jass]

    //TESH.scrollpos=44
    //TESH.alwaysfold=0
    library CY
    globals
    public unit CY
    public unit TGYHunit
    public timer ti
    public integer FYZDL
    public unit FYZDunit
    public player CYP
    endglobals
    endlibrary
    //===========================================================================
    //852592
    function CY_TGYHdie takes nothing returns nothing
    local unit u=GetDyingUnit()
    call PauseTimer(CY_ti)
    call TriggerSleepAction(I2R(GetUnitLevel(u)+1)*5-1)
    call TimerStart(CY_ti,.6,true,null)
    set u=null
    endfunction
    function CY_TGYHhelp takes nothing returns nothing
    local location l=GetUnitLoc(CY_CY)
    call IssuePointOrderByIdLoc(CY_TGYHunit,852592,l)
    call RemoveLocation(l)
    set l=null
    endfunction
    function CY_TGYH takes nothing returns nothing
    local integer i
    local unit u
    local trigger t
    local trigger t2
    if(GetLearnedSkill()=='A0D3')then
    set u=GetTriggerUnit()
    set i=GetUnitAbilityLevel(u,'A0D3')
    if(i==1)then
    set CY_CY=u
    set CY_TGYHunit= CreateUnit(GetOwningPlayer(u),'n002',0,0,0)
    call ShowUnit(CY_TGYHunit, false)
    call SetUnitInvulnerable(CY_TGYHunit,true)
    call UnitAddAbility(CY_TGYHunit,'A0D2')
    set CY_ti=CreateTimer()
    call TimerStart(CY_ti,.6,true,null)
    set t=CreateTrigger()
    call TriggerRegisterTimerExpireEventBJ(t,CY_ti)
    call TriggerAddAction(t, function CY_TGYHhelp)
    set t2=CreateTrigger()
    call TriggerRegisterUnitEvent(t2,CY_CY, EVENT_UNIT_DEATH )
    call TriggerAddAction(t2, function CY_TGYHdie)
    set t=null
    set t2=null
    else
    if(i==4)then
    set t=GetTriggeringTrigger()
    call DestroyTrigger(t)
    set t=null
    endif
    call SetUnitAbilityLevel(CY_TGYHunit,'A0D2',i)
    endif
    endif
    endfunction
    //-
    function InitTrig_TGYH takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_HERO_SKILL)
    call TriggerAddAction(t, function CY_TGYH)
    set t=null
    endfunction
[/codes]
发表于 2008-9-19 12:44:12 | 显示全部楼层
第一个问题的答案是:
把call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_CAST)改成
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)

第二个问题就这么看代码语法没问题,估计是出现了死循环之类的错误被禁用了。

顺便说一句,第二个技能代码写的极其别扭,虽然是用 JassNewGenPack 写的,但完全没有使用到其任何优点。
回复

使用道具 举报

发表于 2008-9-19 12:47:00 | 显示全部楼层
昨天不是已在疑难区说明了么???
1】把开始发动技能事件
[jass]call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_CAST)
[/jass]
改成发动技能效果事件
[jass]call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
[/jass]

2】把等待函数TriggerSleepAction改成使用Timer来计时试试
回复

使用道具 举报

发表于 2008-9-19 12:48:27 | 显示全部楼层
引用第1楼狡猾的兔子于2008-09-19 12:44发表的  :
顺便说一句,第二个技能代码写的极其别扭,虽然是用 JassNewGenPack 写的,但完全没有使用到其任何优点。。
.......

同感……………………………………………………………………
回复

使用道具 举报

发表于 2008-9-19 13:21:32 | 显示全部楼层
玩ch时 有时也会遇到永久沉默
太郁闷了

回复

使用道具 举报

 楼主| 发表于 2008-9-19 13:48:36 | 显示全部楼层
引用第4楼用户名是虾米于2008-09-19 13:21发表的  :
玩ch时 有时也会遇到永久沉默
太郁闷了



看来无限沉默,是个常见的 疑难问题啊。。。。。。有完美的解决方法吗?
回复

使用道具 举报

发表于 2008-9-19 16:27:01 | 显示全部楼层
又是把一个问题发在多个区的,无视………………
回复

使用道具 举报

 楼主| 发表于 2008-9-19 19:23:09 | 显示全部楼层
引用第6楼zhuzeitou于2008-09-19 16:27发表的  :
又是把一个问题发在多个区的,无视………………


这技能不是T,感觉似乎应该发到这里来呢

要是觉得违反了规定,版主就吧这个帖子删了吧。。。

555
回复

使用道具 举报

发表于 2008-11-17 18:43:29 | 显示全部楼层
会造成无限沉默即是什么意思?我没见过这个的?
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-2 13:54 , Processed in 0.047567 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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