找回密码
 点一下
查看: 1036|回复: 15

寻找掉线原因

[复制链接]
发表于 2009-2-26 05:06:16 | 显示全部楼层 |阅读模式
[codes=jass]function CtrlCameraForUnit takes unit ua,player p returns nothing
call Debug("CtrlCameraForUnit")
if (GetLocalPlayer() == p) then
call ClearSelection()
call SelectUnit(ua,true)
call PanCameraToTimed( GetUnitX(CHero),GetUnitY(CHero), 0 )
endif
endfunction


function ReplaceUnitByItemId takes unit ua,integer ItemIdA,integer ItemIdB returns item
local integer i = 0
local item x
    loop
        set x = UnitItemInSlot(ua, i)
        if (x != null) and (GetItemTypeId(x) == ItemIdA) then
        call RemoveItem(x)
        call UnitAddItemToSlotById(ua,ItemIdB,i)
        set x =UnitItemInSlot(ua,i)
        set i = 6
        endif
        set i = i + 1
        exitwhen i > 5
    endloop
return x
endfunction


function EnterStarArea_Conditions takes nothing returns nothing
    if ( UnitHasItemOfTypeBJ(GetTriggerUnit(), 'rde2') == true ) and ( UnitHasItemOfTypeBJ(GetTriggerUnit(), 'wneg') == true )and XXX[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] >= 1 then
    call DisplayTextToForce(MsgInRangePlayers(GetTriggerUnit()), "|CFFFF0000潜伏者:“拥有星之翼的人啊,你将从这里直达星界!”|R" )
    call DisplayTextToPlayer( GetOwningPlayer(GetTriggerUnit()), 0, 0, "|Cffffff00你的博士法袍上的装饰物正在散发出群星的光彩。|R" )
    set Item = ReplaceUnitByItemId(GetTriggerUnit(),'wneg','ktrm')
    call SetUnitPosition( GetTriggerUnit(), GetRectCenterX(gg_rct_StarArea), GetRectCenterY(gg_rct_StarArea) )
    call CtrlCameraForUnit(GetTriggerUnit(),GetOwningPlayer(GetTriggerUnit()))
    endif
endfunction

//===========================================================================
function InitTrig_EnterStarArea takes nothing returns nothing
    set gg_trg_EnterStarArea = CreateTrigger(  )
    call TriggerRegisterUnitInRangeSimple( gg_trg_EnterStarArea, 256, gg_unit_n003_0573 )
    call TriggerAddCondition( gg_trg_EnterStarArea, Condition( function EnterStarArea_Conditions ) )
endfunction



[/codes]
 楼主| 发表于 2009-2-26 05:09:48 | 显示全部楼层
在触发了
function InitTrig_EnterStarArea takes nothing returns nothing
    set gg_trg_EnterStarArea = CreateTrigger(  )
    call TriggerRegisterUnitInRangeSimple( gg_trg_EnterStarArea, 256, gg_unit_n003_0573 )
    call TriggerAddCondition( gg_trg_EnterStarArea, Condition( function EnterStarArea_Conditions ) )
endfunction


这个触发器之后,很快就会有非主机的玩家掉线。
回复

使用道具 举报

发表于 2009-2-26 10:57:59 | 显示全部楼层
某JASS盲闭眼飘过
回复

使用道具 举报

发表于 2009-2-26 11:10:04 | 显示全部楼层

 

- -!
麻烦LZ再把范围缩小一点。
这么长 看完天都黑了。
回复

使用道具 举报

发表于 2009-2-26 11:41:56 | 显示全部楼层
这写 T 我难翻译。。。
你弄成中文了,我再来看看。。
回复

使用道具 举报

发表于 2009-2-26 13:15:08 | 显示全部楼层
根据LZ的描述:【这个触发器之后,很快就会有非主机的玩家掉线。】
中的【很快】就是过了一会吧(我猜)~~
如果是过了一会就掉,那么应该是LZ的Timer(多半是函数)出了些问题。
如果是瞬间掉,则是这个触发器本身的问题,不用去查Timer的函数。

还有可能就是GameCache没Init之类的大众问题~~
回复

使用道具 举报

 楼主| 发表于 2009-2-26 18:40:05 | 显示全部楼层

Re: 

引用第3楼lunaflywar于2009-02-26 11:10发表的   :
- -!
麻烦LZ再把范围缩小一点。
这么长 看完天都黑了。



我也想把范围缩小,可是根本不知道哪出了问题。

掉线是在ArchMageTower运行之后。
回复

使用道具 举报

 楼主| 发表于 2009-2-26 18:41:00 | 显示全部楼层
还有可能就是GameCache没Init之类的大众问题~~

这个肯定是做过了的,这个触发器以前也没有掉线的毛病。

刚刚重新测试了一下,缩小了BUG的范围。
回复

使用道具 举报

发表于 2009-2-26 20:15:36 | 显示全部楼层
[jass]
function CtrlCameraForUnit takes unit ua,player p returns nothing
local real unitX=GetUnitX(CHero)
local real unitY=GetUnitY(CHero)
call Debug("CtrlCameraForUnit")
if (GetLocalPlayer() == p) then
call ClearSelection()
call SelectUnit(ua,true)
call PanCameraToTimed( unitX,unitY, 0 )
endif
endfunction
[/jass]


试试
回复

使用道具 举报

 楼主| 发表于 2009-2-26 20:22:56 | 显示全部楼层
LS说得不可以的
local real unitX=GetUnitX(CHero)
local real unitY=GetUnitY(CHero)
不行。
在这里,CHero是作为不同步变量使用的。
回复

使用道具 举报

发表于 2009-2-26 20:24:36 | 显示全部楼层
变量不同步是会掉线的
回复

使用道具 举报

 楼主| 发表于 2009-2-26 20:42:43 | 显示全部楼层
RuneSpirit 20:38:40
这个功能是 星界
RuneSpirit 20:38:57
就是玩家当携带3件东西,同时幸运度大于1的时候
RuneSpirit 20:39:00
就可以进入


RuneSpirit 20:39:19
这个触发器就是星界进入的功能。
RuneSpirit 20:39:37
现在的问题是,单独进入星界,不会掉线。 (就是说单独运行星界设置不会掉线)
RuneSpirit 20:39:45
只有运行了星界进入这个触发器
RuneSpirit 20:39:51
才会掉线
RuneSpirit 20:40:08
掉线的时刻 在星界设置功能结束
回复

使用道具 举报

 楼主| 发表于 2009-2-26 20:43:22 | 显示全部楼层
引用第10楼马甲君于2009-02-26 20:24发表的 :
变量不同步是会掉线的



这个不会,只要保持他们一直不同步就好了。
而且问题也不是这个。
回复

使用道具 举报

发表于 2009-2-26 20:56:57 | 显示全部楼层
引用第11楼马甲终结者于2009-02-26 20:42发表的  :
RuneSpirit 20:38:40
这个功能是 星界
RuneSpirit 20:38:57
就是玩家当携带3件东西,同时幸运度大于1的时候
RuneSpirit 20:39:00
.......

这个再说得清楚一点

我试过,变量不同步,在不同步之后的2-5秒掉线
回复

使用道具 举报

 楼主| 发表于 2009-2-26 21:50:46 | 显示全部楼层
老狼教我一个用法,就是给变量赋不同步的值。
回复

使用道具 举报

发表于 2009-2-26 21:59:34 | 显示全部楼层
我的意思是,你再吧掉线条件描述清楚一点

可以每一步都DEBUGS看看
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-7-21 16:24 , Processed in 0.031512 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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