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

請教一下二個問題..

[复制链接]
发表于 2010-1-17 16:57:52 | 显示全部楼层 |阅读模式
第一問題: 可不可以在loop中加入timer..?  因為設置了局部變量real好像在loop中使用等待real秒也有點問題"
第二是:    是不是局部變量不能使用於2個觸法?  在第一個觸法記錄了施法位置  在第二個觸法就好像捕捉不到第一個觸法的施法位置了"?  是不是要用GC來記錄?
請問以下可不可以用time來取代等待??
  1. function Trig_one_______u_Actions takes nothing returns nothing
  2.     local location array p3
  3.     local location array p2
  4.     local real array r2
  5.     local integer array i
  6.     local lightning array s2
  7.     set udg_p1[0] = GetSpellTargetLoc()
  8.     set r2[5] = 0.01
  9.     set r2[6] = 12
  10.     set r2[2] = 148.00
  11.     set r2[3] = 180.00
  12.     set r2[4] = 218.00
  13.     set i[0] = 1
  14.     set i[1] = 48   
  15.     set i[2] = 49
  16.     set i[3] = 148
  17.     set p2[0] = GetSpellTargetLoc()
  18.     set bj_forLoopAIndex = i[0]
  19.     set bj_forLoopAIndexEnd = i[1]
  20.     loop
  21.         exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
  22.         set p2[bj_forLoopAIndex] = PolarProjectionBJ(p2[0], ( 280.00 + ( I2R(bj_forLoopAIndex) * 1.80 ) ), ( I2R(bj_forLoopAIndex) * 42.00 ))
  23.         set bj_forLoopAIndex = bj_forLoopAIndex + 1
  24.     endloop
  25.     set bj_forLoopAIndex = i[0]
  26.     set bj_forLoopAIndexEnd = i[1]
  27.     loop
  28.         exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
  29.         call AddLightningLoc( "AFOD", p2[bj_forLoopAIndex], p2[( bj_forLoopAIndex + 1 )] )
  30.         call SetLightningColor( GetLastCreatedLightningBJ(), GetRandomReal(0, 28.00), GetRandomReal(0, 89.00), GetRandomReal(0, 38.00), 1 )
  31.         set s2[bj_forLoopAIndex] = bj_lastCreatedLightning
  32.         call TriggerSleepAction( r2[5] )   //<<<<<<<<<<<<<<<
  33.         set bj_forLoopAIndex = bj_forLoopAIndex + 1
  34.     endloop
复制代码
先謝謝各位了"&#160;&#160;
发表于 2010-1-17 20:45:34 | 显示全部楼层
loop里面可以抛出timer,也可以等待
回复

使用道具 举报

 楼主| 发表于 2010-1-17 22:02:57 | 显示全部楼层
再請問一下"  
  1. function Trig_YE_Func001002003 takes nothing returns boolean
  2.     return ( IsUnitEnemy(GetFilterUnit(), Player(0)) == true )
  3. endfunction
  4. function Trig_YE_Func002A takes nothing returns nothing
  5.     local timer t = GetExpiredTimer()
  6.     local real x = LoadReal(HashTable(), GetHandleId(t), 0)
  7.     local real y = LoadReal(HashTable(), GetHandleId(t), 1)
  8.     local location array p2
  9.     set p2[0] = udg_p1[0]   //這裡應該怎樣改??
  10.     set p2[300] = GetUnitLoc(GetEnumUnit())  //這裡應該怎樣改??
  11.     call SetUnitPositionLoc( GetEnumUnit(), PolarProjectionBJ(p2[300], 18.00, ( AngleBetweenPoints(p2[300], p2[0]) + 180.00 )) )  //這裡應該怎樣改??
  12. endfunction
  13. function Trig_YE_Actions takes nothing returns nothing
  14.     local group G2
  15.     local location array p2
  16.     set p2[0] = udg_p1[0]
  17.     set G2 = GetUnitsInRangeOfLocMatching(498.00, p2[0], Condition(function Trig_YE_Func001002003))
  18.     call ForGroupBJ( G2, function Trig_YE_Func002A )
  19. endfunction
  20. //===========================================================================
  21. function InitTrig_YE takes nothing returns nothing
  22.     local timer t = CreateTimer()
  23.     set gg_trg_YE = CreateTrigger(  )
  24.     call DisableTrigger( gg_trg_YE )
  25.     call TimerStart(t,0.02,true,function Trig_YE_Actions )
  26.     set t=null
  27. endfunction
复制代码
裹面的點要怎樣改?
回复

使用道具 举报

发表于 2010-1-17 23:08:33 | 显示全部楼层
你要干啥?我不喜欢看代码
回复

使用道具 举报

 楼主| 发表于 2010-1-18 03:40:16 | 显示全部楼层
我只是想把我做的這個觸法技能改為可以支持多人使用"
回复

使用道具 举报

发表于 2010-1-18 13:29:35 | 显示全部楼层
。。我说了我不喜欢看代码。。。直接上逻辑
回复

使用道具 举报

发表于 2010-9-14 01:08:47 | 显示全部楼层
引用第5楼eff于2010-01-18 13:29发表的  :
。。我说了我不喜欢看代码。。。直接上逻辑


做人要低调!没人欠你的
回复

使用道具 举报

发表于 2010-9-14 15:51:51 | 显示全部楼层
可怜的eff只是要楼主解释下他想要实现什么...
回复

使用道具 举报

发表于 2010-10-4 12:01:43 | 显示全部楼层
[jass]
set G2 = GetUnitsInRangeOfLocMatching(498.00, p2[0], Condition(function Trig_YE_Func001002003))
call ForGroupBJ( G2, function Trig_YE_Func002A )
[/jass]
这2句话和单位组里动作改成下面的模板,局部变量自己申明。

[jass]
    set g = CreateGroup()
    call GroupEnumUnitsInRange(g,GetLocationX(p2[0]),GetLocationY(p2[0]),498,null)
    loop
        set ut=FirstOfGroup(g)
        exitwhen ut == null

        //做你的动作

        call GroupRemoveUnit(g,ut)
        set ut = null
    endloop
    call DestroyGroup(g)
    set g = null
[/jass]
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-3 18:04 , Processed in 0.112981 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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