|
楼主 |
发表于 2008-2-22 16:19:54
|
显示全部楼层
zhuzeitou师父,可不可以把您的代码加上点注释,给我解释一下啊:
function BaoFengXueStop takes nothing returns nothing
local trigger trg = GetTriggeringTrigger()
local timer tm = I2T(GetStoredInteger(GameCache(), I2S(H2I(trg)), "timer"))
local integer index = GetStoredInteger(GameCache(), I2S(H2I(tm)), "index")
set index = 20
call StoreInteger(GameCache(), I2S(H2I(tm)), "index", index)
set tm = null
set trg = null
endfunction
function BaoFengXueTeXiao takes nothing returns nothing
local timer tm = GetExpiredTimer()
local integer index = GetStoredInteger(GameCache(), I2S(H2I(tm)), "index")
local rect rtA = I2RC(GetStoredInteger(GameCache(), I2S(H2I(tm)), "rect"))
local location rdm = GetRandomLocInRect(rtA)
local effect eff
local trigger trg = I2TG(GetStoredInteger(GameCache(), I2S(H2I(tm)), "trigger"))
if index > 19 then
call PauseTimer(tm)
call DestroyTimer(tm)
call DestroyTriggerAll(trg)
call RemoveRect(rtA)
else
set index = index + 1
call StoreInteger(GameCache(), I2S(H2I(tm)), "index", index)
set eff = AddSpecialEffectLoc("Objects\\\\Spawnmodels\\\\Naga\\\\NagaDeath\\\\NagaDeath.mdl", rdm)
call DestroyEffect(eff)
endif
set tm = null
set rtA = null
call RemoveLocation(rdm)
set rdm = null
set eff = null
set trg = null
endfunction
function Trig_BaoFengXue_______u_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A000' ) ) then
return false
endif
return true
endfunction
function Trig_BaoFengXue_______u_Actions takes nothing returns nothing
local rect rtA = RectFromCenterSizeBJ(GetSpellTargetLoc(), 500.00, 500.00)
local unit u = GetTriggerUnit()
local timer tm = CreateTimer()
local trigger trg = CreateTrigger()
local triggeraction ta
local integer index = 0
call TriggerRegisterUnitEvent(trg, u, EVENT_UNIT_SPELL_ENDCAST)
set ta = TriggerAddAction(trg, function BaoFengXueStop)
call StoreInteger(GameCache(), I2S(H2I(trg)), "TriggerAction", H2I(ta))
call StoreInteger(GameCache(), I2S(H2I(trg)), "timer", H2I(tm))
call StoreInteger(GameCache(), I2S(H2I(tm)), "trigger", H2I(trg))
call StoreInteger(GameCache(), I2S(H2I(tm)), "index", index)
call StoreInteger(GameCache(), I2S(H2I(tm)), "rect", H2I(rtA))
call TimerStart(tm, 0.2, true, function BaoFengXueTeXiao)
set rtA = null
set u = null
set tm = null
set trg = null
set ta = null
endfunction
//===========================================================================
function InitTrig_BaoFengXue takes nothing returns nothing
set gg_trg_BaoFengXue = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_BaoFengXue, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_BaoFengXue, Condition( function Trig_BaoFengXue_______u_Conditions ) )
call TriggerAddAction( gg_trg_BaoFengXue, function Trig_BaoFengXue_______u_Actions )
endfunction |
|