找回密码
 点一下
查看: 1500|回复: 0

一个函数问题- - 及其诡异

[复制链接]
发表于 2008-5-13 20:40:26 | 显示全部楼层 |阅读模式
[jass]function ItemYMS takes nothing returns nothing
local integer TimeInt      = H2I(GetExpiredTimer())
local integer TrigUnit     = GetHandleInt(TimeInt,"英雄")
local real    x            = GetUnitX(I2U(TrigUnit))
local real    X            = GetHandleReal(TrigUnit,"YMSX")

  if     x != X and (GetUnitState(I2U(TrigUnit), UNIT_STATE_LIFE) < GetUnitState(I2U(TrigUnit), UNIT_STATE_MAX_LIFE) or GetUnitState(I2U(TrigUnit), UNIT_STATE_MANA) < GetUnitState(I2U(TrigUnit), UNIT_STATE_MAX_MANA)) then
    call SetUnitState(I2U(TrigUnit), UNIT_STATE_LIFE,GetUnitState(I2U(TrigUnit), UNIT_STATE_LIFE) + ( GetUnitState(I2U(TrigUnit), UNIT_STATE_MAX_LIFE) * 0.01 * GetHandleInt(H2I(gg_trg_ItemAbililty),ConvertIdString(GetItemTypeId(ItemUs(I2U(TrigUnit),'ratc'))) + "装备等级") ))
    call SetUnitState(I2U(TrigUnit), UNIT_STATE_MANA,GetUnitState(I2U(TrigUnit), UNIT_STATE_MANA) + ( GetUnitState(I2U(TrigUnit), UNIT_STATE_MAX_MANA) * 0.01 * GetHandleInt(H2I(gg_trg_ItemAbililty),ConvertIdString(GetItemTypeId(ItemUs(I2U(TrigUnit),'ratc'))) + "装备等级") ))
  endif

    call SetHandleReal(TrigUnit,"YMSX",x)
endfunction

function LoopTimer takes integer TrigUnit,real TimerReal,item ItemInt,code LoopFun,boolean boo returns nothing
local integer TimeInt

  if  boo then
set   TimeInt = H2I(CreateTimer())
call  SetHandleInt(TimeInt,"英雄",TrigUnit)
call  SetHandleInt(TrigUnit,I2S(H2I(ItemInt)),TimeInt)
call  TimerStart( I2t(TimeInt),TimerReal,true,LoopFun )
  else
set   TimeInt = GetHandleInt(TrigUnit,I2S(H2I(ItemInt)))
call  FlushHandleInt(TimeInt,"英雄")
call  FlushHandleInt(TrigUnit,I2S(H2I(ItemInt)))
call  StopTimer(TimeInt)
  endif
endfunction

function Trig_ItemLoopEvent_Conditions takes nothing returns boolean

     if GetItemTypeId(GetManipulatedItem()) == 'ratc' then
     
    call SetHandleReal(H2I(GetTriggerUnit()),"YMSX",GetUnitX(GetTriggerUnit()))
    call LoopTimer(H2I(GetTriggerUnit()),1,GetManipulatedItem(),function ItemYMS,true)

endif

    return false
endfunction

function InitTrig_ItemLoopEvent takes nothing returns nothing
local integer t
local integer index
  set  t  = H2I(CreateTrigger())
  set  index = 0
  loop
       call TriggerRegisterPlayerUnitEvent(I2T(t), Player(index), EVENT_PLAYER_UNIT_PICKUP_ITEM, null)
       set  index = index + 1
       exitwhen index == 15
    endloop
    if Trig_ItemLoopEvent_Conditions() then
    endif
    call TriggerAddCondition(I2T(t), Condition( function Trig_ItemLoopEvent_Conditions ) )
endfunction[/jass]


这个物品获得后大概50%的几率会使所有人的屏幕和操作一秒一卡,有50%几率就正常不会卡

卡的时候函数内容正常运行....

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

本版积分规则

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

GMT+8, 2024-11-24 06:03 , Processed in 0.134409 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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