找回密码
 点一下
查看: 1112|回复: 2

问一个关于计时器地址的问题。。

[复制链接]
发表于 2012-7-8 10:49:47 | 显示全部楼层 |阅读模式
最近在移植一个技能。。。我用的是ydwe。。。所以就想把里面用缓存的部分都改成ydwe的储存函数。。。把用return bug的地方都换掉了
然后就有问题了,初步排查下来感觉是计时器的原因

想问一下这样两段代码是否等价
  1. I2S(YDWEGetTimerID(GetExpiredTimer()))
复制代码
  1. function H2Ix takes handle pTarg returns integer
  2. return pTarg
  3. return 0
  4. endfunction
  5. function H2Tx takes handle pTarg returns string
  6. return I2S(H2Ix(pTarg))
  7. endfunction
  8. H2Tx(GetExpiredTimer())
复制代码
谢谢~~
发表于 2012-7-8 11:06:44 | 显示全部楼层
等价~
回复

使用道具 举报

 楼主| 发表于 2012-7-8 12:10:51 | 显示全部楼层

回 chyj4747 的帖子

chyj4747:
等价~
。。。奇怪。。。我实在想不出了。。。
有空的话能不能帮忙看一下。。。谢谢了

解决了。。。我自己脑残。。。填错了单位代码。。。
  1. function RunTimer takes nothing returns nothing
  2.     local string table = I2S(YDWEGetTimerID(GetExpiredTimer()))
  3.     local unit source = YDWEGetUnitByString( table, "source")
  4.     local unit knight = YDWEGetUnitByString( table, "knight")
  5.     local real angle = YDWEGetRealByString( table, "angle")
  6.     local location loc1 = GetUnitLoc(knight)
  7.     local group gro2 = CreateGroup()
  8.    
  9.     local location loc2 = PolarProjectionBJ(loc1, 20, angle )
  10.     local group gro = GetUnitsInRangeOfLocAll(200.00, loc2)
  11.     local integer N = CountUnitsInGroup(gro)
  12.     local integer i = 1
  13.     local unit tem_u
  14.     local integer record = YDWEGetIntegerByString( table, "record")
  15.    
  16.     //call SetUnitAnimation( knight, "walk" )
  17.     call DisplayTimedTextToForce( GetPlayersAll(), 30, table )
  18.     call SetUnitAnimationByIndex( knight, 0 )
  19.     set record = record + 1
  20.     call YDWESaveIntegerByString( table, "record", record )
  21.     call SetUnitPositionLocFacingBJ( knight, loc2, angle )
  22.    
  23.     loop
  24.         exitwhen i > N
  25.         set tem_u = GroupPickRandomUnit(gro)
  26.         call GroupRemoveUnitSimple( tem_u, gro )
  27.         if((IsUnitDeadBJ(tem_u) == false) and (IsUnitAlly(tem_u, GetOwningPlayer(source)) == false) and (IsUnitType(tem_u, UNIT_TYPE_FLYING) == false)) then
  28.                 call GroupAddUnitSimple( tem_u, gro2 )
  29.         endif
  30.         set i = i + 1
  31.     endloop
  32.     if(IsUnitGroupEmptyBJ(gro2) == false) then
  33.         set tem_u = GroupPickRandomUnit(gro2)
  34.         call DestroyEffect( AddSpecialEffectTarget("Abilities\\\\Spells\\\\Other\\\\Stampede\\\\StampedeMissileDeath.mdl", tem_u, "origin") )
  35.         call UnitDamageTarget( source, tem_u, 60.00, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
  36.         call RemoveUnit( knight )
  37.         call PauseTimer(GetExpiredTimer())
  38.     call YDWEFlushMissionByString( table )   
  39.     call DestroyTimer(GetExpiredTimer())
  40.     else
  41.         if(record > 100) then
  42.              call RemoveUnit( knight )
  43.              call PauseTimer(GetExpiredTimer())
  44.          call YDWEFlushMissionByString( table )   
  45.          call DestroyTimer(GetExpiredTimer())
  46.          endif
  47.     endif
  48.      call RemoveLocation(loc1)
  49.      call RemoveLocation(loc2)
  50.      call DestroyGroup( gro )
  51.      call DestroyGroup(gro2)
  52.      
  53.      set table = null
  54.      set source = null
  55.      set knight = null
  56.      set loc1 = null
  57.      set loc2 = null
  58.      set gro = null
  59.      set gro2 = null
  60.      set tem_u = null
  61. endfunction
复制代码
  1. function run takes location tem,real angle,unit source returns nothing
  2.     local string table
  3.     local unit knight = CreateUnitAtLoc(GetOwningPlayer(source), 'h004', tem, angle)
  4.     local timer t = CreateTimer()
  5.     //call SetUnitAnimation( knight, "walk" )
  6.     call SetUnitAnimationByIndex( knight, 0 )
  7.     call SetUnitPathing( knight, false )
  8.     set table = I2S(YDWEGetTimerID(t))
  9.     call YDWESaveUnitByString( table, "source", source )
  10.     call YDWESaveUnitByString( table, "knight", knight )
  11.     call YDWESaveRealByString( table, "angle", angle )
  12.     call YDWESaveIntegerByString( table, "record", 0 )
  13.    
  14.    
  15.   
  16.     call TimerStart(t,.05,true,function RunTimer)
  17.     call RemoveLocation(tem)
  18.     set table = null
  19.     set knight = null
  20.     set t = null
  21. endfunction
复制代码
  1. function MoveTimer takes nothing returns nothing
  2.     local string table = I2S(YDWEGetTimerID(GetExpiredTimer()))
  3.     local unit source = YDWEGetUnitByString( table, "source")
  4.    
  5.     local real angle = YDWEGetRealByString( table, "angle")
  6.     local location loc = GetUnitLoc(source)
  7.     local integer flag
  8.     local real distance
  9.     local location loc2 = PolarProjectionBJ(loc, 1000.00, ( angle + 180.00 ))
  10.     local integer i = 1
  11.     local location tem
  12.     call DisplayTimedTextToForce( GetPlayersAll(), 30, table )
  13.     loop
  14.         exitwhen i > 2
  15.         set flag = GetRandomInt(1, 2)
  16.         if(flag == 1) then
  17.              set tem = PolarProjectionBJ(loc2, GetRandomReal(0, 1000.00), ( angle + 90.00 ))
  18.              call run(tem,angle,source)
  19.         else
  20.              set tem = PolarProjectionBJ(loc2, GetRandomReal(0, 1000.00), ( angle - 90.00 ))
  21.              call run(tem,angle,source)
  22.         endif
  23.                
  24.         set i = i + 1
  25.      endloop
  26.      call RemoveLocation(loc)
  27.      call RemoveLocation(loc2)
  28.      if(GetUnitAbilityLevel(source, 'Aasl') == 0) then
  29.         call PauseTimer(GetExpiredTimer())
  30.     call YDWEFlushMissionByString( table )   
  31.     call DestroyTimer(GetExpiredTimer())
  32.     endif
  33.    
  34.     set table = null
  35.     set source = null
  36.     set loc = null
  37.     set loc2 = null
  38.     set tem = null
  39. endfunction
复制代码
  1. function Trig_knight_run_Actions takes nothing returns nothing
  2.     local unit gtu = GetTriggerUnit()
  3.     local location loc_gtu = GetUnitLoc(gtu)
  4.     local string table
  5.     local timer t = CreateTimer()
  6.     local location gstl = GetSpellTargetLoc()
  7.    
  8.     local real angle = AngleBetweenPoints(loc_gtu, gstl)
  9.     call UnitAddAbility( gtu, 'Aasl' )
  10.     set table = I2S(YDWEGetTimerID(t))
  11.     call DisplayTimedTextToForce( GetPlayersAll(), 30, I2S(YDWEGetTimerID(t)) )
  12.     call YDWESaveUnitByString( table, "source", gtu )
  13.     call YDWESaveRealByString( table, "angle", angle )
  14.    
  15.    
  16.   
  17.     call TimerStart(t,1.00,true,function MoveTimer)
  18.     call RemoveLocation(loc_gtu)
  19.     call RemoveLocation(gstl)
  20.     set gstl = null
  21.     set gtu = null
  22.     set table = null
  23.     set loc_gtu = null
  24.     set t = null
  25. endfunction
复制代码
技能是模拟兽王的大招。。
init 和condition就不贴上来了。。那个没问题。。还有一段是单位结束施法后去除Asal的

多谢[s:190][s:190][s:190]
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-23 16:32 , Processed in 0.032672 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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