|
辅助单位、技能ID均在移植的时候修改匹配,也在地图初始化时 建了缓存call initCache()
变量里定义了Cache
但是在编译的时候在local string fT=H2S(GetExpiredTimer()) 这句开始出错。。。不知为何。。。请教高手!
在代码来源的演示图中,修改并测试代码没问题。。但是一旦移植就出问题。。。悲剧,我是JASS新手,望不吝赐教~谢!
代码如下:(下面的技能ID等,修改为与自己图中匹配的。如'A008'...)
function Trig_axe_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A008' ) ) then
return false
endif
return true
endfunction
function killdes takes nothing returns nothing
call KillDestructable(GetEnumDestructable())
endfunction
function damage takes unit Em,real x,real y,group ke returns nothing
local group fA=CreateGroup()
local unit fz
local rect kE=Rect(x-150,y-150,x+150,y+150)
call GroupEnumUnitsInRange(fA,x,y,150,null)
loop
set fz=FirstOfGroup(fA)
exitwhen fz==null
if(IsUnitInGroup(fz,ke)==false and IsUnitEnemy(fz,GetOwningPlayer(Em)) and IsUnitVisible(fz,GetOwningPlayer(Em)))then
if(GetUnitAbilityLevel(fz,'A04R')!=1 and GetUnitState(fz,UNIT_STATE_LIFE)>0 and IsUnitType(fz,UNIT_TYPE_STRUCTURE)==false)then //注:A04R在此演示中无用
call GroupAddUnit(ke,fz)
call UnitDamageTarget(Em,fz,60+GetUnitAbilityLevel(Em,'A008')*30,true,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_METAL_HEAVY_SLICE)
call AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl",fz,"overhead")
endif
endif
call GroupRemoveUnit(fA,fz)
endloop
call EnumDestructablesInRect(kE,null,function killdes)
call RemoveRect(kE)
call DestroyGroup(fA)
endfunction
function AxeAction takes nothing returns nothing
local string fT=H2S(GetExpiredTimer())
local unit kF=GetStringUnit(fT,"Axe")
local unit fy=GetStringUnit(fT,"Hero")
local real Ax=GetStringReal(fT,"Ax")
local real Ay=GetStringReal(fT,"Ay")
local real Cx=GetStringReal(fT,"Cx")
local real Cy=GetStringReal(fT,"Cy")
local real Bx=GetStringReal(fT,"Bx")
local real By=GetStringReal(fT,"By")
local real a=GetStringReal(fT,"a")
local real b=1-a
local boolean kg=GetStringBool(fT,"FirstPass")
local group ke=GetStringGroup(fT,"AlreadyDamaged")
call SetUnitX(kF,CheckX(Ax*a*a+Bx*2*a*b+Cx*b*b))
call SetUnitY(kF,CheckY(Ay*a*a+By*2*a*b+Cy*b*b))
call damage(fy,GetUnitX(kF),GetUnitY(kF),ke)
if(kg)then
call SetStringReal(fT,"a",a-.04)
else
call SetStringReal(fT,"a",a+.04)
call SetStringReal(fT,"Ax",GetUnitX(fy))
call SetStringReal(fT,"Ay",GetUnitY(fy))
endif
if(a<0 and kg)then
call SetStringBool(fT,"FirstPass",false)
call SetStringReal(fT,"Bx",Ax+300*Cos(Atan2(Cy-Ay,Cx-Ax)+GetStringReal(fT,"AngleOffset")))
call SetStringReal(fT,"By",Ay+300*Sin(Atan2(Cy-Ay,Cx-Ax)+GetStringReal(fT,"AngleOffset")))
endif
if(a>1 and kg==false)then
call PauseTimer(GetExpiredTimer())
call DestroyGroup(ke)
call FlushCache(fT)
call RemoveUnit(kF)
call PolledWait(.1)
call DestroyTimer(GetExpiredTimer())
endif
endfunction
function Trig_axe_Actions takes nothing returns nothing
local unit Em=GetTriggerUnit()
local real Ax=GetUnitX(Em)
local real Ay=GetUnitY(Em)
local real Cx=GetLocationX(GetSpellTargetLoc())
local real Cy=GetLocationY(GetSpellTargetLoc())
local unit kh=CreateUnit(GetOwningPlayer(Em),'e007',Ax,Ay,270.)
local unit kH=CreateUnit(GetOwningPlayer(Em),'e007',Ax,Ay,270.)
local string ki
local string kI
local timer kj=CreateTimer()
local timer kJ=CreateTimer()
call UnitAddAbility(kh,'Amrf')
call UnitRemoveAbility(kh,'Amrf')
call SetUnitFlyHeight(kh,150,0)
call UnitAddAbility(kH,'Amrf')
call UnitRemoveAbility(kH,'Amrf')
call SetUnitFlyHeight(kH,150,0)
set ki=H2S(kj)
call SetStringHandle(ki,"Hero",Em)
call SetStringHandle(ki,"Axe",kh)
call SetStringHandle(ki,"AlreadyDamaged",CreateGroup())
call SetStringReal(ki,"Ax",Ax)
call SetStringReal(ki,"Ay",Ay)
call SetStringReal(ki,"Cx",Cx)
call SetStringReal(ki,"Cy",Cy)
call SetStringReal(ki,"Bx",Ax+300*Cos(Atan2(Cy-Ay,Cx-Ax)+45))
call SetStringReal(ki,"By",Ay+300*Sin(Atan2(Cy-Ay,Cx-Ax)+45))
call SetStringReal(ki,"a",1)
call SetStringReal(ki,"AngleOffset",-45)
call SetStringBool(ki,"FirstPass",true)
set kI=H2S(kJ)
call SetStringHandle(kI,"Hero",Em)
call SetStringHandle(kI,"Axe",kH)
call SetStringHandle(kI,"AlreadyDamaged",CreateGroup())
call SetStringReal(kI,"Ax",Ax)
call SetStringReal(kI,"Ay",Ay)
call SetStringReal(kI,"Cx",Cx)
call SetStringReal(kI,"Cy",Cy)
call SetStringReal(kI,"Bx",Ax+300*Cos(Atan2(Cy-Ay,Cx-Ax)-45))
call SetStringReal(kI,"By",Ay+300*Sin(Atan2(Cy-Ay,Cx-Ax)-45))
call SetStringReal(kI,"a",1)
call SetStringReal(kI,"AngleOffset",45)
call SetStringBool(kI,"FirstPass",true)
call TimerStart(kj,.035,true,function AxeAction)
call TimerStart(kJ,.035,true,function AxeAction)
endfunction
//===========================================================================
function InitTrig_axe takes nothing returns nothing
set gg_trg_axe = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_axe, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_axe, Condition( function Trig_axe_Conditions ) )
call TriggerAddAction( gg_trg_axe, function Trig_axe_Actions )
endfunction |
|