找回密码
 点一下
查看: 1910|回复: 3

在移植JASS版兽王飞斧时遇到的问题

[复制链接]
发表于 2009-11-18 17:57:23 | 显示全部楼层 |阅读模式
辅助单位、技能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

飞斧和咆哮(1).w3x

30 KB, 下载次数: 31

JASS版演示地图

test.w3x

20 KB, 下载次数: 10

移植入新建的地图,遇到的问题

发表于 2009-11-18 18:00:40 | 显示全部楼层
请检查你的代码中有没有H2S、SetStringUnit等函数。
如果没有请从原地图中copy过来。
回复

使用道具 举报

 楼主| 发表于 2009-11-18 18:21:52 | 显示全部楼层

回 1楼(血戮魔动冰) 的帖子

呵呵。。。我刚在J文件里拷出来了,然后看到你的回复,粘在飞斧代码的前面了。。。谢谢O(∩_∩)O现在的问题是,投出的飞斧马甲没有按轨迹运动,而是停在原地。。。我继续找问题。。。是不是CACHE创建的问题呀?~
回复

使用道具 举报

 楼主| 发表于 2009-11-18 18:23:38 | 显示全部楼层

回 2楼(mne) 的帖子

额。。。自问自答。。是的。。。我解决了 谢谢你O(∩_∩)O~
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-24 20:22 , Processed in 0.106189 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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