• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Destroy Special Effects JASS

Was this helpfull?

  • Yes

    Votes: 0 0.0%
  • No

    Votes: 8 100.0%

  • Total voters
    8
Status
Not open for further replies.
Level 5
Joined
Jul 17, 2006
Messages
145
I dont really know if the forum needs this but i came up with it when working on my map and i thought it might be helpfull to some other people.

JASS:
//NOTE: this function uses Vexorians CSCache system ( [url]http://forums.dota-allstars.com/index.php?showtopic=92616[/url] )
//Variable e = the effect being destroyed
//Variable r = the timeout/life you want for the effect
function DstryEfft_Action takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local effect e = GetAttachedEffect(t, "effect")
    call DestroyEffect(e)
    call FlushHandle(t)
    call DestroyTimer(t)
    set t = null
    set e = null
endfunction

function DstryEfft takes effect e, real r returns nothing
    local timer t = CreateTimer()
    call AttachObject(t, "effect", e) 
    call TimerStart(t, r, false, function DstryEfft_Action)
    set t = null
endfunction

Just a little something i made up, because the stupid blizzard GUI only allows you to destroy the last created special effect, which means you couldnt destory an effect once you create a new one (unless you assign the effect to a variable)

As you can see this uses local var's and so is compleatly multi-instancable, and you avoid using huge arrays like some people have suggested to me. Just stick this in the header of your map and have fun ^^.

It also works well if your to lazy to do the three lines of text required to destroy a special effect with variables. Its pretty much those three lines condenced into a function.

Heres an example: (Attachment)

Please vote and say why!
 
Last edited:
Level 5
Joined
Jul 17, 2006
Messages
145
Reason; TriggerSleepAction affects the entire thread, not just the function that called it (so the functions that called that function are affected too, etc)
oops O_O lol and i guess i cant use a cache system because i have nothing to attach the effect to :(
i wish timers took parameters :/

lol well does anyone know a good way to destroy special effects without variables? I could just destory the last special effect but if i create another before i destory it then it just stayes there and leaks O_O
 
Level 11
Joined
Oct 13, 2005
Messages
233
In case anyone is interested for whatever reason, here's how I made a timed effect thing in one of my maps. You should be able to easily figure out what the non-standard functions do.
JASS:
function DestroyTimedEffect takes nothing returns nothing
 local timer t = GetExpiredTimer()
 local string i = GetHandleIndex(t)
    call DestroyEffect(GetEffect(i, "effect"))
    call PauseTimer(t)
    call FlushIndex(i)
    call DestroyTimer(t)
 set t = null
endfunction

function AddEffectTimed takes effect e, real duration returns nothing
 local timer t = CreateTimer()
    call SetHandle(GetHandleIndex(t), "effect", e)
    call TimerStart(t, duration, false, function DestroyTimedEffect)
 set t = null
endfunction
 
Level 5
Joined
Jul 17, 2006
Messages
145
eh it dosent really matter, vexorians handle system auto-flushes if the value is 0 (integers), " " (strings), or null (objects).

though i guess for ease of transporting from one cache system to another ill edit it :D

btw is there a way to rest the poll? i have a feeling that this is a lot more helpfull now >_>
 
Level 5
Joined
Jul 17, 2006
Messages
145
lol "for 2+"?
eh well i guess it is pretty in-effenent O_O but then again i dont know any other way to do it without as much triggering. if i had to set off a timer in the middle of a trigger i would have to make a new trigger anyways, though if you have any better suggestions id like to know :D
 
Level 5
Joined
Jul 17, 2006
Messages
145
lol now thats just confusing
first you said its ineficent, then you said that it wasent
unless you ment that it was ineficent because of the handles. of course, as far as i know its not that ineficent to use handles O_O
 
Status
Not open for further replies.
Top