请选择 进入手机版 | 继续访问电脑版

 找回密码
 点一下
查看: 1827|回复: 8

刚接触jass,自己写的代码出问题了,求帮忙看一下

[复制链接]
发表于 2010-6-11 13:55:46 | 显示全部楼层 |阅读模式
不知道为啥这段代码没效果- -。。。貌似我的GetSpellTargetUnit()获取不到- -。。。。求各位大大帮忙找找  小弟刚接触jass
  1. function H2I takes handle h returns integer
  2.     return h
  3.     return 0
  4. endfunction
  5. function I2U takes integer i returns unit
  6.     return i
  7.     return null
  8. endfunction
  9. function jtaction takes nothing returns nothing
  10.     local unit targetUnit = I2U(GetStoredInteger(udg_GC,"jt","tgUnit"))
  11.     call DisplayTextToPlayer(Player(0),0,0,I2S(H2I(targetUnit)))
  12.     call SetUnitPositionLoc(targetUnit,PolarProjectionBJ(GetUnitLoc(targetUnit),10,(GetUnitFacing(targetUnit)+180)))
  13. endfunction
  14. function Trig_oneJT_Conditions takes nothing returns boolean
  15.     if(not(GetSpellAbilityId() == 'Ahtb') )then
  16.         return FALSE
  17.     endif
  18.     return TRUE
  19. endfunction
  20. function Trig_oneJT_Actions takes nothing returns nothing
  21.     call StoreInteger(udg_GC,"jt","tgUnit",H2I(GetSpellTargetUnit()))
  22.     call TimerStart(CreateTimer(),0.50,TRUE,function jtaction)
  23. endfunction
  24. //==== Init Trigger oneJT ====
  25. function InitTrig_oneJT takes nothing returns nothing
  26.     set gg_trg_oneJT = CreateTrigger()
  27.     call TriggerRegisterAnyUnitEventBJ(gg_trg_oneJT,EVENT_PLAYER_UNIT_SPELL_CHANNEL )
  28.     call TriggerAddCondition(gg_trg_oneJT, Condition(function Trig_oneJT_Conditions))
  29.     call TriggerAddAction(gg_trg_oneJT, function Trig_oneJT_Actions)
  30. endfunction
复制代码
发表于 2010-6-11 14:32:28 | 显示全部楼层
[codes=jass]function Trig_oneJT_Actions takes nothing returns nothing
    local timer t = CreateTimer()
    call StoreInteger(udg_GC,I2S(H2I(t)),"tgUnit",H2I(GetSpellTargetUnit()))
    call TimerStarr(t,0.50,TRUE,function jtaction)
    set t = null
endfunction[/codes]
回复

使用道具 举报

 楼主| 发表于 2010-6-11 14:39:57 | 显示全部楼层

回 1楼(opmulyh) 的帖子

多谢1L  

不过不是那里的问题   是我条件的那个技能代码拼错了。。。。。。

还想问一下一般都怎么关闭循环的timer。。。。
回复

使用道具 举报

发表于 2010-6-11 14:48:03 | 显示全部楼层
if  xxxxx  then

call FlushStoredMission(udg_GC, I2S(H2I(t)))
call PauseTimer(ti)
call DestroyTimer(ti)

endif
set xx = null
.....
set t = null

----------- 帖子于 14:48 更新 --------- 之前内容发布于 14:46 ------------

那个JASS的电子书写的很详细 可以去看看...
回复

使用道具 举报

发表于 2010-6-13 21:01:56 | 显示全部楼层
GC淘汰了,换HASHTABLE吧
回复

使用道具 举报

发表于 2010-6-23 11:02:58 | 显示全部楼层
引用第4楼疯人¢衰人于2010-06-13 21:01发表的  :
GC淘汰了,换HASHTABLE吧


----------- 帖子于 11:02 更新 --------- 之前内容发布于 11:02 ------------

HASHTABLE怎么用呀  麻烦大师谢片教程呀
回复

使用道具 举报

发表于 2010-6-23 11:06:34 | 显示全部楼层
教程早就有了,搜索吧
回复

使用道具 举报

发表于 2010-6-30 18:54:10 | 显示全部楼层
目前还是1.20多 ...
回复

使用道具 举报

发表于 2010-7-4 13:20:52 | 显示全部楼层
SpellChannel这个注册的好像是始发准备么?这样无法捕捉目标,通常用spelleffect来注册。。。。。。。。。ui上也写有,如果施法结束将无法捕捉目标。。。。。可能施法开始也无法。。。
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-19 07:32 , Processed in 0.049404 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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