|
发表于 2008-12-9 16:44:36
|
显示全部楼层
[jass]
function CatchCastingActions takes nothing returns nothing
local player localplayer = GetLocalPlayer()
local unit localunit = GetTriggerUnit()
local integer spell
local string str
if(GetTriggerEventId() == EVENT_PLAYER_UNIT_SPELL_EFFECT)then
set str = "使用了"
set spell = GetSpellAbilityId()
else
set str = "学习了"
set spell = GetLearnedSkill()
endif
call DisplayTimedTextToPlayer(localplayer,0,0,1,GetPlayerName(GetTriggerPlayer()) + "的" + GetUnitName(localunit) + str + GetObjectName(spell) + "(" + I2S(spell) + ")")
set localunit = null
endfunction
function AddInitialize takes nothing returns nothing
local trigger CatchCasting=CreateTrigger()
local integer index = 0
loop
call TriggerRegisterPlayerUnitEvent(CatchCasting,Player(index),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(CatchCasting,Player(index),EVENT_PLAYER_HERO_SKILL,null)
set index = index + 1
exitwhen index >= bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(CatchCasting,Condition(function CatchCastingActions))
endfunction
[/jass]
再在main函数最后添加call AddInitialize() |
|