找回密码
 点一下
查看: 2005|回复: 1

一个菜鸟的新的求助。。关于哈希表的使用

[复制链接]
发表于 2010-12-21 18:50:21 | 显示全部楼层 |阅读模式
  1. globals
  2.     hashtable tf_hash = InitHashtable()
  3. endglobals
  4. library txxx initializer initsb
  5. function timerzhouqi takes nothing  returns nothing //计时器循环
  6.     local integer i = GetHandleId(GetExpiredTimer()) //获取到期计时器的整数地址
  7.     local unit a = LoadUnit(tf_hash, i, 1) //从1号位置读取单位a
  8.     local unit b = LoadUnit(tf_hash, i, 2) //从2号位置读取单位b
  9.     local real j = LoadReal(tf_hash, i, 3) // 读取3号位置的j, 一开始是0
  10.     local location loc_c = GetUnitLoc(a)
  11.     local location loc_b = GetUnitLoc(b)
  12.     local location loc_a =  PolarProjectionBJ(loc_c, 30, AngleBetweenPoints(b, a))
  13.     call SaveReal(tf_hash, i, 3, j+0.05)
  14.     if j <= 1 then
  15.         call SetUnitPositionLoc( a,loc_a  )
  16.     else
  17.        call DestroyTimer(GetExpiredTimer())
  18.        call FlushChildHashtable(tf_hash, i)
  19.     endif
  20.     call RemoveLocation(loc_a)
  21.     call RemoveLocation(loc_c)
  22.     call RemoveLocation(loc_b)
  23.     set a = null
  24.     set b = null
  25. endfunction
  26. function tf takes unit a,unit b returns nothing                //动作函数
  27.     local timer t = CreateTimer()
  28.     local integer i = GetHandleId(t) //获取t的整数地址
  29.     call SaveUnitHandle(tf_hash, i, 1, a)  //把a储存在1号位置
  30.     call SaveUnitHandle(tf_hash, i, 2, b)  //把b储存在2号位置
  31.     call TimerStart( t ,0.05,true,function timerzhouqi)
  32.     set a = null
  33.     set b = null
  34. endfunction
  35. function tx takes nothing returns nothing                //动作函数
  36.     local unit a = GetTriggerUnit()
  37.     local location b = GetUnitLoc(a)
  38.     call DestroyEffect( AddSpecialEffectLoc("Objects\\Spawnmodels\\Undead\\UndeadLargeDeathExplode\\UndeadLargeDeathExplode.mdl", b) )
  39.     call RemoveLocation(b)
  40.     call tf(GetTriggerUnit(),GetKillingUnit())
  41.     set a = null
  42. endfunction
  43. function tx2 takes nothing returns boolean
  44.     if ( not ( IsUnitAlly(GetTriggerUnit(), Player(11)) == true ) ) then
  45.         return false
  46.     endif
  47.     return true
  48. endfunction
  49. function initsb takes nothing returns nothing
  50.     local trigger t = CreateTrigger()
  51.     call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_DEATH)
  52.     call TriggerAddCondition( t, Condition( function tx2 ) )
  53.     call TriggerAddAction( t, function tx )
  54. endfunction
  55. endlibrary
复制代码
发表于 2010-12-21 21:56:13 | 显示全部楼层
不要贴一段代码连问题是什么都不说…………

顺便,标题不要那么卑躬屈膝的样子,推荐一个关于提问技巧文章的链接,《提问的智慧》,http://www.beiww.com/doc/oss/smart-questions.html
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-28 20:42 , Processed in 0.151433 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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