|
我6个月来写的代码因重装系统什么都没了…于是在玩以前的图的时候遇到一个严重的问题,有跳跃及月神箭两个技能,前者j后vj,也就是前者没用到任何全局变量,在游戏中会出现改变单位飞行高度的函数突然中止,移动单位(白虎跳跃和月箭)的timer没运行
由于重装系统所以优化前的图没有了...我只有从优化后的图里面查看代码,下面贴出跳跃的代码:
[jass]function I00OI takes nothing returns nothing
local timer t=GetExpiredTimer()
call SetUnitFlyHeight(OI1O((I2S(I1IO((t)))),"unit"),.0,666.67)
call O01O((I2S(I1IO((t)))))
call DestroyTimer(t)
set t=null
endfunction
function I000I takes nothing returns nothing
local timer t=GetExpiredTimer()
local unit u=OI1O((I2S(I1IO((t)))),"unit")
local real I001I=OI0O((I2S(I1IO((t)))),"facing")
local real O010=OI0O((I2S(I1IO((t)))),"distance")-20.
call SetUnitX(u,O00O(GetUnitX(u)+CosBJ(I001I)*20.))
call SetUnitY(u,O11O(GetUnitY(u)+SinBJ(I001I)*20.))
call SetUnitFacing(u,I001I)
call OIOO((I2S(I1IO((t)))),"distance",O010)
if O010<=0 then
call O01O((I2S(I1IO((t)))))
call DestroyTimer(t)
call SetUnitPathing(u,true)
call SetUnitAnimation(u,"stand")
endif
set t=null
endfunction
function I01II takes nothing returns nothing
local unit u=GetTriggerUnit()
local timer t=CreateTimer()
local timer t2=CreateTimer()
call UnitAddAbility(u,1097691750)
call UnitRemoveAbility(u,1097691750)
call SetUnitFlyHeight(u,200.,666.67)
call IssueImmediateOrder(u,"stop")
call SetUnitAnimationByIndex(u,6)
call OIOO((I2S(I1IO((t)))),"facing",GetUnitFacing(u))
call OIIO((I2S(I1IO((t)))),"unit",u)
call OIIO((I2S(I1IO((t2)))),"unit",u)
call OIOO((I2S(I1IO((t)))),"distance",600.)
call SetUnitPathing(u,false)
call TimerStart(t,.02,true,function I000I)
call TimerStart(t2,.3,false,function I00OI)
endfunction
function I01OI takes nothing returns nothing
set OOO=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(OOO,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(OOO,Condition(function I00II))
call TriggerAddAction(OOO,function I01II)
endfunction[/jass]
那个Condition就是判断施放的技能是否是跳跃。
我又重新看了一下这段代码,应该没有错才对啊。 |
|