|
发表于 2012-4-25 18:02:15
|
显示全部楼层
双击选择英雄(PS:在公司,用记事本写的,有失误的地方还请谅解)
function trg_PickHero_Conditions takes nothing returns nothing
return IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO)
endfunction
// udg_HT 先声明并且初始化
function trg_PickHero_Actions takes nothing returns nothing
local integer parentKey = GetHandleId(GetTriggerUnit())//根据选取的单位获得P_ID
local integer pickCount = LoadInteger(udg_HT,parentKey,0)//C_ID就用0就行了,有没其他数据
if (pickCount==0) then
set pickCount++
call SaveInteger(udg_HT,parentKey,0)
elseif (pickCount==1) then
//选取成功,改变英雄所属...
endif
endfunction
function Init_trg_PickHero takes nothing returns nothing
set gg_trg_PickHero = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_PickHero,EVENT_PLAYER_UNIT_SELECTED)
call TriggerAddCondition(gg_trg_PickHero,function trg_PickHero_Conditions)
call TriggerAddAction(gg_trg_PickHero,function trg_PickHero_Actions)
endfunction |
|