• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Old Spell Giveaway

Status
Not open for further replies.
Level 33
Joined
Apr 24, 2012
Messages
5,099
Days ago, I found this 3-year old resource of mine which I have forgotten to upload. I don't have things to do so I fixed it and now it works. The spell was inspired from Tank's Enchancted Fire Bolt and his another spell with spinning phoenix missile(forgot the name).

JASS:
//********************************************************************************************
//*
//*
//*                             SUPERNOVA version 1.0
//*
//*                           made by RADAMANTUS a.k.a ALMIA
//*
//*
//********************************************************************************************
//*
//* TOOLTIP:
//*
//* Summons a red star on the targeted point,the red star then explodes after 2 seconds
//* releasing 12 meteorites per layer outward the star's point.Each meteorite deals 15/30/45
//* damage and the explosion has 5 layers.Each layer has a distance of 100 x the layer number
//* from the star.
//*
//********************************************************************************************
//*
//* HOW TO IMPORT?
//*
//* 1)Import the dummy and its model
//* 2)Import the ability
//* 3)If you want,import the sun model
//* 4)Copy the code
//* 5)Create this variables:
//*   - udg_SN_Hash
//*   - udg_SN_Group
//*   - udg_SN_Loop
//* 6)Enjoy!
//*
//********************************************************************************************
//*
//* CREDITS
//*
//* - Vexorian for the dummy.mdx(also for Anitarf and Infrane)
//* - WILL THE ALMIGHTY for the sun model
//*
//********************************************************************************************
//* CONSTANT FUNCTIONS
//*
//* Configuration of the spell
//*
//********************************************************************************************

//Loop Value

constant function SN_Interval takes nothing returns real
    return 0.03125
endfunction

// Rawcode of the ability

constant function SN_Abil takes nothing returns integer
    return 'A000'
endfunction

//Rawcode of the dummy

constant function SN_Dummy takes nothing returns integer
    return 'h000'
endfunction

//Model of the star
//Credits to WILL THE ALMIGHTY for the model

constant function SN_Starmdl takes nothing returns string
    return "war3mapImported\\Sun.mdx"
endfunction

//Model of the meteorites

constant function SN_Meteormdl takes nothing returns string
    return "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl"
    //return "war3mapImported\\Sun.mdx"
endfunction

//Model of the ministars

constant function SN_Minimdl takes nothing returns string
    return "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl"
    //return "war3mapImported\\Sun.mdx"
endfunction

//Scale of the star

constant function SN_Starscale takes nothing returns real
    return 1.
endfunction

//Scale of the meteorites a.k.a segments

constant function SN_Meteorscale takes nothing returns real
    return 0.25
endfunction

//Scale of the mini-stars

constant function SN_Miniscale takes nothing returns real
    return 2.
endfunction

//Life Time of the Star

constant function SN_Duration takes nothing returns real
    return 2.
endfunction

//Flyheight of the Star

constant function SN_StarZ takes nothing returns real
    return 100.
endfunction

//FlyHeight of the mini-stars
constant function SN_MinistarZ takes nothing returns real
    return 100.
endfunction

//Damage done by the explosion

constant function SN_ExpDam takes nothing returns real
    return 15.
endfunction
//AoE of Damage

constant function SN_Radius takes nothing returns real
    return 150.
endfunction

//Number of segments per layer

constant function SN_SegPerLayer takes nothing returns integer
    return 12
endfunction

//Number of layers

constant function SN_Layer takes nothing returns integer
    return 5
endfunction

//Distance per layer

constant function SN_LayerThick takes nothing returns real
    return 100.
endfunction

//Height of the segment

constant function SN_ArcHeight takes nothing returns real
    return 1.
endfunction

//Speed of the segment to reach their locations

constant function SN_Speed takes nothing returns real
    return 250.
endfunction

//Number of mini-stars spinning the star

constant function SN_StarNo takes nothing returns integer
    return 12
endfunction

//Speed of the mini-stars spinning

constant function SN_SpinSpeed takes nothing returns real
    return 90.
endfunction

//Starting distance of the mini-stars

constant function SN_StartDist takes nothing returns real
    return 500.
endfunction

//Time for the mini-stars to spin

constant function SN_SpinTime takes nothing returns real
    return SN_Duration()
endfunction

//Explosion SFX of the Star

constant function SN_ExpSFX takes nothing returns string
    return "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
endfunction

//Explosion SFX of the segments

constant function SN_SegSFX takes nothing returns string
    return "Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl"
endfunction

//Creation SFX of the mini-stars

constant function SN_SpawnSFX takes nothing returns string
    return "Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl"
endfunction
//********************************************************************************************
//*
//*                                   END OF CONFIGURATION
//*
//********************************************************************************************
//*
//*                                FORMULAS AND OTHER FUNCTIONS
//*
//********************************************************************************************

//Get Speed of the Segments

function SN_GetSegmentSpeed takes integer lvl returns real
    return SN_Speed() * SN_Interval()
endfunction

//Get Spin Speed of the mini-stars

function SN_GetSpinSpeed takes integer lvl returns real
    return SN_SpinSpeed() * SN_Interval()
endfunction

//Get Speed of the mini-stars

function SN_GetStarSpeed takes integer lvl returns real
    return  (SN_StartDist() / SN_SpinTime()) * SN_Interval()
endfunction

//Get Damage

function SN_GetDamage takes integer lvl returns real
    return SN_ExpDam() * I2R(lvl)
endfunction

//Get Parabola

function SN_GetParabola takes real d , real t returns real
    return ((( 4 * (SN_ArcHeight() * d) ) / d ) * (( d - t ) * ( t / d )))
endfunction

//Get Ability Level

function SN_GetLevel takes unit u returns integer
    return GetUnitAbilityLevel(u,SN_Abil())
endfunction

//Get Angle

function SN_GetAngle takes integer i returns real
    return (360 / I2R(SN_SegPerLayer())) * I2R(i)
endfunction

//Get Distance of Segment

function SN_GetDist takes integer i returns real
    return SN_LayerThick() * I2R(i)
endfunction

//AttackType and DamageType

function SN_AtkTyp takes nothing returns attacktype
    return ATTACK_TYPE_CHAOS
endfunction
function SN_DmgTyp takes nothing returns damagetype
    return DAMAGE_TYPE_DIVINE
endfunction

//********************************************************************************************
//*
//*                           UTILITIES FUNCTIONS
//*
//********************************************************************************************

//Move Dummies

function SN_Move takes unit u , real x , real y returns nothing
    call SetUnitX(u,x)
    call SetUnitY(u,y)
endfunction

//Move Segment

function SN_MoveSegment takes unit u , real dist , real angle returns nothing
    local real x = GetUnitX(u) + dist * Cos(angle * bj_DEGTORAD)
    local real y = GetUnitY(u) + dist * Sin(angle * bj_DEGTORAD)
    call SN_Move(u,x,y)
endfunction

//Move Stars

function SN_MoveStars takes unit u , unit c , real dist , real angle returns nothing
    local real x = GetUnitX(c) + dist * Cos(angle * bj_DEGTORAD)
    local real y = GetUnitY(c) + dist * Sin(angle * bj_DEGTORAD)
    call SetUnitFacing(u, angle + 90)
    call SN_Move(u,x,y)
endfunction

//Create Segments

function SN_CreateSegment takes player p,real x,real y,real angle returns unit
    set bj_lastCreatedUnit = CreateUnit(p,SN_Dummy(),x,y,angle)
    call SetUnitScale(bj_lastCreatedUnit,SN_Meteorscale(),0,0)
    return bj_lastCreatedUnit
endfunction

//Create mini-stars

function SN_CreateMinistar takes player p ,real x,real y,real angle returns unit
    set bj_lastCreatedUnit = CreateUnit(p,SN_Dummy(),x,y,angle + 90)
    call SetUnitFlyHeight(bj_lastCreatedUnit,SN_MinistarZ(),0)
    call SetUnitScale(bj_lastCreatedUnit,SN_Miniscale(),0,0)
    return bj_lastCreatedUnit
endfunction

//Creation of Segments for Loop

function SN_CreateSegments takes player p ,real x,real y,integer lvl returns nothing
    local integer i = 0
    local integer i2 = 0
    local real angle
    local real distance
    local unit u
    local integer ukey
    loop
        set i = i + 1
        set angle = SN_GetAngle(i)
        
        set i2 = 0
        loop
            set i2 = i2 + 1
            set distance = SN_GetDist(i2)
            set u = SN_CreateSegment(p,x,y,angle)
            set ukey = GetHandleId(u)
            call UnitAddAbility(u,SN_Abil())
            call SetUnitAbilityLevel(u,SN_Abil(),lvl)
            call SaveReal(udg_SN_Hash,ukey,3,angle)
            call SaveReal(udg_SN_Hash,ukey,2,distance)
            call SaveInteger(udg_SN_Hash,ukey,0,2)
            call SaveEffectHandle(udg_SN_Hash,ukey,1,AddSpecialEffectTarget(SN_Meteormdl(),u,"origin"))
            call GroupAddUnit(udg_SN_Group,u)
            exitwhen i2 == SN_Layer()
        endloop
        exitwhen i == SN_SegPerLayer()
    endloop
    set u = null
endfunction

//Creation of Ministars in Loop

function SN_CreateMinistars takes unit o,player p,real x,real y returns nothing
    local integer i = 0
    local unit u
    local real x2
    local real y2
    local integer ukey
    local real angle
    loop
        set i = i + 1
        set angle = SN_GetAngle(i)
        set x2 = x + SN_StartDist() * Cos(angle * bj_DEGTORAD)
        set y2 = y + SN_StartDist() * Sin(angle * bj_DEGTORAD)
        set u = SN_CreateMinistar(p,x2,y2,angle)
        set ukey = GetHandleId(u)
        call SaveReal(udg_SN_Hash, ukey, 2, SN_StartDist())
        call SaveReal(udg_SN_Hash,ukey,3,angle)
        call SaveUnitHandle(udg_SN_Hash,ukey,6,o)
        call SaveInteger(udg_SN_Hash,ukey,0,3)
        call SaveEffectHandle(udg_SN_Hash,ukey,1,AddSpecialEffectTarget(SN_Minimdl(),u,"origin"))
        call GroupAddUnit(udg_SN_Group,u)
        call DestroyEffect(AddSpecialEffect(SN_SpawnSFX(),x,y))
        exitwhen i == SN_StarNo()
    endloop
    set u = null
endfunction

//Filters

//Filter Enemy

function SN_FilterUnit takes unit u ,player p returns boolean
    return IsUnitEnemy(u,p) and not (IsUnitType(u,UNIT_TYPE_DEAD) or IsUnitType(u,UNIT_TYPE_STRUCTURE) or IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE))
endfunction


//********************************************************************************************
//*
//*                          SPELL FUNCTIONS
//*
//********************************************************************************************

//For Group function

function SN_ForGroup takes nothing returns nothing
    local unit u = GetEnumUnit()
    local integer ukey = GetHandleId(u)

    local player p
    local real angle 
    local real duration
    local real travelled
    local real dist 
    local unit o
    local integer groupid
    local integer lvl
    local real damage
    local effect model
    
    local real x
    local real y
    local real x2
    local real y2
    local group g = CreateGroup()
    local unit e
    local real speed
    
    //Set variables
    set groupid = LoadInteger(udg_SN_Hash,ukey,0)
    set dist = LoadReal(udg_SN_Hash,ukey,2)
    set angle = LoadReal(udg_SN_Hash,ukey,3)
    set duration = LoadReal(udg_SN_Hash,ukey,4)
    set travelled = LoadReal(udg_SN_Hash,ukey,5)
    set model = LoadEffectHandle(udg_SN_Hash,ukey,1)
    
    set o = LoadUnitHandle(udg_SN_Hash, ukey, 6)
    
    set p = GetOwningPlayer(u)
    set x = GetUnitX(u)
    set y = GetUnitY(u)
    
    set lvl = SN_GetLevel(u)
    //Filter group id
    
    //For Star
    if groupid == 1 then
        if duration < SN_Duration() then
            call SaveReal(udg_SN_Hash,ukey,4,duration + SN_Interval())
        else
            call SN_CreateSegments(p,x,y,lvl)
            call DestroyEffect(AddSpecialEffect(SN_ExpSFX(),x,y))
            call DestroyEffect(model)
            call FlushChildHashtable(udg_SN_Hash,ukey)
            call GroupRemoveUnit(udg_SN_Group,u)
            call KillUnit(u)
        endif
    //For Segment
    
    elseif groupid == 2 then
        set speed = SN_GetSegmentSpeed(lvl)
        if travelled < dist then
            call SN_MoveSegment(u,speed,angle)
            call SetUnitFlyHeight(u,SN_GetParabola(dist,travelled),0)
            call SaveReal(udg_SN_Hash,ukey,5,travelled + speed)
        else
            set damage = SN_GetDamage(lvl)
            call GroupEnumUnitsInRange(g,x,y,SN_Radius(),null)
            loop
                set e =FirstOfGroup(g)
                exitwhen e == null
                if SN_FilterUnit(e,p) then
                    call UnitDamageTarget(u,e,damage,false,false,SN_AtkTyp(),SN_DmgTyp(),null)
                endif
                call GroupRemoveUnit(g,e)
            endloop
            call DestroyEffect(AddSpecialEffect(SN_SegSFX(),x,y))
            call DestroyEffect(model)
            call FlushChildHashtable(udg_SN_Hash,ukey)
            call GroupRemoveUnit(udg_SN_Group,u)
            call KillUnit(u)
        endif
    
    //For Ministar
    elseif groupid == 3 then
        set x2 = GetUnitX(o)
        set y2 = GetUnitY(o)
        set dist = SquareRoot((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y))
        if dist > 32 and o != null then
            set angle = angle + SN_GetSpinSpeed(lvl)
            call SN_MoveStars(u,o,dist - SN_GetStarSpeed(lvl),angle)
            call SaveReal(udg_SN_Hash,ukey,3,angle)
        else
            call DestroyEffect(model)
            call FlushChildHashtable(udg_SN_Hash,ukey)
            call GroupRemoveUnit(udg_SN_Group,u)
            call KillUnit(u)
        endif
    endif
    
    //Clean
    set u = null
    set g = null
    set model = null
    set p = null
    set o = null

endfunction
//Periodic

function SN_Periodic takes nothing returns nothing
    call ForGroup(udg_SN_Group,function SN_ForGroup)
endfunction

//Cast
function SN_Cast takes nothing returns boolean
    local real x
    local real y
    local player p
    local unit u
    local integer ukey
    local integer lvl
    local unit c
    
    if GetSpellAbilityId() == SN_Abil() then
        set c = GetTriggerUnit()
        set p = GetTriggerPlayer()
        set lvl = SN_GetLevel(c)
        set x = GetSpellTargetX()
        set y = GetSpellTargetY()
        set u = CreateUnit(p,SN_Dummy(),x,y,0)
        call SetUnitFlyHeight(u,SN_StarZ(),0)
        call SetUnitScale(u,SN_Starscale(),0,0)
        set ukey = GetHandleId(u)
        call SaveInteger(udg_SN_Hash,ukey,0,1)
        call SaveEffectHandle(udg_SN_Hash,ukey,1,AddSpecialEffectTarget(SN_Starmdl(),u,"origin"))
        call UnitAddAbility(u,SN_Abil())
        call SetUnitAbilityLevel(u,SN_Abil(),lvl)
        call GroupAddUnit(udg_SN_Group,u)
        call SN_CreateMinistars(u,p,x,y)
    endif
    set u = null
    return false
endfunction

//Initialization
function InitTrig_SuperNova takes nothing returns nothing
    set gg_trg_SuperNova = CreateTrigger()
    set udg_SN_Loop = CreateTrigger()
    set udg_SN_Hash = InitHashtable()
    set udg_SN_Group = CreateGroup()
    call TriggerAddCondition(gg_trg_SuperNova,Filter(function SN_Cast))
    call TriggerRegisterAnyUnitEventBJ(gg_trg_SuperNova,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerRegisterTimerEventPeriodic(udg_SN_Loop,SN_Interval())
    call TriggerAddAction(udg_SN_Loop,function SN_Periodic)
endfunction

attachment.php

I'm now giving this away, credit me ofc.

You can upload it, tho If the moderator rejects it because of it's old spell structure(it uses ForGroup :V) then i'm not the one to fix it :D

[edit]
Seriously, I like that Chain Saw effect. I don't know why I discover such odd special effects in warcraft :V (like my other spell with a drilling effect)
 

Attachments

Status
Not open for further replies.
Back
Top