• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Playing specific parts of an animation

Status
Not open for further replies.
Level 1
Joined
Jan 3, 2019
Messages
2
Greetings,
I made a custom animation based on the Brilliance effect. But I only want to play a part when the circles widen and then destroy the effect. In the current version, the circles stay as they are for a few moments before disappearing and I want to remove that part.
This is my wurst code:
Wurst:
addEffect(HOLY_NOVA_CASTER, caster, "origin")..setScale(SCALE).destr()
This uses the 'AddSpecialEffectTarget'
My guess is, that I have to edit the model, so I attached it.

If I was not clear:
I have an effect based on Brilliance with a duration eg. 1.5 seconds. I only want to display the first 1 second.

Here is a gif of how it looks like:
imgur.com
 

Attachments

  • HolyNova.mdx
    5.7 KB · Views: 36
  • TjShockwave2_orange.blp
    10.6 KB · Views: 24
Last edited:
Level 23
Joined
Apr 3, 2018
Messages
460
In the model, there is no "death" animation.
So if you use "destroy special effect", there is no death animation to play and the effect will stay at the last frame of the "stand" animation until the constant special effect decay time expires.

At first I thought to make a death animation, but the better solution is probably to just make the last frame of the stand animation invisible.
 

Attachments

  • HolyNova.mdx
    5.7 KB · Views: 80
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
You can also handle all of this stuff through code on the newer versions (1.31+?).

Here's some functions for manipulating Special Effects that I made in Lua. They could be adapted to JASS with some changes:

Lua:
function DestroyEffectDelay(s, d) --special effect, duration
    local ded = CreateTimer()
    TimerStart(ded, d, false, function()
        DestroyEffect(s)
        PauseTimer(ded)
        DestroyTimer(ded)
    end)
end

function DestroyEffectDelayHide(s, d)
    local ded = CreateTimer()
    TimerStart(ded, d, false, function()
        BlzSetSpecialEffectPosition(s, Bounds, Bounds, -500) --Bounds is a global variable that you set to the edge coordinates of the map, you'd need an X/Y version if your map isn't square.
        DestroyEffect(s)
        PauseTimer(ded)
        DestroyTimer(ded)
    end)
end

function DestroyEffectHide(s)
    BlzSetSpecialEffectPosition(s, Bounds, Bounds, -500)
    DestroyEffect(s)
end

function DestroyEffectFade(s)
    local a = 255
    local ded = CreateTimer()
    TimerStart(ded, 0.01, true, function()
        a = a - 3
        BlzSetSpecialEffectAlpha(s, a)
        if a <= 3 then
            BlzSetSpecialEffectPosition(s, BlzGetLocalSpecialEffectX(s), BlzGetLocalSpecialEffectY(s), -5000)
            DestroyEffect(s)
            PauseTimer(ded)
            DestroyTimer(ded)
        end
    end)
end

function DestroyEffectDelayFade(s, d)
    local a = 255
    local ded = CreateTimer()
    TimerStart(ded, d, false, function()
        PauseTimer(ded)
        DestroyTimer(ded)
        local ded2 = CreateTimer()
        TimerStart(ded2, 0.01, true, function()
            a = a - 3
            BlzSetSpecialEffectAlpha(s, a)
            if a <= 3 then
                BlzSetSpecialEffectPosition(s, BlzGetLocalSpecialEffectX(s), BlzGetLocalSpecialEffectY(s), -5000)
                DestroyEffect(s)
                PauseTimer(ded2)
                DestroyTimer(ded2)
            end
        end)
    end)
end

In your case you could use DestroyEffectDelayHide() which waits a designated amount of time before hiding and destroying the special effect.
 
Last edited:
Status
Not open for further replies.
Top