Warcraft III resources & community, 2003–2006 · archived

EffectNova

not rated
Submitted by KaTTaNaFunctions0 downloads
Creates a ring at the target, that expands over a time until it reaches the given radius. Interval determines the distance between each effect in the ring (radius-wise).
Duration is the time it takes for the ring to reach the radius, but if duration is a very small value, it will take longer than expected.

Note: Do NOT pass 0 as a parameter for radius or interval.

Source

function EffectNova_Child takes nothing returns nothing
    local real radius = RAbsBJ(bj_meleeNearestMineDist)
    local real interval = RAbsBJ(bj_randomSubGroupChance)
    local real duration = RAbsBJ(bj_enumDestructableRadius)
    local string modelFile = bj_lastPlayedMusic
    local location source = bj_enumDestructableCenter
    local effect array fx
    local integer i = 0
    local real angle
    local integer count = 6
    local real sleep = duration*interval/radius
    local real x = GetLocationX(source)
    local real y = GetLocationY(source)
    local real x1
    local real y1
    local real dist = 0
    loop
        loop
            exitwhen i == 0
            call DestroyEffect(fx[i])
            set i = i - 1
        endloop
        
        exitwhen dist >= radius
        
        set angle = 0
        loop
            exitwhen angle >= 360
            
            set x1 = x + CosBJ(angle)*dist
            set y1 = y + SinBJ(angle)*dist
            set fx[i] = AddSpecialEffect(modelFile, x1, y1)
            
            set i = i + 1
            set angle = angle + 360/count
        endloop
        
        set count = count + 1
        set dist = dist + interval
        call TriggerSleepAction(sleep)
    endloop
endfunction

function EffectNova takes location where, string modelFile, real radius, real interval, real duration returns nothing
    local trigger trg = CreateTrigger()
    call TriggerAddAction(trg, function EffectNova_Child)
    set bj_meleeNearestMineDist = radius
    set bj_randomSubGroupChance = interval
    set bj_enumDestructableRadius = duration
    set bj_lastPlayedMusic = modelFile
    set bj_enumDestructableCenter = where
    if (radius != 0) and (interval != 0) then
        call TriggerExecute(trg)
    endif
    call DestroyTrigger(trg)
endfunction

Comments

0

No comments.