How to destroy the timer?

Komaqtion

You can change this now in User CP.
Reaction score
469
Thanks T.s.e !! That explains some things for me :D

EDIT: Ok here's the trigger atm, but now it doesn't move the dummies :(
I had to merge the tywo triggers you gave me, T.s.e and kingkingyyk3, and i'm not sure i've done it correctly :S

EDIT2: Now i also tried to implement the timed effect in the system too, but now the dummies aren't even getting created :(
What's wrong?

Could you take a look?

JASS:
scope Dummy initializer init
globals
    private constant string e = "Abilities\\Spells\\Human\\Flare\\FlareCaster.mdl"
    private constant string e2 = "Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl"
    private constant string e1 = "Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl"
    private constant integer SPELL_ID = '0000'
    private constant integer unitid = 'h000'
    private constant integer aid = 'Aloc'
    private constant integer bid = 'BTLF'
    private player p
endglobals

private struct Data
    unit array du [17]
    unit cs
    real array pointx [17]
    real array pointy [17]
    boolean b
    
    static method create takes unit u returns Data
        local Data a = Data.allocate()
        set a.cs = u
        set a.b = false
        return a
    endmethod
    
endstruct

private function Spell_Check takes nothing returns boolean
    return GetSpellAbilityId() == SPELL_ID
endfunction

private function GroupEm takes nothing returns boolean
    if GetWidgetLife(GetFilterUnit()) > 0.405 and IsUnitEnemy(GetFilterUnit(), p) and IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false then
           call UnitDamageTarget(GetFilterUnit(), GetFilterUnit(), 50, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
     endif
     return false
endfunction

function DestroyEffectAfterTime takes effect f, string path, real x, real y, real t returns nothing
    call TriggerSleepAction(t)
    call DestroyEffect(f)
    call DestroyEffect(AddSpecialEffect(path,x,y))
endfunction

private function Move_Dummy takes nothing returns boolean
    local Data a = KT_GetData()
    local group g
    local real xd
    local real yd
    local integer i = 0
    set p = GetOwningPlayer(a.cs)
    loop
        exitwhen i==16
        set xd = GetUnitX(a.du<i>)
        set yd = GetUnitY(a.du<i>)
        set a.pointx<i> = xd+10*Cos((i*22.5)*bj_DEGTORAD)
        set a.pointy<i> = yd+10*Sin((i*22.5)*bj_DEGTORAD)
        call GroupEnumUnitsInRange(g, a.pointx<i>, a.pointy<i>, 10, Filter(function GroupEm))
        call SetUnitX(a.du<i>,a.pointx<i>)
        call SetUnitY(a.du<i>,a.pointy<i>)
        set i = i+1
    endloop
    return a.b
endfunction

private function Effects takes nothing returns nothing
    local Data a = Data.create(GetTriggerUnit())
    local real xu = GetUnitX(a.cs)
    local real yu = GetUnitY(a.cs)
    local integer i = 0
    local group g = CreateGroup()
    set p = GetOwningPlayer(a.cs)
    call DestroyEffect(AddSpecialEffect(e,xu,yu))
    loop
        exitwhen i&gt;=16
        set a.pointx<i> = xu+200*Cos((i*22.5)*bj_DEGTORAD)
        set a.pointy<i> = yu+200*Sin((i*22.5)*bj_DEGTORAD)
        call DestroyEffect(AddSpecialEffect(e,a.pointx<i>,a.pointy<i>))
        call DestroyEffect(AddSpecialEffect(e2,a.pointx<i>,a.pointy<i>))
        set p = GetOwningPlayer(a.cs)
        call GroupEnumUnitsInRange(g, a.pointx<i>, a.pointy<i>, 10, Filter(function GroupEm))
        set a.du<i> = CreateUnit(p,unitid,xu,yu,bj_RADTODEG*Atan2(a.pointy<i>-yu,a.pointx<i>-xu))
        call UnitApplyTimedLife(a.du<i>,&#039;BTLF&#039;,2.5)
        call UnitAddAbility(a.du<i>,aid)
        set i = i+1
    endloop
    call KT_Add(function Move_Dummy,a,.05)
    set p = null
    call TriggerSleepAction(2.5)
    set a.b = true
    call a.destroy()
endfunction

private function init takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t,Condition(function Spell_Check))
    call TriggerAddAction(t,function Effects)
    set t = null
endfunction
endscope</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>
 

Komaqtion

You can change this now in User CP.
Reaction score
469
It's correct, and i've used it so far ... Why wouldn't it work now, since it still makes the effects, just not the dummies :S
 

Faust

You can change this now in User CP.
Reaction score
123
All abilities' rawcode start with an A. so no.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well i just checked and that is what i have! You can specify your own rawcode in Newgen :D
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Er, KT2 failed to work? XD

JASS:
call GroupEnumUnitsInRange(g, a.pointx<i>, a.pointy<i>, 10, Filter(function GroupEm))
</i></i>


I think the range is so....... Are you trying to group some units within 10 range only?!
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Changed that to 150, but have any other suggestions to why it won't work ??
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Doesn't doing:
JASS:
//
    call a.destroy()

Destroy the struct?
Or is that a feature in KT2 or something?
Because I think in "Move_Dummy" all the data you're trying to use is destroyed by the said line.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
But it's destroyed after the TriggerSleepAction(2.5), which means that they should be moving for 2.5 seconds, right ?
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Can someone check if i merged the struct stuff and the group stuff :S
Since T.s.e used the old trigger, and not the one with structs :(
 

T.s.e

Wish I was old and a little sentimental
Reaction score
133
Well, I've found one error that will crash the callback function:

JASS:
 local group g

You haven't initialized it, but you're using it later in the function, causing the thread to crash.
Do this instead:
JASS:
 local group g = CreateGroup()
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Thanks for pointing that out, but didn't help :(

I'll post an update :D

JASS:
scope Dummy initializer init
globals
    private constant string e = &quot;Abilities\\Spells\\Human\\Flare\\FlareCaster.mdl&quot;
    private constant string e2 = &quot;Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl&quot;
    private constant string e1 = &quot;Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl&quot;
    private constant integer SPELL_ID = &#039;0000&#039;
    private constant integer unitid = &#039;h000&#039;
    private constant integer aid = &#039;Aloc&#039;
    private constant integer bid = &#039;BTLF&#039;
    private player p
endglobals

private struct Data
    unit array du [17]
    unit cs
    real array pointx [17]
    real array pointy [17]
    boolean b
    
    static method create takes unit u returns Data
        local Data a = Data.allocate()
        set a.cs = u
        set a.b = false
        return a
    endmethod
    
endstruct

private function Spell_Check takes nothing returns boolean
    return GetSpellAbilityId() == SPELL_ID
endfunction

private function GroupEm takes nothing returns boolean
    if GetWidgetLife(GetFilterUnit()) &gt; 0.405 and IsUnitEnemy(GetFilterUnit(), p) and IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false then
           call UnitDamageTarget(GetFilterUnit(), GetFilterUnit(), 50, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
     endif
     return false
endfunction

function DestroyEffectAfterTime takes effect f, string path, real x, real y, real t returns nothing
    call TriggerSleepAction(t)
    call DestroyEffect(f)
    call DestroyEffect(AddSpecialEffect(path,x,y))
endfunction

private function Move_Dummy takes nothing returns boolean
    local Data a = KT_GetData()
    local group g = CreateGroup()
    local real xd
    local real yd
    local integer i = 0
    set p = GetOwningPlayer(a.cs)
    loop
        exitwhen i==16
        set xd = GetUnitX(a.du<i>)
        set yd = GetUnitY(a.du<i>)
        set a.pointx<i> = xd+10*Cos((i*22.5)*bj_DEGTORAD)
        set a.pointy<i> = yd+10*Sin((i*22.5)*bj_DEGTORAD)
        call GroupEnumUnitsInRange(g, a.pointx<i>, a.pointy<i>, 150, Filter(function GroupEm))
        call SetUnitX(a.du<i>,a.pointx<i>)
        call SetUnitY(a.du<i>,a.pointy<i>)
        set i = i+1
    endloop
    return a.b
endfunction

private function Effects takes nothing returns nothing
    local Data a = Data.create(GetTriggerUnit())
    local real xu = GetUnitX(a.cs)
    local real yu = GetUnitY(a.cs)
    local integer i = 0
    local group g = CreateGroup()
    set p = GetOwningPlayer(a.cs)
    call DestroyEffect(AddSpecialEffect(e,xu,yu))
    loop
        exitwhen i&gt;=16
        set a.pointx<i> = xu+200*Cos((i*22.5)*bj_DEGTORAD)
        set a.pointy<i> = yu+200*Sin((i*22.5)*bj_DEGTORAD)
        call DestroyEffect(AddSpecialEffect(e,a.pointx<i>,a.pointy<i>))
        call DestroyEffect(AddSpecialEffect(e2,a.pointx<i>,a.pointy<i>))
        set p = GetOwningPlayer(a.cs)
        call GroupEnumUnitsInRange(g, a.pointx<i>, a.pointy<i>, 10, Filter(function GroupEm))
        set a.du<i> = CreateUnit(p,unitid,xu,yu,bj_RADTODEG*Atan2(a.pointy<i>-yu,a.pointx<i>-xu))
        call UnitApplyTimedLife(a.du<i>,&#039;BTLF&#039;,2.5)
        call UnitAddAbility(a.du<i>,aid)
        set i = i+1
    endloop
    call KT_Add(function Move_Dummy,a,.05)
    set p = null
    call TriggerSleepAction(2.5)
    set a.b = true
    call a.destroy()
endfunction

private function init takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t,Condition(function Spell_Check))
    call TriggerAddAction(t,function Effects)
    set t = null
endfunction
endscope</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>
 

Jesus4Lyf

Good Idea™
Reaction score
397
Hey, good to see KT2 being used, it won't break over patch 1.23b either...

But you leak groups. XD

For Komaqtion... I think it should be like this? (I didn't carefully read the code.)
JASS:
scope Dummy initializer init
globals
    private constant string e = &quot;Abilities\\Spells\\Human\\Flare\\FlareCaster.mdl&quot;
    private constant string e2 = &quot;Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl&quot;
    private constant string e1 = &quot;Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl&quot;
    private constant integer SPELL_ID = &#039;0000&#039;
    private constant integer unitid = &#039;h000&#039;
    private constant integer aid = &#039;Aloc&#039;
    private constant integer bid = &#039;BTLF&#039;
    private player p
endglobals

private struct Data
    unit array du [17]
    unit cs
    real array pointx [17]
    real array pointy [17]
    boolean b
    
    static method create takes unit u returns Data
        local Data a = Data.allocate()
        set a.cs = u
        set a.b = false
        return a
    endmethod
    
endstruct

private function Spell_Check takes nothing returns boolean
    return GetSpellAbilityId() == SPELL_ID
endfunction

private function GroupEm takes nothing returns boolean
    if GetWidgetLife(GetFilterUnit()) &gt; 0.405 and IsUnitEnemy(GetFilterUnit(), p) and IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false then
           call UnitDamageTarget(GetFilterUnit(), GetFilterUnit(), 50, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
     endif
     return false
endfunction

function DestroyEffectAfterTime takes effect f, string path, real x, real y, real t returns nothing
    call TriggerSleepAction(t)
    call DestroyEffect(f)
    call DestroyEffect(AddSpecialEffect(path,x,y))
endfunction

private function Move_Dummy takes nothing returns boolean
    local Data a = KT_GetData()
    local group g = CreateGroup()
    local real xd
    local real yd
    local integer i = 0
    set p = GetOwningPlayer(a.cs)
    loop
        exitwhen i==16
        set xd = GetUnitX(a.du<i>)
        set yd = GetUnitY(a.du<i>)
        set a.pointx<i> = xd+10*Cos((i*22.5)*bj_DEGTORAD)
        set a.pointy<i> = yd+10*Sin((i*22.5)*bj_DEGTORAD)
        call GroupEnumUnitsInRange(g, a.pointx<i>, a.pointy<i>, 150, Filter(function GroupEm))
        call SetUnitX(a.du<i>,a.pointx<i>)
        call SetUnitY(a.du<i>,a.pointy<i>)
        set i = i+1
    endloop
    call DestroyGroup(g)
    set g = null
    if a.b then
        call a.destroy() // Otherwise there&#039;s a moment where this could fail if re-cast...
        return true
    endif
    return false
endfunction

private function Effects takes nothing returns nothing
    local Data a = Data.create(GetTriggerUnit())
    local real xu = GetUnitX(a.cs)
    local real yu = GetUnitY(a.cs)
    local integer i = 0
    local group g = CreateGroup()
    set p = GetOwningPlayer(a.cs)
    call DestroyEffect(AddSpecialEffect(e,xu,yu))
    loop
        exitwhen i&gt;=16
        set a.pointx<i> = xu+200*Cos((i*22.5)*bj_DEGTORAD)
        set a.pointy<i> = yu+200*Sin((i*22.5)*bj_DEGTORAD)
        call DestroyEffect(AddSpecialEffect(e,a.pointx<i>,a.pointy<i>))
        call DestroyEffect(AddSpecialEffect(e2,a.pointx<i>,a.pointy<i>))
        set p = GetOwningPlayer(a.cs)
        call GroupEnumUnitsInRange(g, a.pointx<i>, a.pointy<i>, 10, Filter(function GroupEm))
        set a.du<i> = CreateUnit(p,unitid,xu,yu,bj_RADTODEG*Atan2(a.pointy<i>-yu,a.pointx<i>-xu))
        call UnitApplyTimedLife(a.du<i>,&#039;BTLF&#039;,2.5)
        call UnitAddAbility(a.du<i>,aid)
        set i = i+1
    endloop
    call KT_Add(function Move_Dummy,a,.05)
    set p = null
    call DestroyGroup(g)
    set g = null
    call TriggerSleepAction(2.5)
    set a.b = true
endfunction

private function init takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t,Condition(function Spell_Check))
    call TriggerAddAction(t,function Effects)
    set t = null
endfunction
endscope</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>

There's a few other evident issues, but that's up to you guys...

>UnitDamageTarget(GetFilterUnit(), GetFilterUnit()
The units damage themselves. Kills won't register as the caster's?

>DestroyEffectAfterTime
This isn't even used? And it isn't privatised...

Still, +rep for what looks like a helpful post with effort behind it. ^_^

PS. For people interested in learning good practise and fancy tricks for this stuff: Tutorial on KT2 & GT.
 

T.s.e

Wish I was old and a little sentimental
Reaction score
133
> The units damage themselves. Kills won't register as the caster's?
And? :D

> This isn't even used? And it isn't privatised...
It isn't used correctly either, it should be like this...
JASS:
private function D takes effect f, real t returns nothing
call TriggerSleepAction(t)
call DestroyEffect(f)
endfunction

private function DestroyEffectTimed takes effect f, real t returns nothing
call D.execute(f, t)
endfunction
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, of course the caster should be the one who get credit for the kill :D I Might be able to change that myself though ;)

And for that other function, is there a way to make it create another effect as the first effect ends ? Like an explosion :S It looks really wierd if they just dissapear XD
 

T.s.e

Wish I was old and a little sentimental
Reaction score
133
> And for that other function, is there a way to make it create another effect as the first effect ends ? Like an explosion :S It looks really wierd if they just dissapear XD
Of course you can, just add another line to the function.

JASS:
private function D takes effect f, real t returns nothing
call TriggerSleepAction(t)
call DestroyEffect(f)
call DestroyEffect(AddSpecialEffect(..))
endfunction

private function DestroyEffectTimed takes effect f, real t returns nothing
call D.execute(f, t)
endfunction
 

Komaqtion

You can change this now in User CP.
Reaction score
469
But still, if i put that inside a loop... Then there'll be a 2.5 second delay between each effect being destroyed, won't it ? :S Or can i put 17 call DestroyEffect functions inside it ?
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
If use DestroyEffect, the effect can be show out that what you want, use it. It is better. If it does not show out what you want, then call the custom destroy effect function. :)
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Ok, sorry to say this but if you check this thread you'll see that i can't test the map :(

There might not be someone VERY nice out there who might want to try to copy this into his map and try to get it working ??

Ok, works again now ... Will test all out when i can :D

EDIT:Yay, it works !!!!

Just one thing... It actually lags quite alot :S Anyone have any ideas how to reduce it ??? Maybe there are some leaks and stuff :S

JASS:
scope Dummy initializer init
globals
    private constant string e = &quot;Abilities\\Spells\\Human\\Flare\\FlareCaster.mdl&quot;
    private constant string e2 = &quot;Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl&quot;
    private constant string e1 = &quot;Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl&quot;
    private constant string e3 = &quot;Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl&quot;
    private constant integer SPELL_ID = &#039;0000&#039;
    private constant integer unitid = &#039;h000&#039;
    private constant integer aid = &#039;Aloc&#039;
    private constant integer bid = &#039;BTLF&#039;
    private player p
    private group g = CreateGroup()
endglobals

private struct Data
    unit array du [17]
    unit cs
    real array pointx [17]
    real array pointy [17]
    boolean b
    
    static method create takes unit u returns Data
        local Data a = Data.allocate()
        set a.cs = u
        set a.b = false
        return a
    endmethod
    
endstruct

private function Spell_Check takes nothing returns boolean
    return GetSpellAbilityId() == SPELL_ID
endfunction

private function GroupEm takes nothing returns boolean
    if GetWidgetLife(GetFilterUnit()) &gt; 0.405 and IsUnitEnemy(GetFilterUnit(), p) and IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false and IsUnitInGroup(GetFilterUnit(),g) == false then
           call UnitDamageTarget(GetFilterUnit(), GetFilterUnit(), 50, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
           call GroupAddUnit(g,GetFilterUnit())
     endif
     return false
endfunction

private function Move_Dummy takes nothing returns boolean
    local Data a = KT_GetData()
    local real xd
    local real yd
    local integer i = 0
    set p = GetOwningPlayer(a.cs)
    loop
        exitwhen i==16
        set xd = GetUnitX(a.du<i>)
        set yd = GetUnitY(a.du<i>)
        set a.pointx<i> = xd+10*Cos((i*22.5)*bj_DEGTORAD)
        set a.pointy<i> = yd+10*Sin((i*22.5)*bj_DEGTORAD)
        call GroupEnumUnitsInRange(g, a.pointx<i>, a.pointy<i>, 150, Filter(function GroupEm))
        call SetUnitX(a.du<i>,a.pointx<i>)
        call SetUnitY(a.du<i>,a.pointy<i>)
        set i = i+1
    endloop
    return a.b
endfunction

private function Effects takes nothing returns nothing
    local Data a = Data.create(GetTriggerUnit())
    local real xu = GetUnitX(a.cs)
    local real yu = GetUnitY(a.cs)
    local integer i = 0
    set p = GetOwningPlayer(a.cs)
    call DestroyEffect(AddSpecialEffect(e,xu,yu))
    loop
        exitwhen i&gt;=16
        set a.pointx<i> = xu+200*Cos((i*22.5)*bj_DEGTORAD)
        set a.pointy<i> = yu+200*Sin((i*22.5)*bj_DEGTORAD)
        call DestroyEffect(AddSpecialEffect(e,a.pointx<i>,a.pointy<i>))
        call DestroyEffect(AddSpecialEffect(e2,a.pointx<i>,a.pointy<i>))
        set p = GetOwningPlayer(a.cs)
        call GroupEnumUnitsInRange(g, a.pointx<i>, a.pointy<i>, 10, Filter(function GroupEm))
        set a.du<i> = CreateUnit(p,unitid,xu,yu,bj_RADTODEG*Atan2(a.pointy<i>-yu,a.pointx<i>-xu))
        call UnitApplyTimedLife(a.du<i>,&#039;BTLF&#039;,2.5)
        call UnitAddAbility(a.du<i>,aid)
        call DestroyEffectDelayed(AddSpecialEffectTarget(e1,a.du<i>,&quot;chest&quot;),2.5)
        set i = i+1
    endloop
    call KT_Add(function Move_Dummy,a,.05)
    set p = null
    call TriggerSleepAction(2.5)
    set i = 0
    loop
        exitwhen i&gt;=16
        set a.pointx<i> = xu+500*Cos((i*22.5)*bj_DEGTORAD)
        set a.pointy<i> = yu+500*Sin((i*22.5)*bj_DEGTORAD)
        call DestroyEffect(AddSpecialEffect(e3,a.pointx<i>,a.pointy<i>))
        set i = i+1
    endloop
    set a.b = true
    call a.destroy()
endfunction

private function init takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t,Condition(function Spell_Check))
    call TriggerAddAction(t,function Effects)
    set t = null
endfunction
endscope</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>


And here's the system for the delayed sfx:

JASS:
//***************************************************************************
//*
//*  TimedHandles - By TriggerHappy187
//*
//***************************************************************************
//*
//*  Installation
//*     Simply copy this script into your map, as well as TimerUtils.
//*
//***************************************************************************
//*
//*  Documentation
//*
//*  All this script does it associates a handle to a
//*  timer and then destroys the handle upon the timer&#039;s expiration.
//*
//***************************************************************************
//*
//*  The Public Functions
//*
//*     DestroyEffectDelayed
//*     DestroyLightningDelayed
//*     RemoveWeatherEffectDelayed
//*     RemoveItemDelayed
//*     DestroyUbersplatDelayed
//*
//***************************************************************************
//*
//*  Examples
//*
//*  call DestroyEffectDelayed(AddSpecialEffect(&quot;MODELNAME&quot;, X, X), 2)
//*  call DestroyEffectDelayed(AddSpecialEffectTarget(&quot;MODELNAME&quot;, unit, &quot;attachment-point&quot;), 2)
//*
//***************************************************************************

library TimedHandles requires TimerUtils
    //! textmacro TIMEDHANDLES takes HANDLE,DESTROY
        
        private struct $HANDLE$struct
            $HANDLE$ var
        endstruct
        
        private function DestroyTimed$HANDLE$ takes nothing returns nothing
            local timer t = GetExpiredTimer()
            local $HANDLE$struct s = GetTimerData(t)
            call $DESTROY$(s.var)
            call ReleaseTimer(t)
            call s.destroy()
            set t = null
        endfunction
        
        function $DESTROY$Delayed takes $HANDLE$ var, real duration returns nothing
            local $HANDLE$struct s = $HANDLE$struct.create()
            local timer t = NewTimer()
            set s.var = var
            call SetTimerData(t, s)
            call TimerStart(t, duration, false, function DestroyTimed$HANDLE$)
            set t = null
        endfunction

    //! endtextmacro
    
    //! runtextmacro TIMEDHANDLES(&quot;effect&quot;,&quot;DestroyEffect&quot;)
    //! runtextmacro TIMEDHANDLES(&quot;lightning&quot;,&quot;DestroyLightning&quot;)
    //! runtextmacro TIMEDHANDLES(&quot;weathereffect&quot;,&quot;RemoveWeatherEffect&quot;)
    //! runtextmacro TIMEDHANDLES(&quot;item&quot;,&quot;RemoveItem&quot;)
    //! runtextmacro TIMEDHANDLES(&quot;ubersplat&quot;,&quot;DestroyUbersplat&quot;)
    
endlibrary
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top