HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Destroy special effect after X amount of time

09-15-2004, 06:32 AM#1
WNxDavis
I need something that will destroy the special effect after 5 seconds. The text highlighted in orange is where I want the special effect destroyed. Now there will be other special effects being made during the 5 seconds so I need to know how to destroy the special effect that was made 5 seconds ago, not the "Last created special effect".


Fire Extinguisher
Events
Unit - A unit owned by (Player) Is attacked
Conditions
(Unit-type of (Attacking unit)) Equal to (Unit Type)
Actions
Unit - Pause (Attacked unit)
Special Effect - Create a special effect at (Position of (Attacked unit)) using Abilities\Spells\Undead\FreezingBreath\FreezingBreathTargetArt.mdl
Wait 1.00 seconds
Unit - Order (Attacking unit) to Stop
Wait 3.00 seconds
Special Effect - Destroy (Last created special effect)
Unit - Unpause (Attacked unit)


Thank you very much.
09-15-2004, 07:32 AM#2
Windrunner
you could make an extra trigger like: wait 4.5 seconds --> destroy last created special effect, and disable this trigger.

in your first trigger you enable it as soon as the effect is made. and then you create the second effect 5 seconds later.

or you could use the regions. destroy special effect in region after 5 seconds.
and if the second effect is in the same region place another region on the same place and create it in there.
09-15-2004, 07:47 AM#3
SpadeZ
There is a problem with what windrunner said. The destroy last created sfx action would overwrite itself if the trigger fired again before the 5 seconds or so. You would need some variables if this trigger fires often.
09-15-2004, 08:04 AM#4
WNxDavis
Quote:
Originally Posted by SpadeZ
There is a problem with what windrunner said. The destroy last created sfx action would overwrite itself if the trigger fired again before the 5 seconds or so. You would need some variables if this trigger fires often.


I need some specific information on what to do on this subject, and there will be more than one attacked enemy unit in those 5 seconds. So I do not want them end all at once, I want the special effect last for 5 seconds at the exact place and then get destroyed. I am sorry if I'm picky but that is what I need for this particular situation.

Please suggest anything you can on this subject.
09-15-2004, 10:28 AM#5
Guest
What about:

make a variable for the specific special effect.

Trigger:

event: (...)
conditions: (...)
actions:
-create special effect (whatever)
-set sfxvar1 = last created special effect
-wait 20 seconds
-destroy sfxvar1


Is it that what your looking for ?
09-15-2004, 11:00 AM#6
Guest
If this still causes any problems u would be definately going wit this one:

make variable:

- sfxvar (type: special effect - value none; activate array size = 100)
- sfxnumber (type: integer - value 0)
- sfxdestroy (type: integer - value 1)

make trigger:

event: (...)
conditions: (...)
actions:
- set sfxnumber = (sfxnumber + 1)
- For each(Integer sfxnumber) from 99 to 99, do (Set sfxnumber = 0)
- create special effect on unit
- set sfxvar(sfxnumber) = last created special effect
- wait 20 seconds
- destroy sfxvar(sfxdestroy)
- set sfxdestroy = (sfxdestroy + 1)
- For each(Integer sfxdestroy) from 99 to 99, do (Set sfxdestroy = 0)


I havent tested it and i really want to know if it does the job for ur task. Plz tell me if its working (almost positive it is) :8

Ok i edited it and added the destroy variable. Now I guess u can be 100% assured that only the effect u want to be removed will be actually removed.
09-15-2004, 02:35 PM#7
Vexorian
Local variables and threads are your only hopes

Trigger Destroy effect
Actions:
custom script : local effect fx=bj_lastCreatedEffect
Wait EffectDestroyTime game time seconds
custom script: call DestroyEffect(fx)
custom script: set fx=null

Now after creating an effect:
Special effect - create blah, blah blah....
Set EffectDestroyTime = (duration of the effect)
Trigger - Run Destroy Effect
(you can continue doing other stuff here)
09-15-2004, 10:00 PM#8
Gandalf2349
Thats more complicated than it needs to be.

First step is to create a global variable called YourSFX

Second make this trigger

Code:
Special Effect
    Events
        Whatever you need.
    Conditions
    Actions
        Custom script:   local effect udg_YourSFX
        Special Effect - Create a special effect at (Center of (Playable map area)) using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
        Set YourSFX = (Last created special effect)
        Wait 5.00 seconds
        Special Effect - Destroy YourSFX

This should work. It was proven and tested in one of my maps, except I was using Floating Text. You can do it 500 times in that 5 seconds and it will still function correctly.
09-15-2004, 10:10 PM#9
TheNyne
Quote:
Originally Posted by Lord Vexorian
Local variables and threads are your only hopes

Trigger Destroy effect
Actions:
custom script : local effect fx=bj_lastCreatedEffect
Wait EffectDestroyTime game time seconds
custom script: call DestroyEffect(fx)
custom script: set fx=null

Now after creating an effect:
Special effect - create blah, blah blah....
Set EffectDestroyTime = (duration of the effect)
Trigger - Run Destroy Effect
(you can continue doing other stuff here)

Actually Gandalf, what Vex said right there isn't more complicated than it should be, its the most efficient, and sure-fire way. I was going to say it, but he beat me to it. :(

I'll just note that the "custom script" part that it says, is General - Custom Script. Its just one line of custom script.