|
自己做了张图是用小精灵选英雄的,但是不知道怎么样让一上来创建的精灵数目与实际的玩家数目匹配。比如我这张图最大能8个玩家玩,但是现在只有3个玩家玩,于是一上来创建3个小精灵分别给3个人,如果是5人玩就创建5个精灵。但是我自己做的触发和朋友一玩除了主机别人就都掉线了,为什么呢?正确的触发应该如何写?以下是我错误的触发:
function Trig_xiaojingling_Func001001001001 takes nothing returns boolean
return ( GetPlayerSlotState(GetFilterPlayer()) == PLAYER_SLOT_STATE_PLAYING )
endfunction
function Trig_xiaojingling_Func001001001002 takes nothing returns boolean
return ( GetPlayerController(GetFilterPlayer()) == MAP_CONTROL_USER )
endfunction
function Trig_xiaojingling_Func001001001 takes nothing returns boolean
return GetBooleanAnd( Trig_xiaojingling_Func001001001001(), Trig_xiaojingling_Func001001001002() )
endfunction
function Trig_xiaojingling_Func001A takes nothing returns nothing
local location a = GetRectCenter(gg_rct________012)
call SmartCameraPanBJ( GetEnumPlayer(), a , 0.5 )
call CreateNUnitsAtLoc( 1, 'ewsp', GetEnumPlayer(), a , bj_UNIT_FACING )
call RemoveLocation( a )
call AdjustPlayerStateBJ( 800, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD )
endfunction
function Trig_xiaojingling_Actions takes nothing returns nothing
local force b = GetPlayersMatching(Condition(function Trig_xiaojingling_Func001001001))
call ForForce( b , function Trig_xiaojingling_Func001A )
call DestroyForce( b )
endfunction
//===========================================================================
function InitTrig_xiaojingling takes nothing returns nothing
set gg_trg_xiaojingling = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_xiaojingling, 1.00 )
call TriggerAddAction( gg_trg_xiaojingling, function Trig_xiaojingling_Actions )
endfunction |
|