- Joined
- Jan 30, 2020
- Messages
- 775
I searched for a while for a simple way of destroying effects later.
The reason for this is that some special effects, one cannot destroy instantly.
My soultion, write a function that does this, but I had a few problems and searched on the hive for a simple delayed special effect destroyer and kind of found what I looked for; Something that was close to the exact thing that I had.
I found [vJASS] - About TimerUtil's NewTimer() and adjusted my code slightly, tested it out and it seems to work well.
The result is:
Does it look fine? Is it too simple for a "Spell section upload"?
With this system, one can do this:
The reason for this is that some special effects, one cannot destroy instantly.
This will not show a special effect at all. The effect is destroyed instantly, not after the animation has finished as I hoped!
-
test
-
Events
-
Time - Every 2.00 seconds of game time
-
-
Conditions
-
Actions
-
Special Effect - Create a special effect at (Position of Paladin 0013 <gen>) using Doodads\Cinematic\Lightningbolt\Lightningbolt.mdl
-
Special Effect - Play Special Effect: (Last created special effect), Animation: Stand
-
Special Effect - Set Time Scale of (Last created special effect) to 0.66
-
Special Effect - Destroy (Last created special effect)
-
-
My soultion, write a function that does this, but I had a few problems and searched on the hive for a simple delayed special effect destroyer and kind of found what I looked for; Something that was close to the exact thing that I had.
I found [vJASS] - About TimerUtil's NewTimer() and adjusted my code slightly, tested it out and it seems to work well.
The result is:
Does it look fine? Is it too simple for a "Spell section upload"?
JASS:
library SimpleDelayedEffectDestroyer requires TimerUtils
//*********************************************************************
//* SimpleDelayedEffectDestroyer 1.0 by ThompZon
//* ----------
//*
//* To implement it, create a new custom text trigger called SimpleDelayedEffectDestroyer
//* (name can be anything really), and paste the contents of this script there.
//*
//* (requires vJass) - in a "newer" editor, you can press JassHelper -> Enable vJass
//*
//* Destroys you effects for you after a while!
//*
//* DestroyEffectLater(effect, delay) : Destroys the effect after delay seconds
//* DestroyLastCreatedEffectLater(delay) : Destroys the lastCreatedEffect after delay seconds
//*
//********************************************************************
//================================================================
struct EffectDestroyer
effect effect
private method destroy takes nothing returns nothing
call DestroyEffect(this.effect)
set this.effect = null
call this.deallocate()
endmethod
private static method destroyFromTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local thistype this = GetTimerData(t)
call this.destroy()
call ReleaseTimer(t)
set t = null
endmethod
static method destroyLater takes effect e, real delay returns nothing
local thistype this = allocate()
local timer t = NewTimerEx(this)
call TimerStart(t, delay, false, function thistype.destroyFromTimer)
set this.effect = e
set t = null
endmethod
endstruct
function DestroyEffectLater takes effect e, real delay returns nothing
call EffectDestroyer.destroyLater(e, delay)
endfunction
function DestroyLastCreatedEffectLater takes real delay returns nothing
call EffectDestroyer.destroyLater(bj_lastCreatedEffect, delay)
endfunction
endlibrary
With this system, one can do this:
-
test
-
Events
-
Time - Every 2.00 seconds of game time
-
-
Conditions
-
Actions
-
Special Effect - Create a special effect at (Position of Paladin 0013 <gen>) using Doodads\Cinematic\Lightningbolt\Lightningbolt.mdl
-
Special Effect - Play Special Effect: (Last created special effect), Animation: Stand
-
Special Effect - Set Time Scale of (Last created special effect) to 0.75
-
Custom script: call DestroyLastCreatedEffectLater(0.5)
-
-