找回密码
 点一下
查看: 1790|回复: 5

求排泄

[复制链接]
发表于 2010-8-3 22:22:04 | 显示全部楼层 |阅读模式
之前的问题解决了,求大爷们帮忙排个泄。
感激不尽!

[jass]function Trig_zlns_TimerFunc takes nothing returns nothing
    local real angle
    local location p2
    local unit target = LoadUnitHandle( GetLastCreatedHashtableBJ(), GetHandleId(GetExpiredTimer()), StringHash("target") )
    local location p = LoadLocationHandle( GetLastCreatedHashtableBJ(), GetHandleId(GetExpiredTimer()), StringHash("point") )
    local integer n = LoadInteger( GetLastCreatedHashtableBJ(), GetHandleId(GetExpiredTimer()), StringHash("n") )
  if n < 20 then
    set n = n+1
    call SaveInteger( GetLastCreatedHashtableBJ(), GetHandleId(GetExpiredTimer()), StringHash("n"),n )
    set p2 = GetUnitLoc(target)
    if ( DistanceBetweenPoints(p2, p) > 300.00 ) then
      set angle = AngleBetweenPoints(p, p2)
      call SetUnitX( target,( GetLocationX(p)+( 300 * CosBJ(angle) ) ) )
      call SetUnitY( target,( GetLocationY(p)+( 300 * SinBJ(angle) ) ) )
      set target = null
      call RemoveLocation(p2)
    endif
  else
    set target = null
    call RemoveLocation(p)
    call RemoveLocation(p2)
    call FlushChildHashtable( GetLastCreatedHashtableBJ(), GetHandleId(GetExpiredTimer()) )
    call DestroyTimer(GetExpiredTimer())
  endif
endfunction
function Trig_zlns_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A002' ) ) then
        return false
    endif
    return true
endfunction
function Trig_zlns_Actions takes nothing returns nothing
    local integer n = 0
    local unit caster = GetTriggerUnit()
    local unit target = GetSpellTargetUnit()
    local location p = GetUnitLoc(target)
    set bj_lastStartedTimer = CreateTimer()
    //call SaveUnitHandleBJ( caster, GetHandleIdBJ(caster), GetHandleIdBJ(bj_lastStartedTimer), GetLastCreatedHashtableBJ() )
    call SaveUnitHandle( GetLastCreatedHashtableBJ(), GetHandleId(bj_lastStartedTimer), StringHash("target"), target )
    call SaveLocationHandle( GetLastCreatedHashtableBJ(), GetHandleId(bj_lastStartedTimer), StringHash("point"), p )
    call SaveInteger( GetLastCreatedHashtableBJ(), GetHandleId(bj_lastStartedTimer), StringHash("n"),n )
    call TimerStart(bj_lastStartedTimer,0.2,true, function Trig_zlns_TimerFunc)
endfunction
//===========================================================================
function InitTrig_zlns takes nothing returns nothing
    set gg_trg_zlns = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_zlns, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_zlns, Condition( function Trig_zlns_Conditions ) )
    call TriggerAddAction( gg_trg_zlns, function Trig_zlns_Actions )
endfunction[/jass]
发表于 2010-8-3 23:05:35 | 显示全部楼层
应该是某个点的数据丢失
回复

使用道具 举报

发表于 2010-8-3 23:14:22 | 显示全部楼层
应该是
call RemoveLocation(p)
的问题

把这句去掉试试(或者换成set null)
回复

使用道具 举报

 楼主| 发表于 2010-8-4 07:46:37 | 显示全部楼层
引用第2楼希瓦于2010-08-03 23:14发表的  :
应该是
call RemoveLocation(p)
的问题

把这句去掉试试(或者换成set null)


非常感谢。

昨晚睡觉之前发的帖,上床想了下就突然想通了。

不过能有大爷帮忙排排泻么~
回复

使用道具 举报

发表于 2010-8-4 09:53:19 | 显示全部楼层
大概只要把所有局部变量(除了“整数”)都set null就好了吧。
回复

使用道具 举报

发表于 2010-8-4 12:41:27 | 显示全部楼层
包括bj改cj,去下jasscraft吧,然后把带bj的函数改成不带的,注意参数顺序。剩下的,还有很多可以优化
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-3 15:32 , Processed in 0.059863 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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