发新话题
打印

求做防单机的触发

求做防单机的触发

如题~小弟的图想弄成防单机的,却不知道做,还希望知道和会的大大教下我啊~~

TOP

搜索把

TOP

function Trig_panduan_Func001Func001Func001C takes nothing returns boolean
    if ( ( GetPlayerSlotState(ConvertedPlayer(GetForLoopIndexA())) == PLAYER_SLOT_STATE_EMPTY ) ) then
        return true
    endif
    if ( ( GetPlayerName(ConvertedPlayer(GetForLoopIndexA())) == udg_player ) ) then
        return true
    endif
    return false
endfunction
function Trig_panduan_Func001Func001C takes nothing returns boolean
    if ( not Trig_panduan_Func001Func001Func001C() ) then
        return false
    endif
    return true
endfunction
function Trig_panduan_Func002001 takes nothing returns boolean
    return ( udg_palyNULL == 11 )
endfunction
function Trig_panduan_Actions takes nothing returns nothing
    set bj_forLoopAIndex = 0
    set bj_forLoopAIndexEnd = 11
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        if ( Trig_panduan_Func001Func001C() ) then
            set udg_palyNULL = ( udg_palyNULL + 1 )
        else
            call DoNothing(  )
        endif
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    if ( Trig_panduan_Func002001() ) then
        call SetPlayerStateBJ( ConvertedPlayer(0), PLAYER_STATE_RESOURCE_GOLD, 0 )
    else
        call DoNothing(  )
    endif
endfunction
function InitTrig_panduan takes nothing returns nothing
    set gg_trg_panduan = CreateTrigger(  )
    call TriggerAddAction( gg_trg_panduan, function Trig_panduan_Actions )
endfunction
你地图初始过后运行gg_trg_panduan

大意是一个循环函数检测玩家的状态:如果是没有使用或者打开电脑了。那么一个变量加上1。这样执行11次过后如果那个变量等于11,那么就是单机,我帮你写好了,如果是单机就运行这句
call SetPlayerStateBJ( ConvertedPlayer(0), PLAYER_STATE_RESOURCE_GOLD, 0 )
这句ConvertedPlayer(0)会引起程序崩溃自动结束游戏-_-!
本帖最近评分记录
  • thody 金钱 +1 我就不懂你把t转j发**什么 2008-10-11 18:23

TOP

发新话题