找回密码
 点一下
查看: 2075|回复: 3

[已解决]一个导致弹出游戏的触发

[复制链接]
发表于 2008-5-16 07:19:29 | 显示全部楼层 |阅读模式
[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]



虽然触发器没控制删除,但问题应该不大吧。
 楼主| 发表于 2008-5-16 07:20:19 | 显示全部楼层
call learn(ua,GetUnitLevel(ua)) 这个我以前就用的,应该没问题。
回复

使用道具 举报

发表于 2008-5-16 07:25:04 | 显示全部楼层
learn的函数是怎么样的呢??
回复

使用道具 举报

 楼主| 发表于 2008-5-16 16:45:46 | 显示全部楼层
learn函数没有问题
我把
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

拆开就好了
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-12-22 20:49 , Processed in 0.031557 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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