|
[codes=jass]function DH_learn_Actions takes unit ua returns nothing
set udg_Skill[1]= 'A00P'
set udg_Skill[2]= 'A00Q'
set udg_Skill[3]= 'A00R'
set udg_Skill[4]= 'A01K'
call learn(ua,GetUnitLevel(ua))
endfunction
function DH_learn_Condition1 takes nothing returns nothing
if ( GetPlayerController(GetOwningPlayer(GetLevelingUnit())) == MAP_CONTROL_COMPUTER ) and ( GetUnitTypeId(GetLevelingUnit()) == 'Edem' ) then
call DH_learn_Actions(GetLevelingUnit())
endif
endfunction
function DH_learn_Condition2 takes nothing returns nothing
if ( GetPlayerController(GetOwningPlayer(GetTrainedUnit())) == MAP_CONTROL_COMPUTER ) and ( GetUnitTypeId(GetTrainedUnit()) == 'Edem' ) then
call DH_learn_Actions(GetTrainedUnit())
endif
endfunction
//===========================================================================
function InitTrig_DH_learn takes nothing returns nothing
local trigger t
set gg_trg_DH_learn = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_DH_learn, EVENT_PLAYER_HERO_LEVEL )
call TriggerAddCondition( gg_trg_DH_learn, Condition( function DH_learn_Condition1 ) )
set t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_TRAIN_FINISH )
call TriggerAddCondition( t, Condition( function DH_learn_Condition2 ) )
set t = null
endfunction
[/codes]
虽然触发器没控制删除,但问题应该不大吧。 |
|