找回密码
 点一下
查看: 1634|回复: 2

高人指点下,这个使用矩形制作的技能,该怎么完全排泄

[复制链接]
发表于 2009-7-20 03:50:39 | 显示全部楼层 |阅读模式
高人指点下,这个使用矩形制作的技能,该怎么完全排泄


//TESH.scrollpos=0
//TESH.alwaysfold=0
function Bengquan_Con takes nothing returns boolean
    return GetSpellAbilityId() == 'A090'
endfunction
function Bengquan_ActI takes nothing returns nothing
    local string s=I2S(H2I(GetExpiredTimer()))
    local unit u=I2U(GetStoredInteger(udg_GC,s,"u"))
    local real a=GetStoredReal(udg_GC,s,"a")
    local integer i=GetStoredInteger(udg_GC,s,"i")
    local group g=RectAct(100,200,a,GetUnitX(u),GetUnitY(u),CreateGroup(),false,false,GetPlayerId(GetOwningPlayer(u)))
    local unit ut=null
    local real d=GetStoredReal(udg_GC,s,"d")
    loop
        set ut=FirstOfGroup(g)
        call GroupRemoveUnit(g,ut)
        call UnitDamageTarget(u,ut,d,true,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_FORCE,WEAPON_TYPE_METAL_HEAVY_BASH)
        call SetUnitX(ut,GetUnitX(ut)+15*Cos(a))
        call SetUnitY(ut,GetUnitY(ut)+15*Sin(a))
        exitwhen ut==null
       endloop
    call SetUnitX(u,GetUnitX(u)+15*Cos(a))
    call SetUnitY(u,GetUnitY(u)+15*Sin(a))
    if i>2 then
        call DestroyTimer(GetExpiredTimer())
        call DestroyEffect(I2E(GetStoredInteger(udg_GC,s,"eff1")))
        call DestroyEffect(I2E(GetStoredInteger(udg_GC,s,"eff2")))
        call DestroyEffect(I2E(GetStoredInteger(udg_GC,s,"eff3")))
        call FlushStoredMission(udg_GC,s)
        call PauseUnit(u,false)
        call SetUnitTimeScale(u,1)
    else
        set i=i+1
        call StoreInteger(udg_GC,s,"i",i)
    endif
    set u=null
    call DestroyGroup(g)
    set g=null
    set ut=null
endfunction
function Bengquan_Act takes nothing returns nothing
    local location l=GetSpellTargetLoc()
    local unit u=GetTriggerUnit()
    local timer t=CreateTimer()
    local real a=Atan2(GetLocationY(l)-GetUnitY(u),GetLocationX(l)-GetUnitX(u))
    call PauseUnit(u,true)
    call StoreInteger(udg_GC,I2S(H2I(t)),"eff1",H2I(AddSpecialEffectTarget("Abilities \\Spells\\NightElf\\Blink\\BlinkCaster.mdl",u,"weapon")))
    call StoreInteger(udg_GC,I2S(H2I(t)),"eff2",H2I(AddSpecialEffectTarget("Abilities \\Spells\\Orc\\Disenchant\\DisenchantSpecialArt.mdl",u,"weapon")))
    call StoreInteger(udg_GC,I2S(H2I(t)),"eff3",H2I(AddSpecialEffectTarget("Abilities \\Spells\\Undead\\FreezingBreath\\FreezingBreathMissile.mdl",u,"weapon")))
    call SetUnitTimeScale(u,5)
    call SetUnitAnimation(u,"Attack Two")
    call StoreInteger(udg_GC,I2S(H2I(t)),"u",H2I(u))
    call StoreReal(udg_GC,I2S(H2I(t)),"a",a)
    call StoreReal(udg_GC,I2S(H2I(t)),"d",GetHeroStr(u,true)*0.5+25*GetUnitAbilityLevel(u,'A090'))
    call TimerStart(t,0.01,true,function Bengquan_ActI)
    set l=null
    set u=null
    set t=null
endfunction
function InitTrig_Bengquan takes nothing returns nothing
    set gg_trg_Bengquan = CreateTrigger()
    call TriggerRegisterUnitEvent(gg_trg_Bengquan,gg_unit_N004_0233,EVENT_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_Bengquan,Condition(function Bengquan_Con))
    call TriggerAddAction(gg_trg_Bengquan,function Bengquan_Act)
endfunction
发表于 2009-7-20 15:01:50 | 显示全部楼层
handle 型的局部变量使用完后不set null就会泄漏。
解答完毕,请自行搜索handle的扩展类型
(其实除了int,real,boolean以外的基本都是handle)
回复

使用道具 举报

发表于 2009-7-20 17:28:40 | 显示全部楼层
还有string也不需要变量排泄

code不清楚,应该不会泄露吧
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-12-4 16:18 , Processed in 0.060238 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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