1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  5. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  8. The raddest synthwave tracks were chosen - Check out our Music Contest #12 - Results and congratulate the winners!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Expanding Sphere 1.4b

Submitted by D1000
This bundle is marked as approved. It works and satisfies the submission rules.
This is my first spell I upload on HiveWorkshop (Not my first spell at all^^)
It won the "Spell Making Session #15" on Wc3c.net (Link)

Tooltip
[​IMG]


Requires:
  • JNGP
  • TimerUtils
  • xe

Credits to Vexorian for TimerUtils, JassHelper and xe

Please give proper credits to me and Vexorian if you use this spell in your map.

Code
Code (vJASS):
scope ExpandingSphere

//============================================||
//----------------------------Spell made by D1000---------------------------||
//-----Please give Credits if you use it in your (Or anyone else) map----||
//-------------------------------Version 1.4b----------------------------------||
//-------------------------------------------------------------------------------||
//--Requires: JassHelper, TimerUtils and xe (basic,fx,preload,damage)-||
//------Credits to Vexorian for: JassHelper, TimerUtils and xe------------||
//============================================||

//============================================||
//------------------------------------Import------------------------------------||
//1) Copy the folders "Spell" and "Systems" to your map.----------------||
//2) Import the Dummy-model used in this map in your map -----------||
//3) Follow the import-instructions of xebasic -----------------------------||
//4) Create a dummy-spell and set "AbilityID" in this trigger to its ID ---||
//5) Give credits to Vexorian and me (D1000) -----------------------------||
//6) Have fun :-) --------------------------------------------------------------||
//============================================||

    globals
        //Things you can change
       
        /*Different*/
        private constant integer AbilityID = 'A000' //ID of the dummy Spell
        private constant real Interval = XE_ANIMATION_PERIOD //The loop-Interval
        private constant real Height = 60 //How high above the ground the spell takes place
        private constant integer MaxInstances = 8190 //Maximum number of instances of the Spelldata-Struct. Each usage of the spell needs 17 of them, so you can cast the spell with "MaxInstances = 8190" 8190/17 ~ 481 times at once.

       
        /*Lightnings*/
        private constant string LightningType = "DRAB" //Which lightning effect should be used.
        private constant real Length = 90 //The Length of each lightning
        private constant real LengthAdd = 0 //The Length increase each level
        private constant real SpinSpeed = 0.11 //Spin movement per "Interval" (in Radians)
        private constant real SpinSpeedAdd = 0 //Everytime the same...
                    //Color of the lightnings
        private constant real LightningColorR = 1 //Red
        private constant real LightningColorG = 1 //Green
        private constant real LightningColorB = 1 //Blue
        private constant real LightningColorA = 1 //Alpha
       
       
        /*The ball*/
        private constant string BallModel = "Abilities\\Spells\\Other\\Parasite\\ParasiteMissile.mdl" //The model of the lightning ball
        private constant real StartScale = 0.2 //The scale the ball has to begin of the spell
        private constant real StartScaleAdd = 0 //The scale-increase each level
        private constant real GrowScale = 0.09 //How much the dummy-unit grows each "Interval"
        private constant real GrowScaleAdd = 0 //The groth increase each level
        private constant real MaxScale = 18 //When the dummy reaches this size, it will explode
        private constant real MaxScaleAdd = 0 //Guess what
                    //Color of the ball
        private constant integer BallColorR = 255 //Red
        private constant integer BallColorG = 255 //Green
        private constant integer BallColorB = 255 //Blue
        private constant integer BallColorA = 255 //Alpha
       
       
        /*The effect at the end*/
        private constant string EndEffect = "Objects\\Spawnmodels\\Undead\\UDeathMedium\\UDeath.mdl" //The model of the explosion at the end
        private constant real EndScale = 1.6 //The scale of the effect
        private constant real EndScaleAdd = 0
        private constant real EndZ = 100 //The flying-Height of the effect
        private constant real EndZAdd = 0 //....
        private constant real EndTimeAfter = 1 //Time after the EndEffect until the DummyUnit gets destroyed.
        private constant real EndTimeAfterAdd = 0
                    //Color of the EndEffect
        private constant integer EndColorR = 255 //Red
        private constant integer EndColorG = 255 //Green
        private constant integer EndColorB = 255 //Blue
        private constant integer EndColorA = 255 //Alpha
       
       
        /*Damage*/
        private constant real Range = 240 //The range of the damage
        private constant real RangeAdd = 0
        private constant real Damage = 200 //Damage to each target
        private constant real DamageAdd = 100 // self-explanatory
        //Here you can alter the damage type and similar things (uses xedamage)
        //! textmacro ExpandingSphereDamageSettings
            set .dtype  = DAMAGE_TYPE_MAGIC
            set .atype  = ATTACK_TYPE_HERO
            //the wepon-type is per default "WEAPON_TYPE_WHOKNOWS"
            set .damageTrees = true
            set .damageNeutral = false
            //Damage enemies and not harming allies is default
            //You can find the xe-readmes in the "Systems"-Folder
           
            //You can also define other "onInit" actions in this textmacro, if you need them
        //! endtextmacro
       
        endglobals
       
        /*Advanced Settings*/
        //The following textmacros are called in different parts of the spell.
        //You can define locals in them, if you want.
        //You can access the struct members by using d.StructMember
            //! textmacro ExpandingSphereStart
                //This textmacro is called when the spell starts.
                debug call BJDebugMsg("|cffFFCC00"+GetUnitName(.caster)+"|r starts to cast 'Expanding Sphere'")
            //! endtextmacro
       
            //! textmacro ExpandingSpherePeriodic
                //This textmacro is called every "Interval" seconds, while the spell takes place
                debug call BJDebugMsg("Periodic event of 'Expanding Sphere' (casted by |cffFFCC00"+GetUnitName(.caster)+"|r)")
            //! endtextmacro
       
            //! textmacro ExpandingSphereEnd
                //This textmacro is called when the spell ends
                debug call BJDebugMsg("|cffFFCC00"+GetUnitName(.caster)+"|r finished casting 'Expanding Sphere'")
            //! endtextmacro
           
    private struct ES[MaxInstances]
        //If you want, you can declare additional struct-members here
//=========================================================\\
/*                                        Don´t touch anything below!                                              */
//=========================================================\\    
        real array x[17]
        real array y[17]
        real array z[17]
        unit caster
        lightning array l[16]
        integer level
        real scale
        real radians = 0
        real array dist[16]
       
        delegate xefx ball
       
        static delegate xedamage dmg
        static location loc = Location(0,0) //Used to get the Z value of the target point
       
        static method create takes unit caster, real x, real y returns ES
            local ES this = ES.allocate()
            set .caster = caster
           
            set .level = GetUnitAbilityLevel(caster,AbilityID)-1
            set .scale = StartScale+StartScaleAdd*.level
           
            set .x[16] = x
            set .y[16] = y
            set .ball = xefx.create(x,y,0)
                //Sets the color of the ball
            set .fxpath = BallModel
            set .red = EndColorR
            set .green = EndColorG
            set .blue = EndColorB
            set .alpha = EndColorA
               
       
            set .dist[0] = -(Length + LengthAdd*.level)/2
            set .x[0] = x + .dist[0]
            set .y[0] = y
            return this
        endmethod
       
        static method EndSpell takes nothing returns nothing
            local ES this = GetTimerData(GetExpiredTimer())
            //! runtextmacro ExpandingSphereEnd()
       
            call ReleaseTimer(GetExpiredTimer())
       
            //Destroys the ball
            call .ball.destroy()
       
            //Destroys the spell-struct
            call .destroy()
        endmethod
   
        static method Loop takes nothing returns nothing
            //Local declaration
            local timer t = GetExpiredTimer()
            local ES this = GetTimerData(t)
            local integer i = 1
            local xefx EndSFX
            //! runtextmacro ExpandingSpherePeriodic()
       
            //Lets the dummy grow^^
            set .ball.scale = .scale
            set .scale = .scale + GrowScale+GrowScaleAdd*.level
       
            if .scale >= MaxScale + MaxScaleAdd*.level then // When the max scale is reached, destroy the shapes and so on...
                call PauseTimer(t) //Only pauses the timer becauses it is still needed
           
                //The explosion
                set EndSFX = xefx.create(.x[16],.y[16],0)
                set EndSFX.fxpath = EndEffect
                set EndSFX.z = EndZ+EndZAdd*.level
                set EndSFX.scale = EndScale+EndScaleAdd*.level
                //Sets the color of the effect
                set EndSFX.red = EndColorR
                    set EndSFX.green = EndColorG
                set EndSFX.blue = EndColorB
                set EndSFX.alpha = EndColorA
           
                set i = 0
                loop //Destroys the shapes
                    call DestroyLightning(.l[i])
                    set i = i + 1
                    exitwhen i == 16
                endloop
           
                if Damage+DamageAdd*.level > 0 then //Only triggers if the damage is > 0
                    call .damageAOE(.caster,.x[16],.y[16],Range+RangeAdd*.level,Damage+DamageAdd*.level)
                endif

                call TimerStart(t,EndTimeAfter+EndTimeAfterAdd*.level,false,function ES.EndSpell)
                return //Skips the rest of the trigger
            endif
       
       
            set .x[0] = .x[16]+ .dist[0]*Sin(.radians)
            set .y[0] = .y[16]+ .dist[0]*Cos(.radians)
       
            loop // Moves the lightnings
                if i <= 7 then
                    set .x[i] = .x[16]+ .dist[i]*Sin(.radians)
                    set .y[i] = .y[16]+ .dist[i]*Cos(.radians)
                    call MoveLightningEx(.l[i-1],true,.x[i],.y[i],.z[i],.x[i-1],.y[i-1],.z[i-1])
                elseif i == 8 then
                    set .y[i] = .y[16]+ .dist[i]*Sin(.radians)
                    set .z[i] = .z[16]+ .dist[i]*Cos(.radians)
                    call MoveLightningEx(.l[i-1],true,.x[0],.y[0],.z[0],.x[i-1],.y[i-1],.z[i-1])
                else
                    set .y[i] = .y[16]+ .dist[i]*Sin(.radians)
                    set .z[i] = .z[16]+ .dist[i]*Cos(.radians)
                    call MoveLightningEx(.l[i-1],true,.x[i],.y[i],.z[i],.x[i-1],.y[i-1],.z[i-1])
                endif
           
                set i = i + 1      
                exitwhen i >= 16
            endloop
            call MoveLightningEx(.l[15],true,.x[8],.y[8],.z[8],.x[15],.y[15],.z[15])
       
            set .radians = .radians + SpinSpeed+SpinSpeedAdd*.level
        endmethod
   
        static method StartSpell takes nothing returns nothing
            // Local declaration
            local ES this = ES.create(GetTriggerUnit(),GetSpellTargetX(),GetSpellTargetY())
            local timer t = NewTimer()
            local integer i = 1
            //! runtextmacro ExpandingSphereStart()
       
            call MoveLocation(.loc,.x[16],.y[16])
            set .z[16] = GetLocationZ(.loc)
       
            call SetTimerData(t,this) //Attaches the struct to the timer
       
            set .z[0] = .z[16] + Height
       
            set .ball.z = (Length + LengthAdd*.level)/2 + SquareRoot(((Length + LengthAdd*.level)*(Length + LengthAdd*.level))/2) + Height // Sets the Height of the ball
       
            set .z[16] = .z[16]+.ball.z
            //Creates the lightnings (there are 16 of them)
            loop
                if i <= 7 then
                    set .x[i] = .x[i-1] + (Length+LengthAdd*.level)*Cos(bj_PI/4*(i-1))
                    set .y[i] = .y[16]
                    set .z[i] = .z[i-1] + (Length+LengthAdd*.level)*Sin(bj_PI/4*(i-1))
                    set .l[i-1] = AddLightningEx(LightningType,true,.x[i],.y[i],.z[i],.x[i-1],.y[i-1],.z[i-1])
                    set .dist[i] = .x[i]-.x[16]
                elseif i == 8 then
                    set .x[i] = .x[16] - (Length + LengthAdd*.level)/2
                    set .y[i] = .y[16] - (Length + LengthAdd*.level)/2 - SquareRoot(((Length + LengthAdd*.level)*(Length + LengthAdd*.level))/2)
                    set .z[i] = .z[16]
                    set .l[i-1] = AddLightningEx(LightningType,true,.x[0],.y[0],.z[0],.x[i-1],.y[i-1],.z[i-1])
                    set .dist[i] = .y[i]-.y[16]
                else
                    set .x[i] = .x[i-1] + (Length+LengthAdd*.level)*Cos(bj_PI/4*(i-1))
                    set .y[i] = .y[i-1] + (Length+LengthAdd*.level)*Sin(bj_PI/4*(i-1))
                    set .z[i] = .z[8]
                    set .l[i-1] = AddLightningEx(LightningType,true,.x[i],.y[i],.z[i],.x[i-1],.y[i-1],.z[i-1])
                    set .dist[i] = .y[i]-.y[16]
                endif
           
                call SetLightningColor(.l[i-1],LightningColorR,LightningColorG,LightningColorB,LightningColorA)
           
                set i = i + 1
                exitwhen i >= 16
            endloop
       
            set .l[15] = AddLightningEx(LightningType,true,.x[15],.y[15],.z[15],.x[8],.y[8],.z[8])
            call SetLightningColor(.l[15],LightningColorR,LightningColorG,LightningColorB,LightningColorA)
               
            call TimerStart(t,Interval,true,function ES.Loop) //Starts the loop
        endmethod
   
        static method onInit takes nothing returns nothing
            local trigger tr = CreateTrigger()
       
            call XE_PreloadAbility(AbilityID)
       
            call TriggerRegisterAnyUnitEventBJ(tr,EVENT_PLAYER_UNIT_SPELL_EFFECT )
            call TriggerAddCondition(tr,Condition(function ES.IsSpell))
            call TriggerAddAction(tr,function ES.StartSpell)
       
            set tr = null
            set .dmg = xedamage.create()
            //! runtextmacro ExpandingSphereDamageSettings()
        endmethod
   
        static method IsSpell takes nothing returns boolean
            return GetSpellAbilityId() == AbilityID
        endmethod
    endstruct
endscope


Changelog

• v. 1.4b:
-Fixed a very small bug

• v. 1.4:
-Fixed what Purple said (Except the clipping-thing, I don´t really know how)
-Moved the hole spell into the struct
-Now using delegates
-Made the spell a bit smaller and faster

• v. 1.3:
-Added posibility to define your own actions on Spellstart/-end/Periodic and to declare your own struct-members
-Now using a create-method

• v. 1.2:
-Fixed a bug whith the height of the ball, when you used the spell on cliffs

• v. 1.1:
-Improved the triggering and changed the look a bit (like it was originally planned)
-Uploaded it on HiveWorkshop and Wc3c

• v. 1.0:
-Made the Spell and submitted it to the "Spell Making Session #15" on wc3c.net


Keywords:
Expanding, Sphere, D1000, Explosion, 3D, Lightning, Circle, Growing, green, grow, expand, ring, rotate
Contents

Expanding Sphere 1.4 (Map)

Reviews
Moderator
12:33, 3rd Sep 2009 PurplePoot: The visuals looked pretty good, other than the obvious flaw that the sphere clipped when too large--I suggest you tweak the model so that the lighting isn't so much larger than the actual core to fix this problem....
  1. D1000

    D1000

    Joined:
    Jun 22, 2008
    Messages:
    53
    Resources:
    3
    Spells:
    3
    Resources:
    3
    I´ll try to fix this
    Here:
    Code (vJASS):
            //Here you can alter the damage type and similar things (uses xedamage)
            //! textmacro DamageSettings
                set dmg.dtype = DAMAGE_TYPE_MAGIC
                set dmg.atype = ATTACK_TYPE_HERO
                //the wepon-type is per default "WEAPON_TYPE_WHOKNOWS"
                set dmg.damageTrees = true
                set dmg.damageNeutral = false
                //Damage enemies and not harming allies is default
                //You can find the xe-readmes in the "Systems"-Folder
            //! endtextmacro



    I´ve no idea
     
  2. Jaakko

    Jaakko

    Joined:
    Apr 25, 2006
    Messages:
    1,298
    Resources:
    4
    Maps:
    4
    Resources:
    4
    You mean change set dmg.damageNeutral = false? I think I set it to true but still I think I couldn't kill my own unit. Just need to know a way that will let me cast the spell through a trigger.
     
  3. D1000

    D1000

    Joined:
    Jun 22, 2008
    Messages:
    53
    Resources:
    3
    Spells:
    3
    Resources:
    3
    There is a simmilar option for allied units, just read the xe-damage Readme
    Just let a unit cast your dummy-spell, like you would let it cast any other spells. (Yes, I know that my english is horrible)
     
  4. Jaakko

    Jaakko

    Joined:
    Apr 25, 2006
    Messages:
    1,298
    Resources:
    4
    Maps:
    4
    Resources:
    4
    I don't know how to make it cast this spell that is in the map. I tried replacing the spell ability id with another spell but when I casted it the sphere never came.
    EDIT: Oh I tried another spell and it worked. Must have been something wrong with the spell I first tried.
     
  5. D1000

    D1000

    Joined:
    Jun 22, 2008
    Messages:
    53
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Bug is fixed
     
  6. Jaakko

    Jaakko

    Joined:
    Apr 25, 2006
    Messages:
    1,298
    Resources:
    4
    Maps:
    4
    Resources:
    4
    New possible bug. Once I cast the spell if the caster is removed from the game before the explosion happens no damage will be dealed.
     
  7. D1000

    D1000

    Joined:
    Jun 22, 2008
    Messages:
    53
    Resources:
    3
    Spells:
    3
    Resources:
    3
    It´s not a bug, it´s a feature
    The damage is dealt by the caster and if there is no caster, how should it deal damage^^

    /€: It is also a rule for spell-submission on hive, that the right units gets credits for damage/kills.

    /€²: New ver.: 1.3
     
    Last edited: Sep 1, 2009
  8. YourNameHere

    YourNameHere

    Joined:
    Apr 29, 2007
    Messages:
    745
    Resources:
    4
    Maps:
    1
    Spells:
    2
    JASS:
    1
    Resources:
    4
    Why do you use textmacros instead of interfaces? Or atleast modules instead?
    Other than that, the spell looks good. Even if I'm too tired to look at the code atm.
     
  9. D1000

    D1000

    Joined:
    Jun 22, 2008
    Messages:
    53
    Resources:
    3
    Spells:
    3
    Resources:
    3
    How should I to this?
    It seems that modules can only be implemented into structs.
    Thanks
     
  10. YourNameHere

    YourNameHere

    Joined:
    Apr 29, 2007
    Messages:
    745
    Resources:
    4
    Maps:
    1
    Spells:
    2
    JASS:
    1
    Resources:
    4
    Use structs instead of all those functions. Looks better anyway imo.
     
  11. D1000

    D1000

    Joined:
    Jun 22, 2008
    Messages:
    53
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Updated to v1.4
    I don´t want to remove the textmacros and I dont know ow to fix the clipping-thing, but everything else mentioned is changed/fixed
     
  12. Spo

    Spo

    Joined:
    Jun 1, 2009
    Messages:
    116
    Resources:
    0
    Resources:
    0
    I know this is a stupid ? but how do you insert a spell into your map?
     
  13. D1000

    D1000

    Joined:
    Jun 22, 2008
    Messages:
    53
    Resources:
    3
    Spells:
    3
    Resources:
    3
    IconMaker asked the same^^
    Where exactly do you have problems?

    /€: Updated to v.1.4b
     
    Last edited: Sep 25, 2009
  14. Raziel_br

    Raziel_br

    Joined:
    Oct 13, 2008
    Messages:
    554
    Resources:
    0
    Resources:
    0
    dont works
    =\
    I was using the XE system before this spell, I thing this is not works becaise this, what can I do?
     
  15. D1000

    D1000

    Joined:
    Jun 22, 2008
    Messages:
    53
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Works fine for me
    Did you set the AbilityID
    Code (vJASS):
    private constant integer AbilityID = 'A000' //ID of the dummy Spell
    to the right value?
     
  16. Raziel_br

    Raziel_br

    Joined:
    Oct 13, 2008
    Messages:
    554
    Resources:
    0
    Resources:
    0
    yes, I do it, the problem is not this, the problem is:
    i have the XE system, but not for this spell, this proprably is what are causing probrem, sory about my bad english

    =\
     
  17. D1000

    D1000

    Joined:
    Jun 22, 2008
    Messages:
    53
    Resources:
    3
    Spells:
    3
    Resources:
    3
    That should be no problem
    If you send me the map, I´ll check it.
     
  18. Raziel_br

    Raziel_br

    Joined:
    Oct 13, 2008
    Messages:
    554
    Resources:
    0
    Resources:
    0
    my map have 9mb
    =\

    I will post here, in one zip file, this zip will have password, i will send to you the password in private message ok?
     
  19. Raziel_br

    Raziel_br

    Joined:
    Oct 13, 2008
    Messages:
    554
    Resources:
    0
    Resources:
    0
    Sory about the duble post

    there is my map,
    He is in portuguease, but what need I put on top and edit the trigger name

    can you see some leaks?
    :grin:
     

    Attached Files:

  20. D1000

    D1000

    Joined:
    Jun 22, 2008
    Messages:
    53
    Resources:
    3
    Spells:
    3
    Resources:
    3
    You forgot to import xedamage, xepreload and TimerUtils and I think you didn´t import the dummy unit & model of xebasic.
     
    Last edited: Jun 27, 2011