Spellpack Random Spells

Discussion in 'Spells' started by Kenny, May 4, 2008.

  1. Kenny

    Kenny Back for now.

    Ratings:
    +202 / 0 / -0
    Random Spells
    By kenny!
    v3


    Elemental Helix

    JASS: Yes, vJass.
    JESP: Yes.
    Leakless: Yes.
    Lagless: Yes.
    MUI: Yes.
    Requires: NewGen and GTrigger.

    Description:

    Found in my next post (Post #4).

    Screenshot:
    [​IMG]

    Script:
    JASS:
    
    
    //------------------------------------------------------------------------------------\\
    //                              Elemental Helix [v3]                                  \\
    //                                   by kenny!                                        \\
    //                            Constructed using vJASS                                 \\
    //                         Requires NewGen WE & GTrigger                              \\
    //------------------------------------------------------------------------------------\\
    
    scope ElementalHelix2
    
        globals
            // Configurables:
            // Raw codes of units and spells:
            private constant integer    ABIL_ID       = 'A000'  // Raw code of Elemental Helix ability.
            private constant integer    ABIL2_ID      = 'A005'  // Raw code of Entangling Roots ability (freeze).
            private constant integer    CROW_FORM     = 'Amrf'  // Raw code of the standard Crow Form ability.
            private constant integer    FROST_ID      = 'n000'  // Raw code of Elemental Helix dummy unit (ICE).
            private constant integer    FLAME_ID      = 'n001'  // Raw code of Elemental Helix dummy unit (FIRE).
            private constant integer    DUMMY_ID      = 'u001'  // Raw code of the dummy unit that casts entangling roots (freeze).
            // Movement, speed and size of orbs:
            private constant real       INTERVAL      = 0.03    // INTERVAL used for the periodic timer, 0.03 - 0.04 is recommended.
            private constant real       COLLISION     = 128.00  // How close units have to be to get hit by the projectiles.
            private constant real       MOVE_DIST     = 22.50   // Distance moved per interval/period (INTERVAL), higher the number = faster movement
            private constant real       PARTIAL_ANGLE = 12.00   // Partial angle that is need to create 'Helix' effect, best kept at 12.00, or between 11.00-13.00
            private constant real       ORB_WIDTH     = 50.00   // Used as distance for dummy units to move in and out, 50.00 is good, higher creates a wider gap, opposite for lower
            private constant real       FROST_SIZE    = 0.60    // Size of the Ice orb
            private constant real       FLAME_SIZE    = 1.10    // Size of the Fire orb
            private constant real       FLY_HEIGHT    = 45.00   // Fly height of both of the orbs, good height is anything between 10.00-50.00
            private constant real       START_DIST    = 35.00   // Distance away from the caster at which both orbs will be created
            // Attack and damage types:
            private constant attacktype A_TYPE        = ATTACK_TYPE_CHAOS     // Attack type for the Fire damage and the end explosion.
            private constant damagetype D_TYPE        = DAMAGE_TYPE_UNIVERSAL // Damage type for the Fire damage and the end explosion.
            private constant weapontype W_TYPE        = WEAPON_TYPE_WHOKNOWS  // Weapon type for the Fire damage and the end explosion.
            // Special effects and attachments:
            private constant string     FLAME_HIT     = "Environment\\LargeBuildingFire\\LargeBuildingFire2.mdl"                               // Used for the fire damage effect on units.
            private constant string     FROST_HIT     = "Abilities\\Spells\\Undead\\FrostArmor\\FrostArmorDamage.mdl"                          // Used for the ice effect on units.
            private constant string     END_FLAME     = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"  // Used for fire end explosion.
            private constant string     END_FROST     = "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl"                            // Used for ice end explosion.
            private constant string     COMBUST_SFX   = "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl"                                   // Used for combustion effect when the fire orb hits.
            private constant string     ATTACH_POINT  = "chest"            // Used to attach fire and ice effects to enemy target units (FLAME_HIT and FROST_HIT).
            // Others:
            private constant real       TIMED_LIFE    = 1.00               // Timed life for caster units for entangle; Can be changed if necessary.
            private constant boolean    DESTROY_TREES = true               // Whether or not to allow destroying trees in end explosion.
            private constant boolean    ALLOW_PRELOAD = true               // Whether or not to allow preloading of effects.
            private constant string     ORDER_STRING  = "entanglingroots"  // Order string for the freeze ability (Abil2_id).
        endglobals
    
        private function Flame_damage takes integer lvl returns real
            return 50.00 * lvl    // Damage dealt to enemy units that come close to the fire dummy.
        endfunction
    
        private function End_damage takes integer lvl returns real
            return 50.00 + (50.00 * lvl)   // Damage dealt to enemy units at the end explosion.
        endfunction
    
        private function End_radius takes integer lvl returns real
            return 150.00 + (50.00 * lvl)   // Area of Effect for the end explosion.
        endfunction
    
        private function Combust_chance takes integer lvl returns integer
            return 10 + (5 * lvl)  // Percent chance for the combustion when the fireball its an enemy unit.
        endfunction
    
        private function Combust_radius takes integer lvl returns real
            return 50.00 * lvl    // Area of effect of the combustion when the fireball hits.
        endfunction
    
        private function Combust_damage takes integer lvl returns real
            return 25.00 * lvl    // Damage dealt by the combustion when it hits.
        endfunction
    
        //=======================================================================\\
        //   DO NOT TOUCH PAST THIS POINT UNLESS YOU KNOW WHAT YOUR ARE DOING!   \\
        //=======================================================================\\
        
        private struct Data
        
            unit    cast       = null
            unit    dummy1     = null
            unit    dummy2     = null
            unit    dummy3     = null
            real    targx      = 0.00
            real    targy      = 0.00
            real    angle      = 0.00
            real    newangle1  = 0.00
            real    newangle2  = 0.00
            real    sin        = 0.00
            real    cos        = 0.00
            real    x          = 0.00
            real    y          = 0.00
            real    start1x    = 0.00
            real    start1y    = 0.00
            real    start2x    = 0.00
            real    start2y    = 0.00
            real    maxdist    = 0.00
            integer level      = 0
            real    dist       = START_DIST
            group   frost      = CreateGroup()
            group   flame      = CreateGroup()
            
            static Data     array D
            static integer  DT          = 0
            static rect     Rect1       = null
            static timer    Timer       = null
            static group    Group1      = null
            static group    Group2      = null
            static unit     Tree_dummy  = null
            static boolexpr Tree_filt   = null
            static boolexpr Enemy_filt  = null
            static real     Game_maxX   = 0.00
            static real     Game_minX   = 0.00
            static real     Game_maxY   = 0.00
            static real     Game_minY   = 0.00
            
            static method safex takes real x returns real
                if x < .Game_minX then
                    return .Game_minX
                elseif x > .Game_maxX then
                    return .Game_maxX
                endif
                return x
            endmethod
    
            static method safey takes real y returns real
                if y < .Game_minY then
                    return .Game_minY
                elseif y > .Game_maxY then
                    return .Game_maxY
                endif
                return y
            endmethod
            
            static method destroyenumtrees takes nothing returns nothing
                call KillDestructable(GetEnumDestructable())
            endmethod
            
            static method treefilt takes nothing returns boolean
                local destructable dest   = GetFilterDestructable()
                local boolean      result = false
                
                if GetDestructableLife(dest) > 0.405 then
                    call ShowUnit(.Tree_dummy,true)
                    call SetUnitX(.Tree_dummy,GetWidgetX(dest))
                    call SetUnitY(.Tree_dummy,GetWidgetY(dest))
                    
                    set result = IssueTargetOrder(.Tree_dummy,"harvest",dest)
                    call IssueImmediateOrder(.Tree_dummy,"stop")
                    call ShowUnit(.Tree_dummy,false)
                    
                    set dest = null
                    return result
                endif
                
                set dest = null
                return result
            endmethod
            
            static method enemyfilt takes nothing returns boolean
                return GetWidgetLife(GetFilterUnit()) > 0.405 and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false and IsUnitType(GetFilterUnit(),UNIT_TYPE_FLYING) == false
            endmethod
            
            private method onDestroy takes nothing returns nothing
                local unit u = null
                
                call GroupEnumUnitsInRange(.Group1,.targx,.targy,End_radius(.level),.Enemy_filt)
                loop
                    set u = FirstOfGroup(.Group1)
                    exitwhen u == null
                    call GroupRemoveUnit(.Group1,u)
                    if IsUnitEnemy(u,GetOwningPlayer(.cast)) then
                        set .dummy3 = CreateUnit(GetOwningPlayer(.cast),DUMMY_ID,.targx,.targy,0.00)
                        call UnitDamageTarget(.cast,u,End_damage(.level),false,false,A_TYPE,D_TYPE,W_TYPE)
                        call UnitAddAbility(.dummy3,ABIL2_ID)
                        call SetUnitAbilityLevel(.dummy3,ABIL2_ID,.level)
                        call UnitApplyTimedLife(.dummy3,'BTLF',TIMED_LIFE)
                        call IssueTargetOrder(.dummy3,ORDER_STRING,u)
                        set .dummy3 = null
                    endif
                endloop
                
                if DESTROY_TREES then
                    call SetRect(.Rect1,.targx - End_radius(.level),.targy - End_radius(.level),.targx + End_radius(.level),.targy + End_radius(.level))
                    call EnumDestructablesInRect(.Rect1,.Tree_filt,function Data.destroyenumtrees)
                endif
                
                call DestroyGroup(.frost)
                call DestroyGroup(.flame)
                set .frost = null
                set .flame = null
    
                call DestroyEffect(AddSpecialEffect(END_FROST,GetUnitX(.dummy1),GetUnitY(.dummy1)))
                call DestroyEffect(AddSpecialEffect(END_FLAME,GetUnitX(.dummy2),GetUnitY(.dummy2)))
                call KillUnit(.dummy1)
                call KillUnit(.dummy2)
                set .cast = null
                set .dummy1 = null
                set .dummy2 = null
                set .dummy3 = null
                set u = null
            endmethod
    
            static method update takes nothing returns nothing
                local Data    d = 0
                local integer i = 1
                local real    x = 0.00
                local real    y = 0.00
                local unit    u = null
                local unit    n = null
                
                loop
                    exitwhen i > .DT
                    
                    set d = .D[i]
                
                    if d.dist >= d.maxdist then
                        call d.destroy()
                        set .D[i] = .D[.DT]
                        set .DT = .DT - 1
                        set i = i - 1
                    else            
                        set d.x = d.x + MOVE_DIST * d.cos
                        set d.y = d.y + MOVE_DIST * d.sin
                        set d.newangle1 = d.newangle1 + PARTIAL_ANGLE
                        set d.newangle2 = d.newangle2 + PARTIAL_ANGLE
                        
                        set x = .safex(d.x + ORB_WIDTH * Cos(d.newangle1 * bj_DEGTORAD))
                        set y = .safey(d.y + ORB_WIDTH * Sin(d.newangle1 * bj_DEGTORAD))
                
                        call SetUnitPosition(d.dummy1,x,y)
                        
                        call GroupEnumUnitsInRange(.Group1,x,y,COLLISION,.Enemy_filt)
                        loop
                            set u = FirstOfGroup(.Group1)
                            exitwhen u == null
                            call GroupRemoveUnit(.Group1,u)
                            if not IsUnitInGroup(u,d.frost) and IsUnitEnemy(u,GetOwningPlayer(d.cast)) then
                                call GroupAddUnit(d.frost,u)
                                call DestroyEffect(AddSpecialEffectTarget(FROST_HIT,u,ATTACH_POINT))
                                set d.dummy3 = CreateUnit(GetOwningPlayer(d.cast),DUMMY_ID,x,y,0.00)
                                call UnitAddAbility(d.dummy3,ABIL2_ID)
                                call SetUnitAbilityLevel(d.dummy3,ABIL2_ID,d.level)
                                call UnitApplyTimedLife(d.dummy3,'BTLF',TIMED_LIFE)
                                call IssueTargetOrder(d.dummy3,ORDER_STRING,u)
                                set d.dummy3 = null
                            endif
                        endloop 
                        
                        set x = .safex(d.x + ORB_WIDTH * Cos(d.newangle2 * bj_DEGTORAD))
                        set y = .safey(d.y + ORB_WIDTH * Sin(d.newangle2 * bj_DEGTORAD))
                
                        call SetUnitPosition(d.dummy2,x,y)
                        
                        call GroupEnumUnitsInRange(.Group1,x,y,COLLISION,.Enemy_filt)
                        loop
                            set u = FirstOfGroup(.Group1)
                            exitwhen u == null
                            call GroupRemoveUnit(.Group1,u)
                            if not IsUnitInGroup(u,d.flame) and IsUnitEnemy(u,GetOwningPlayer(d.cast)) then
                                call GroupAddUnit(d.flame,u)
                                call UnitDamageTarget(d.cast,u,Flame_damage(d.level),false,false,A_TYPE,D_TYPE,W_TYPE)
                                call DestroyEffect(AddSpecialEffectTarget(FLAME_HIT,u,ATTACH_POINT))
                                if GetRandomInt(0,100) <= Combust_chance(d.level) then
                                    call DestroyEffect(AddSpecialEffect(COMBUST_SFX,GetUnitX(u),GetUnitY(u)))
                                    call GroupEnumUnitsInRange(.Group2,GetUnitX(u),GetUnitY(u),Combust_radius(d.level),.Enemy_filt)
                                    loop
                                        set n = FirstOfGroup(.Group2)
                                        exitwhen n == null
                                        call GroupRemoveUnit(.Group2,n)
                                        call UnitDamageTarget(d.cast,n,Combust_damage(d.level),false,false,A_TYPE,D_TYPE,W_TYPE)
                                    endloop
                                endif
                            endif
                        endloop
                        
                        set d.dist = d.dist + MOVE_DIST
                    endif
                    
                    set i = i + 1
                endloop
                
                if .DT <= 0 then
                    call PauseTimer(.Timer)
                    set .DT = 0
                endif
                
                set u = null
                set n = null
            endmethod
    
            static method actions takes nothing returns boolean
                local Data     d     = Data.create()
                local location l     = GetSpellTargetLoc()
                local real     angle = 0.00
                local real     castx = 0.00
                local real     casty = 0.00
            
                set d.cast      = GetTriggerUnit()
                set castx       = GetUnitX(d.cast)
                set casty       = GetUnitY(d.cast)
                set d.targx     = .safex(GetLocationX(l))
                set d.targy     = .safey(GetLocationY(l))
                set angle       = Atan2((d.targy - casty),(d.targx - castx)) * bj_RADTODEG
                set d.cos       = Cos(angle * bj_DEGTORAD)
                set d.sin       = Sin(angle * bj_DEGTORAD)
                set d.x         = GetUnitX(d.cast) + START_DIST * d.cos
                set d.y         = GetUnitY(d.cast) + START_DIST * d.sin
                set d.start1x   = d.x + START_DIST * Cos((angle + 90.00) * bj_DEGTORAD)
                set d.start1y   = d.y + START_DIST * Sin((angle + 90.00) * bj_DEGTORAD)
                set d.start2x   = d.x + START_DIST * Cos((angle - 90.00) * bj_DEGTORAD)
                set d.start2y   = d.y + START_DIST * Sin((angle - 90.00) * bj_DEGTORAD)
                set d.newangle1 = angle + 90.00
                set d.newangle2 = angle - 90.00
                set d.dummy1    = CreateUnit(GetOwningPlayer(d.cast),FROST_ID,d.start1x,d.start1y,0.00)  
                set d.dummy2    = CreateUnit(GetOwningPlayer(d.cast),FLAME_ID,d.start2x,d.start2y,0.00)  
                set d.maxdist   = SquareRoot((castx - d.targx) * (castx - d.targx) + (casty - d.targy) * (casty - d.targy))
                set d.level     = GetUnitAbilityLevel(d.cast,ABIL_ID)
                
                call SetUnitScale(d.dummy1,FROST_SIZE,FROST_SIZE,FROST_SIZE)    
                call SetUnitScale(d.dummy2,FLAME_SIZE,FLAME_SIZE,FLAME_SIZE)  
                call UnitAddAbility(d.dummy1,CROW_FORM)
                call UnitRemoveAbility(d.dummy1,CROW_FORM)
                call UnitAddAbility(d.dummy2,CROW_FORM)
                call UnitRemoveAbility(d.dummy2,CROW_FORM)
                call SetUnitFlyHeight(d.dummy1,FLY_HEIGHT,0.00) 
                call SetUnitFlyHeight(d.dummy2,FLY_HEIGHT,0.00) 
                
                set .DT = .DT + 1
                set .D[.DT] = d
                if .DT == 1 then
                    call TimerStart(.Timer,INTERVAL,true,function Data.update)
                endif
                
                call RemoveLocation(l)
                set l = null
                
                return false
            endmethod        
    
            static method onInit takes nothing returns nothing
                set .Timer      = CreateTimer()
                set .Group1     = CreateGroup()
                set .Group2     = CreateGroup()
                set .Rect1      = Rect(0.00,0.00,1.00,1.00)
                set .Tree_filt  = Filter(function Data.treefilt)
                set .Enemy_filt = Filter(function Data.enemyfilt)
                
                set .Game_maxX = GetRectMaxX(bj_mapInitialPlayableArea) - 64.00
                set .Game_maxY = GetRectMaxY(bj_mapInitialPlayableArea) - 64.00
                set .Game_minX = GetRectMinX(bj_mapInitialPlayableArea) + 64.00
                set .Game_minY = GetRectMinY(bj_mapInitialPlayableArea) + 64.00
                
                // Register event.
                call GT_AddStartsEffectAction(function Data.actions,ABIL_ID)
                
                set .Tree_dummy = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),DUMMY_ID,0.00,0.00,0.00)
                call SetUnitPathing(.Tree_dummy,false)
                call ShowUnit(.Tree_dummy,false)
                
                if ALLOW_PRELOAD then
                    call DestroyEffect(AddSpecialEffect(FLAME_HIT,0.00,0.00))
                    call DestroyEffect(AddSpecialEffect(FROST_HIT,0.00,0.00))
                    call DestroyEffect(AddSpecialEffect(END_FLAME,0.00,0.00))
                    call DestroyEffect(AddSpecialEffect(END_FROST,0.00,0.00))
                    call DestroyEffect(AddSpecialEffect(COMBUST_SFX,0.00,0.00))
                endif
            endmethod
        
        endstruct
    
    endscope

    Magnetic Field

    JASS: Yes, vJass.
    JESP: Yes.
    Leakless: Yes.
    Lagless: Yes.
    MUI: Yes.
    Requires: NewGen and GTrigger.

    Description:

    Found in my next post (Post #4).

    Screenshot:
    [​IMG]

    Script:
    JASS:
    
    
    //------------------------------------------------------------------------------------\\
    //                               Magnetic Field [v3]                                  \\
    //                                   by kenny!                                        \\
    //                            Constructed using vJASS                                 \\
    //                         Requires NewGen WE & GTrigger                              \\
    //------------------------------------------------------------------------------------\\
    
    scope MagneticField2
    
        globals
            // Configurables:
            private constant integer ABIL_ID       = 'A001'    // Raw code of the Magnetic Field ability.
            private constant integer DUMMY_ID      = 'u001'    // Raw code of the dummy unit used to destroy trees.
            private constant real    INTERVAL      = 0.03125   // Used in the periodic timer to move units.
            private constant real    COLLISION     = 150.00    // Area around the moving units in which trees will be destroyed.
            private constant real    DISTANCE      = 75.00     // DISTANCE for checking pathability. Should be at least 25.00 distance less than COLLISION!!!
            private constant string  CASTED_SFX    = "Abilities\\Spells\\Undead\\Darksummoning\\DarkSummonTarget.mdl"   // Special effect that is attached to the caster.
            private constant string  CASTED_POINT  = "origin"  // where the special effect is attached to the caster.
            private constant boolean DESTROY_TREES = true      // Whether or not to allow destroying trees.
            private constant boolean ALLOW_PRELOAD = true      // Whether or not to allow preloading of effects.
        endglobals
    
        private function Duration takes integer lvl returns real
            return 6.00 * lvl
        endfunction
    
        private function Move_dist takes integer lvl returns real
            return 20.00 + (0.00 * lvl)
        endfunction
    
        private function Radius takes integer lvl returns real
            return 225.00 + (50.00 * lvl)
        endfunction
    
        //=======================================================================\\
        //   DO NOT TOUCH PAST THIS POINT UNLESS YOU KNOW WHAT YOUR ARE DOING!   \\
        //=======================================================================\\
        
        private struct Data
        
            unit    cast    = null
            effect  sfx     = null
            real    time    = 0.00
            integer lvl     = 0
            
            static Data     array D
            static item     array Hidden
            static integer  Hidden_max   = 0
            static integer  DT           = 0
            static rect     Rect1        = null
            static timer    Timer        = null
            static group    Group        = null
            static unit     Tree_dummy   = null
            static item     Item         = null
            static boolexpr Tree_filt    = null
            static boolexpr Unit_filt    = null
            static real     Game_maxX    = 0.00
            static real     Game_minX    = 0.00
            static real     Game_maxY    = 0.00
            static real     Game_minY    = 0.00
            static real     Max_range    = 10.00
    
            static method hide takes nothing returns nothing
                if IsItemVisible(GetEnumItem()) then
                    set .Hidden[.Hidden_max] = GetEnumItem()
                    call SetItemVisible(.Hidden[.Hidden_max],false)
                    set .Hidden_max = .Hidden_max + 1
                endif
            endmethod
    
            static method pathability takes real x1, real y1 returns boolean
                local real x2 = 0.00
                local real y2 = 0.00
                
                call SetRect(.Rect1,0.00,0.00,128.00,128.00)
                call MoveRectTo(.Rect1,x1,y1)
                call EnumItemsInRect(.Rect1,null,function Data.hide)
    
                call SetItemPosition(.Item,x1,y1)
                set x2 = GetItemX(.Item)
                set y2 = GetItemY(.Item)
                call SetItemVisible(.Item,false)
    
                loop
                    exitwhen .Hidden_max <= 0
                    set .Hidden_max = .Hidden_max - 1
                    call SetItemVisible(.Hidden[.Hidden_max],true)
                    set .Hidden[.Hidden_max] = null
                endloop
    
                return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) < .Max_range * .Max_range
            endmethod
    
            static method safex takes real x returns real
                if x < .Game_minX then
                    return .Game_minX
                elseif x > .Game_maxX then
                    return .Game_maxX
                endif
                return x
            endmethod
    
            static method safey takes real y returns real
                if y < .Game_minY then
                    return .Game_minY
                elseif y > .Game_maxY then
                    return .Game_maxY
                endif
                return y
            endmethod
            
            static method destroyenumtrees takes nothing returns nothing
                call KillDestructable(GetEnumDestructable())
            endmethod
            
            static method treefilt takes nothing returns boolean
                local destructable dest   = GetFilterDestructable()
                local boolean      result = false
                
                if GetDestructableLife(dest) > 0.405 then
                    call ShowUnit(.Tree_dummy,true)
                    call SetUnitX(.Tree_dummy,GetWidgetX(dest))
                    call SetUnitY(.Tree_dummy,GetWidgetY(dest))
                    
                    set result = IssueTargetOrder(.Tree_dummy,"harvest",dest)
                    call IssueImmediateOrder(.Tree_dummy,"stop")
                    call ShowUnit(.Tree_dummy,false)
                    
                    set dest = null
                    return result
                endif
                
                set dest = null
                return result
            endmethod
            
            static method unitfilt takes nothing returns boolean
                return GetWidgetLife(GetFilterUnit()) > 0.405 and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false
            endmethod
            
            private method onDestroy takes nothing returns nothing
                call DestroyEffect(.sfx)
                set .sfx = null
                set .cast = null
            endmethod
            
            static method update takes nothing returns nothing
                local Data    d      = 0
                local integer i      = 1
                local unit    u      = null
                local real    castx  = 0.00
                local real    casty  = 0.00
                local real    angle  = 0.00
                local real    sin    = 0.00
                local real    cos    = 0.00
                local real    ux     = 0.00
                local real    uy     = 0.00
                
                loop
                    exitwhen i > .DT
                    
                    set d = .D[i]
                    
                    set castx = GetUnitX(d.cast)
                    set casty = GetUnitY(d.cast)
                    
                    if d.time >= Duration(d.lvl) or GetWidgetLife(d.cast) < 0.405 then
                        call d.destroy()
                        set .D[i] = .D[.DT]
                        set .DT = .DT - 1
                        set i = i - 1
                    else
                        call GroupEnumUnitsInRange(.Group,castx,casty,Radius(d.lvl),.Unit_filt)
                        call GroupRemoveUnit(.Group,d.cast)
                        loop
                            set u = FirstOfGroup(.Group)
                            exitwhen u == null
                            call GroupRemoveUnit(.Group,u)
                            set ux = GetUnitX(u)
                            set uy = GetUnitY(u)
                            set angle = Atan2((uy - casty),(ux - castx))
                            set sin = Sin(angle)
                            set cos = Cos(angle)
                            if .pathability(ux + DISTANCE * cos,uy + DISTANCE * sin) then
                                set ux = .safex(ux + Move_dist(d.lvl) * cos)
                                set uy = .safey(uy + Move_dist(d.lvl) * sin)
                                call SetUnitPosition(u,ux,uy)
                                if DESTROY_TREES then
                                    call SetRect(.Rect1,ux - COLLISION,uy - COLLISION,ux + COLLISION,uy + COLLISION)
                                    call EnumDestructablesInRect(.Rect1,.Tree_filt,function Data.destroyenumtrees)
                                endif                            
                            endif
                        endloop
                        
                        set d.time = d.time + INTERVAL
                    endif
                    
                    set i = i + 1
                endloop
                
                if .DT <= 0 then
                    call PauseTimer(.Timer)
                    set .DT = 0
                endif               
                    
                set u = null
            endmethod
            
            static method actions takes nothing returns boolean
                local Data d = Data.create()
                
                set d.cast = GetTriggerUnit()
                set d.lvl  = GetUnitAbilityLevel(d.cast,ABIL_ID)
                set d.sfx  = AddSpecialEffectTarget(CASTED_SFX,d.cast,CASTED_POINT)
                
                set .DT = .DT + 1
                set .D[.DT] = d
                if .DT == 1 then
                    call TimerStart(.Timer,INTERVAL,true,function Data.update)
                endif
                
                return false
            endmethod
    
            static method onInit takes nothing returns nothing
                set .Timer     = CreateTimer()
                set .Group     = CreateGroup()
                set .Rect1     = Rect(0.00,0.00,1.00,1.00)
                set .Tree_filt = Filter(function Data.treefilt)
                set .Unit_filt = Filter(function Data.unitfilt)
                
                set .Game_maxX = GetRectMaxX(bj_mapInitialPlayableArea) - 64.00
                set .Game_maxY = GetRectMaxY(bj_mapInitialPlayableArea) - 64.00
                set .Game_minX = GetRectMinX(bj_mapInitialPlayableArea) + 64.00
                set .Game_minY = GetRectMinY(bj_mapInitialPlayableArea) + 64.00
                
                // Register event.
                call GT_AddStartsEffectAction(function Data.actions,ABIL_ID)
                
                set .Tree_dummy = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),DUMMY_ID,0.00,0.00,0.00)
                call SetUnitPathing(.Tree_dummy,false)
                call ShowUnit(.Tree_dummy,false)
                
                set .Item  = CreateItem('ciri',0.00,0.00)
                call SetItemVisible(.Item,false)
                
                if ALLOW_PRELOAD then
                    call DestroyEffect(AddSpecialEffect(CASTED_SFX,0.00,0.00))
                endif            
            endmethod
        
        endstruct
    
    endscope

    Firewall

    JASS: Yes, vJass.
    JESP: Yes.
    Leakless: Yes.
    Lagless: Yes.
    MUI: Yes.
    Requires: NewGen and GTrigger.

    Description:

    Found in my next post (Post #4).

    Screenshot:
    [​IMG]

    Script:
    JASS:
    
    
    //------------------------------------------------------------------------------------\\
    //                                 Firewall [v3]                                      \\
    //                                   by kenny!                                        \\
    //                            Constructed using vJASS                                 \\
    //                         Requires NewGen WE & GTrigger                              \\
    //------------------------------------------------------------------------------------\\
    
    scope Firewall2
    
        globals
            private constant integer    ABIL_ID       = 'A002'  // Raw code of the Firewall ability.
            private constant integer    ABIL2_ID      = 'A003'  // Raw code of the permanent immolation ability.
            private constant integer    UNIT_ID       = 'n002'  // Raw code of the dummy unit used for the fire wall.
            private constant integer    TREEDUMMY_ID  = 'u001'  // Raw code of the dummy unit used for destroying trees.
            private constant real       INTERVAL      = 0.25    // INTERVAL for periodic timer, creating the wall over time. Try to keep it down around 0.02 - 0.30.
            private constant real       SPREAD_DIST   = 125.00  // Distance between each part of the fire wall when they are created.
            private constant real       SCALE         = 1.50    // Original scale size of the middle wall section.
            private constant string     BEGIN_SFX     = "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl"            // Effect played for the beginning explosion.
            private constant string     DAMAGE_SFX    = "Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl" // Effect played when a unit is hurt by that explosion.
            private constant string     DAMAGE_POINT  = "chest" // Attachment point for above effect.
            private constant attacktype A_TYPE        = ATTACK_TYPE_CHAOS     // Attack type of damage dealt by explosion.
            private constant damagetype D_TYPE        = DAMAGE_TYPE_UNIVERSAL // Damage type of damage dealt by explosion.
            private constant weapontype W_TYPE        = WEAPON_TYPE_WHOKNOWS  // Weapon type of damage dealt by explosion.
            private constant boolean    DESTROY_TREES = true    // Whether or not to destroy trees.
            private constant boolean    ALLOW_PRELOAD = true    // Whether or not to allow preloading of effects.
        endglobals 
        
        private function Max_length takes integer lvl returns integer
            return 1 + (1 * lvl) // Legnth of the wall. This will be the number of wall sections created on each side of the middle section.
        endfunction              // For example: Level 3 = 4 sections either side, therefore 9 parts are created all together, at "SPREAD_DIST" distance apart from each other.   
    
        private function Duration takes integer lvl returns real
            return 6.00 + (2.00 + lvl) // How long the wall will last.
        endfunction
    
        private function Radius takes integer lvl returns real
            return 100.00 + (20.00 * lvl) // Radius of the explosion at the start.
        endfunction
    
        private function Damage takes integer lvl returns real
            return 40.00 + (40.00 * lvl) // Damage dealt by beginning explosion.
        endfunction
    
        private function Scale_reduction takes integer spread returns real
            return 0.10 * spread // SCALE reduction of the wall sections. Gives a nice effect (Large in middle - smaller on sides).
        endfunction
        
        //=======================================================================\\
        //   DO NOT TOUCH PAST THIS POINT UNLESS YOU KNOW WHAT YOUR ARE DOING!   \\
        //=======================================================================\\
        
        private struct Data
          
            unit    cast    = null
            real    castx   = 0.00
            real    casty   = 0.00
            real    locx    = 0.00
            real    locy    = 0.00
            real    sin1    = 0.00
            real    sin2    = 0.00
            real    cos1    = 0.00
            real    cos2    = 0.00
            integer level   = 0
            integer spread  = 0
            
            static Data     array D
            static integer  DT          = 0
            static rect     Rect1       = null
            static timer    Timer       = null
            static group    Group       = null
            static unit     Tree_dummy  = null
            static boolexpr Tree_filt   = null
            static boolexpr Enemy_filt  = null
            static real     Game_maxX   = 0.00
            static real     Game_minX   = 0.00
            static real     Game_maxY   = 0.00
            static real     Game_minY   = 0.00
    
            static method safex takes real x returns real
                if x < .Game_minX then
                    return .Game_minX
                elseif x > .Game_maxX then
                    return .Game_maxX
                endif
                return x
            endmethod
    
            static method safey takes real y returns real
                if y < .Game_minY then
                    return .Game_minY
                elseif y > .Game_maxY then
                    return .Game_maxY
                endif
                return y
            endmethod
            
            static method destroyenumtrees takes nothing returns nothing
                call KillDestructable(GetEnumDestructable())
            endmethod
            
            static method treefilt takes nothing returns boolean
                local destructable dest   = GetFilterDestructable()
                local boolean      result = false
                
                if GetDestructableLife(dest) > 0.405 then
                    call ShowUnit(.Tree_dummy,true)
                    call SetUnitX(.Tree_dummy,GetWidgetX(dest))
                    call SetUnitY(.Tree_dummy,GetWidgetY(dest))
                    
                    set result = IssueTargetOrder(.Tree_dummy,"harvest",dest)
                    call IssueImmediateOrder(.Tree_dummy,"stop")
                    call ShowUnit(.Tree_dummy,false)
                    
                    set dest = null
                    return result
                endif
                
                set dest = null
                return result
            endmethod
            
            static method enemyfilt takes nothing returns boolean
                return GetWidgetLife(GetFilterUnit()) > 0.405 and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false and IsUnitType(GetFilterUnit(),UNIT_TYPE_FLYING) == false
            endmethod
            
            private method onDestroy takes nothing returns nothing
                set .cast = null
            endmethod
    
            static method update takes nothing returns nothing
                local Data    d      = 0
                local integer i      = 1
                local real    radius = 0.00
                local real    newx1  = 0.00
                local real    newy1  = 0.00
                local real    newx2  = 0.00
                local real    newy2  = 0.00
                local unit    flame  = null
                local unit    first  = null
                
                loop
                    exitwhen i > .DT
                    
                    set d = .D[i]
                    
                    set radius = Radius(d.level)
                    set d.spread = d.spread + 1
                    
                    if d.spread > Max_length(d.level) then
                        call d.destroy()
                        set .D[i] = .D[.DT]
                        set .DT = .DT - 1
                        set i = i - 1
                    else
                        set newx1 = .safex(d.locx + (d.spread * SPREAD_DIST) * d.cos1)
                        set newy1 = .safey(d.locy + (d.spread * SPREAD_DIST) * d.sin1)
                        set newx2 = .safex(d.locx + (d.spread * SPREAD_DIST) * d.cos2)
                        set newy2 = .safey(d.locy + (d.spread * SPREAD_DIST) * d.sin2)
                        
                        set flame = CreateUnit(GetOwningPlayer(d.cast),UNIT_ID,newx1,newy1,0.00)
                        call SetUnitScale(flame,(SCALE - Scale_reduction(d.spread)),(SCALE - Scale_reduction(d.spread)),0.00)
                        call DestroyEffect(AddSpecialEffect(BEGIN_SFX,newx1,newy1))
                        call UnitApplyTimedLife(flame,'BTLF',Duration(d.level))
                        call SetUnitAbilityLevel(flame,ABIL2_ID,d.level)
                        call PauseUnit(flame,true)
                        call PauseUnit(flame,false)
                        
                        call GroupEnumUnitsInRange(.Group,newx1,newy1,radius,.Enemy_filt)
                        loop
                            set first = FirstOfGroup(.Group)
                            exitwhen first == null
                            call GroupRemoveUnit(.Group,first)
                            if IsUnitEnemy(first,GetOwningPlayer(d.cast)) then
                                call UnitDamageTarget(d.cast,first,Damage(d.level),false,false,A_TYPE,D_TYPE,W_TYPE)
                                call DestroyEffect(AddSpecialEffectTarget(DAMAGE_SFX,first,DAMAGE_POINT))
                            endif
                        endloop
                        
                        if DESTROY_TREES then
                            call SetRect(.Rect1,newx1 - radius,newy1 - radius,newx1 + radius,newy1 + radius)
                            call EnumDestructablesInRect(.Rect1,.Tree_filt,function Data.destroyenumtrees)
                        endif
                        
                        set flame = CreateUnit(GetOwningPlayer(d.cast),UNIT_ID,newx2,newy2,0.00)
                        call SetUnitScale(flame,(SCALE - Scale_reduction(d.spread)),(SCALE - Scale_reduction(d.spread)),0.00)
                        call DestroyEffect(AddSpecialEffect(BEGIN_SFX,newx2,newy2))
                        call UnitApplyTimedLife(flame,'BTLF',Duration(d.level))
                        call SetUnitAbilityLevel(flame,ABIL2_ID,d.level)
                        call PauseUnit(flame,true)
                        call PauseUnit(flame,false)
                        
                        call GroupEnumUnitsInRange(.Group,newx2,newy2,radius,.Enemy_filt)
                        loop
                            set first = FirstOfGroup(.Group)
                            exitwhen first == null
                            call GroupRemoveUnit(.Group,first)
                            if IsUnitEnemy(first,GetOwningPlayer(d.cast)) then
                                call UnitDamageTarget(d.cast,first,Damage(d.level),false,false,A_TYPE,D_TYPE,W_TYPE)
                                call DestroyEffect(AddSpecialEffectTarget(DAMAGE_SFX,first,DAMAGE_POINT))
                            endif
                        endloop
                        
                        if DESTROY_TREES then
                            call SetRect(.Rect1,newx2 - radius,newy2 - radius,newx2 + radius,newy2 + radius)
                            call EnumDestructablesInRect(.Rect1,.Tree_filt,function Data.destroyenumtrees)
                        endif
                    endif
                    
                    set i = i + 1
                endloop
                
                if .DT <= 0 then
                    call PauseTimer(.Timer)
                    set .DT = 0
                endif
                
                set flame = null
                set first = null
            endmethod        
            
            static method actions takes nothing returns boolean
                local Data     d     = Data.create()
                local location l     = GetSpellTargetLoc()
                local unit     flame = null
                local unit     first = null
                local real     angle = 0.00
                
                set d.cast   = GetTriggerUnit()
                set d.castx  = GetUnitX(d.cast)
                set d.casty  = GetUnitY(d.cast)
                set d.locx   = .safex(GetLocationX(l))
                set d.locy   = .safey(GetLocationY(l))
                set angle    = Atan2((d.locy - d.casty),(d.locx - d.castx))
                set d.sin1   = Sin(angle + (90.00 * bj_DEGTORAD))
                set d.sin2   = Sin(angle - (90.00 * bj_DEGTORAD))
                set d.cos1   = Cos(angle + (90.00 * bj_DEGTORAD))
                set d.cos2   = Cos(angle - (90.00 * bj_DEGTORAD))
                set d.level  = GetUnitAbilityLevel(d.cast,ABIL_ID)
                set d.spread = 0
                
                set flame = CreateUnit(GetOwningPlayer(d.cast),UNIT_ID,d.locx,d.locy,0.00)
                call SetUnitScale(flame,SCALE,SCALE,0.00)
                call DestroyEffect(AddSpecialEffect(BEGIN_SFX,d.locx,d.locy))
                call UnitApplyTimedLife(flame,'BTLF',Duration(d.level))
                call SetUnitAbilityLevel(flame,ABIL2_ID,d.level)
                call PauseUnit(flame,true)
                call PauseUnit(flame,false)
                
                call GroupEnumUnitsInRange(.Group,d.locx,d.locy,Radius(d.level),.Enemy_filt)
                loop
                    set first = FirstOfGroup(.Group)
                    exitwhen first == null
                    call GroupRemoveUnit(.Group,first)
                    if IsUnitEnemy(first,GetOwningPlayer(d.cast)) then
                        call UnitDamageTarget(d.cast,first,Damage(d.level),false,false,A_TYPE,D_TYPE,W_TYPE)
                        call DestroyEffect(AddSpecialEffectTarget(DAMAGE_SFX,first,DAMAGE_POINT))
                    endif
                endloop
                
                if DESTROY_TREES then
                    call SetRect(.Rect1,d.locx - Radius(d.level),d.locy - Radius(d.level),d.locx + Radius(d.level),d.locy + Radius(d.level))
                    call EnumDestructablesInRect(.Rect1,.Tree_filt,function Data.destroyenumtrees)
                endif
                
                set .DT = .DT + 1
                set .D[.DT] = d
                if .DT == 1 then
                    call TimerStart(.Timer,INTERVAL,true,function Data.update)
                endif
            
                call RemoveLocation(l)
                set flame = null
                set first = null
                set l = null
                
                return false
            endmethod         
    
            static method onInit takes nothing returns nothing
                set .Timer      = CreateTimer()
                set .Group      = CreateGroup()
                set .Rect1      = Rect(0.00,0.00,1.00,1.00)
                set .Tree_filt  = Filter(function Data.treefilt)
                set .Enemy_filt = Filter(function Data.enemyfilt)
                
                set .Game_maxX = GetRectMaxX(bj_mapInitialPlayableArea) - 64.00
                set .Game_maxY = GetRectMaxY(bj_mapInitialPlayableArea) - 64.00
                set .Game_minX = GetRectMinX(bj_mapInitialPlayableArea) + 64.00
                set .Game_minY = GetRectMinY(bj_mapInitialPlayableArea) + 64.00
    
                // Register event.
                call GT_AddStartsEffectAction(function Data.actions,ABIL_ID)
                
                set .Tree_dummy = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),TREEDUMMY_ID,0.00,0.00,0.00)
                call SetUnitPathing(.Tree_dummy,false)
                call ShowUnit(.Tree_dummy,false)
                
                if ALLOW_PRELOAD then
                    call DestroyEffect(AddSpecialEffect(BEGIN_SFX,0.00,0.00))
                    call DestroyEffect(AddSpecialEffect(DAMAGE_SFX,0.00,0.00))
                endif
            endmethod
        
        endstruct
    
    endscope

    Sanity's Eclipse

    JASS?: Yes, vJass.
    JESP?: Yes.
    Leakless?: Yes.
    Lagless?: Yes.
    MUI?: Yes.
    Requires: NewGen and GTrigger.

    Description:

    Found in my next post (Post #4).

    Screenshot:
    [​IMG]

    Script:
    JASS:
    
    
    // Found in my next post (Post #4).


    Change log:

    Found in my next post (Post #4).
     

    Attached Files:

    • Like Like x 8
  2. GoGo-Boy

    GoGo-Boy You can change this now in User CP

    Ratings:
    +40 / 0 / -0
    Can not test them. When I try to save the map JASS helper tells me that I shall remove the "//!" from the cssafety.
    I use the newest NewGen version.
     
  3. Hatebreeder

    Hatebreeder So many apples

    Ratings:
    +383 / 0 / -0
    Very nice <3
    I love the Helix =)
    The others are... well, pretty common. Anyways, it's still pretty nice since it's coded in vJass (I don't think we have so many vJass spells in the Spell section..).
     
  4. Kenny

    Kenny Back for now.

    Ratings:
    +202 / 0 / -0
    Elemental Helix

    Description:

    Sends two powerful elemental orbs towards a target location, the frost orb will freeze enemies that come near it, while the fire orb will deal damage to all units it passes.

    Level 1 - Freezes units for 2 seconds, deals 50 damage to enemy units, has a 15% chance to combust on a unit causing 25 damage in a 50 AoE. Final explosion deals 100 damage and freezes units for 2 seconds in a 200 AoE.

    Level 2 - Freezes units for 3 seconds, deals 100 damage to enemy units, has a 20% chance to combust on a unit causing 50 damage in a 100 AoE. Final explosion deals 150 damage and freezes units for 3 seconds in a 250 AoE.

    Level 3 - Freezes units for 4 seconds, deals 150 damage to enemy units, has a 25% chance to combust on a unit causing 75 damage in a 150 AoE. Final explosion deals 200 damage and freezes units for 4 seconds in a 300 AoE.


    Magnetic Field

    Description:

    Creates a powerful magnetic field around the caster that doesn't allow any unit to come within a certain range for the duration of the spell.

    Level 1 - Does not allow units to come within 275 range for 6 seconds.

    Level 2 - Does not allow units to come within 325 range for 12 seconds.

    Level 3 - Does not allow units to come within 375 range for 18 seconds.


    Firewall

    Description:

    Creates of wall of fire that incinerates the area, dealing damage to enemy units that come near the wall, and dealing large amounts of damage when it is created.

    Level 1 - Deals 80 inital damage when each section of the wall is created, then 15 damage per second to units that come close to the wall. Creates a short wall that lasts 8 seconds.

    Level 2 - Deals 120 initial damage when each section of the wall is created, then 30 damage per second to units that come close to the wall. Creates a long wall that lasts 10 seconds.

    Level 3 - Deals 160 initial damage when each section of the wall is created, then 45 damage per second to units that come close to the wall. Creates a very long wall that lasts 12 seconds.


    Sanity's Eclipse

    Description:

    The Obsidian Destroyer unleashes his full potential; his mind unleashes a psionic storm able to penetrate lesser minds with terminal force, dealing massive damage to them. More crafty minds are able to resist most of the damage, but they expend most of their energies to do so, losing 75% of their mana. Heroes with more intelligence than the Destroyer are unaffected.

    Level 1 - Deals damage equal to 8x the difference between the heroes intelligence and Destroyer's intelligence. 400 AOE.

    Level 2 - Deals damage equal to 9x the difference between the heroes intelligence and Destroyer's intelligence. 500 AOE.

    Level 3 - Deals damage equal to 10x the difference between the heroes intelligence and Destroyer's intelligence. 600 AOE.

    Script:
    JASS:
    //------------------------------------------------------------------------------------\\
    //                              Sanitys Eclipse [v3]                                  \\
    //                                   by kenny!                                        \\
    //                            Constructed using vJASS                                 \\
    //                         Requires NewGen WE & GTrigger                              \\
    //------------------------------------------------------------------------------------\\
    
    scope SanitysEclipse2 initializer InitTrig
    
        globals
            // Configurables:
            private constant integer    ABIL_ID       = 'A004'                // Raw code of Sanity's Eclipse ability.
            private constant integer    EFFECT_NUMBER = 8                     // Amount of effects used in the ring.
            private constant string     CIRCLE_SFX    = "Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl" // Special effect used for circle; eyecandy.
            private constant string     MANA_SFX      = "Abilities\\Spells\\Human\\Feedback\\SpellBreakerAttack.mdl"   // Special effect used for mana loss.
            private constant string     MANA_POINT    = "overhead"            // Attachment point of the mana loss special effect.
            private constant attacktype A_TYPE        = ATTACK_TYPE_CHAOS     // Attack type of the damage dealt to heroes.
            private constant damagetype D_TYPE        = DAMAGE_TYPE_UNIVERSAL // Damage type of the damage dealt to heroes.
            private constant weapontype W_TYPE        = WEAPON_TYPE_WHOKNOWS  // Weapon type for the damage dealt to heroes.
            private constant boolean    ALLOW_PRELOAD = true                  // Whether or not to allow preloading of effects.
            // Stuff for TextTag:
            private constant integer RED      = 255   // Used in text to make writing more red.
            private constant integer BLUE     = 0     // Used in text to make writing more blue.
            private constant integer GREEN    = 0     // Used in text to make writing more green.
            private constant integer ALPHA    = 255   // Used in text to set transparency.
            private constant real    VELOCITY = 0.04  // VELOCITY of the text, best kept at 0.04.
            private constant real    DURATION = 3.00  // How long the text will last.
        endglobals
    
        private function Stat_diff takes unit cast, unit targ returns integer
             return GetHeroInt(cast,true) - GetHeroInt(targ,true) // Difference between casters intel and random heroes intel.
        endfunction
    
        private function Damage_multiplier takes integer lvl returns real
             return 7.00 + (1.00 * lvl) // What the intel difference is multiplied by to get the damage dealt to heroes
        endfunction
        
        private function Mana_percentage takes integer lvl returns real
            return 0.25 + (0.00 * lvl) // Percentage of mana that units will be left with if they get dealt under the certain amount of damage.
        endfunction
    
        private function Threshold takes integer lvl returns real
            return 15.00 * lvl
            // This part is important, as a lot of people don't know what constitutes for 'crafty minds' in dota
            // This will be used to determine if the random hero will lose mana when the ability is used
            // If the base damage (Stat_diff(lvl)) is less then this, the unit will lose mana
            // if not, the unit will just be dealt damage.
            // For Example: If the intel difference between two heroes is 44 and this skill is
            // on the last level, the hero will be dealt 440 damage (44*10). Since this function will return
            // 45 on the last level, that means that the hero will lose mana, as it did not get dealt
            // at least 450 damage (45*10).
            // Hope everyone understands, as i didnt get it the first time.
        endfunction
    
        private function Radius takes integer lvl returns real
            return 300.00 + (100.00 * lvl) // Radius of the spell.
        endfunction
    
        private function Text_string takes integer intel, real multi returns string
            return I2S(intel * R2I(multi)) + "!" // The text that is made. No need to change this.
        endfunction
    
        private function Enemy_filter takes nothing returns boolean
            return IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO) == true and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit())) and GetWidgetLife(GetFilterUnit()) > 0.405
        endfunction // Filters for: alive, enemy, hero units.
    
        //=======================================================================\\
        //   DO NOT TOUCH PAST THIS POINT UNLESS YOU KNOW WHAT YOUR ARE DOING!   \\
        //=======================================================================\\
        
        globals
            private group    Group      = null // Used to create the group needed to damage heroes.
            private boolexpr Enemy_filt = null // Needed for filtering enemies.
        endglobals
    
        private function Text takes string text, unit targ returns nothing
            local texttag t = CreateTextTag()
    
            call SetTextTagText(t,text,0.025)
            call SetTextTagPosUnit(t,targ,15.00)
            call SetTextTagColor(t,RED,GREEN,BLUE,ALPHA)
            call SetTextTagVelocity(t,0.00,VELOCITY)
            call SetTextTagVisibility(t,true)
            call SetTextTagFadepoint(t,2.00)
            call SetTextTagLifespan(t,DURATION)
            call SetTextTagPermanent(t,false)
                        
            set t = null
        endfunction
    
        private function Actions takes nothing returns boolean
            local location loc  = GetSpellTargetLoc()
            local unit     cast = GetTriggerUnit()
            local real     locx = GetLocationX(loc)
            local real     locy = GetLocationY(loc)
            local real     ang  = 360.00 / EFFECT_NUMBER
            local integer  lvl  = GetUnitAbilityLevel(cast,ABIL_ID)
            local integer  i    = 1
            local unit     enum = null
            local string   Dam
            
            call DestroyEffect(AddSpecialEffect(CIRCLE_SFX,locx,locy)) 
            loop
                exitwhen i > EFFECT_NUMBER
                call DestroyEffect(AddSpecialEffect(CIRCLE_SFX,locx + (Radius(lvl) - 125.00) * Cos((ang * i) * bj_DEGTORAD),locy + (Radius(lvl) - 125.00) * Sin((ang * i) * bj_DEGTORAD)))
                set i = i + 1
            endloop
            
            call GroupEnumUnitsInRange(Group,locx,locy,Radius(lvl),Enemy_filt)
            loop
                set enum = FirstOfGroup(Group)
                set Dam = Text_string(Stat_diff(cast,enum),Damage_multiplier(lvl))
                exitwhen enum == null
                call GroupRemoveUnit(Group,enum)
                if (Stat_diff(cast,enum) > 0) then
                    call UnitDamageTarget(cast,enum,(Stat_diff(cast,enum) * Damage_multiplier(lvl)),false,false,A_TYPE,D_TYPE,W_TYPE)
                    call Text(Dam,enum)
                    if (Stat_diff(cast,enum) < Threshold(lvl)) then 
                        call DestroyEffect(AddSpecialEffectTarget(MANA_SFX,enum,MANA_POINT))
                        call SetUnitState(enum,UNIT_STATE_MANA,GetUnitState(enum,UNIT_STATE_MANA) * Mana_percentage(lvl))                
                    endif            
                endif
            endloop 
            
            call RemoveLocation(loc)
            set cast = null
            set enum = null
            set loc = null
            
            return false
        endfunction
    
        private function InitTrig takes nothing returns nothing
            set Group      = CreateGroup()
            set Enemy_filt = Filter(function Enemy_filter)
            
            //Register event.
            call GT_AddStartsEffectAction(function Actions,ABIL_ID)
            
            if ALLOW_PRELOAD then
                call DestroyEffect(AddSpecialEffect(CIRCLE_SFX,0.00,0.00))
                call DestroyEffect(AddSpecialEffect(MANA_SFX,0.00,0.00))
            endif
        endfunction
    
    endscope


    Change Log:

    • 4th May, 08 - Initial Release.
    • 15th May, 08 - Bit of editing done. Made Elemental Helix 100% MUI now, by using entangling roots for freeze, now importing is a bit harder. Fixed up my global groups and clearing them as well as various other things. Also fixed the CSSafety library in the map to compile properly with vJass/jasshelper.
    • 20th May, 08 - Updated scripts a bit, using scope initializers. Changed Elemental Helix a bit, now deals more dmg :D, minor updates really.
    • 19th Mar, 09 - Major update. Re-wrote all the script to each spell. Each spell is now independant, meaing you no longer need any systems for them to work. Configuration as been made easier. Found a massive flaw with Magnetic field, which cause it to leak like crazy, it is now fixed. Made the spells more efficient, and the scripts easier to read.
    • 12 April, 09 - Semi-major update. All spells now require GTrigger by Jesus4Lyf. Don't worry, this doesn't mean they are 1000 times more complicated. You just have to copy and paste the GT trigger into your map to use these spells. I use GTrigger because it is much more efficient, and very easy to use (Plus is shaves off like 20+ lines from each script). Standardised all the spells, again. They now follow the basic standards of JASS, hopefully. And there are a few small coding updates to improve efficiency and stuff.
     
  5. GoGo-Boy

    GoGo-Boy You can change this now in User CP

    Ratings:
    +40 / 0 / -0
    Okay I tested now using the standard way without editor^^
    And yeaia!! These spells are all really cool. I got to agree, I've never seen such a nice firewall. People will like the magnetic field, although I personally think that it looks crappy when the units movement is kinda broken. Dunno if that is fixable but else that spell is great. Sanity Eclipse is surely cool as well and I agree to the helix, people love spiraling spells... that's why I'm doing something similar myself :D

    +Rep :thup:

    The best thing is, that these kind of spells are actually useful in a lot different map types.

    Edit: Yes I use 5a... moment I check the settings. Should be all right. But JASS helper simply encounters error for that >_<
     
  6. T.s.e

    T.s.e Wish I was old and a little sentimental

    Ratings:
    +133 / 0 / -0
    That magnetic field spell seems familiar. I actually learned something from these spells, good job. +Rep
     
  7. lh2705

    lh2705 Just another Helper

    Ratings:
    +111 / 0 / -0
    I think Tinki3 made that magnetic field before..I can remember

    Other than that,
    Nice spells. :D
     
  8. Insane!

    Insane! Shh I didn't edit this, go away.

    Ratings:
    +121 / 0 / -0
    lol fire wall, lets hope you didnt base it off the windows one :p
     
  9. Kenny

    Kenny Back for now.

    Ratings:
    +202 / 0 / -0
    > although I personally think that it looks crappy when the units movement is kinda broken

    I think this can be fixed my lowering the distance the units are moved per interval... thats if I understand you correctly.

    *EDIT*

    JASS:
    private function Distance takes integer lvl returns real
        return 15.00+(0.00*lvl)     // The Distance each unit is moved per level (can be 15.00 or 14.00+(1.00*lvl) etc.)
    endfunction


    I think if you lower that, it will fix your problem. But if you do, it will make it a bit easier for units to get closer then the range (Say if you walk into them while they are attacking you for like 10 seconds they will probably get an attack or two off).


    > That magnetic field spell seems familiar. I actually learned something from these spells, good job. +Rep

    Hmm, ill have to check up on that... And its good to hear that you learnt something, after all, thats basically why im doing this.

    > I think Tinki3 made that magnetic field before..I can remember

    Hahah, so he did. How embarrassing, me thinking its all original and creative :eek:

    > lol fire wall, lets hope you didnt base it off the windows one

    Haha, that was a good laugh. Luckily i didn't :p

    Any comments on improvements or anything else for that matter?
     
  10. Kenny

    Kenny Back for now.

    Ratings:
    +202 / 0 / -0
    -Bump-

    Does anyone have any constructive feedback?

    Maybe there ares some leaks or something that someone could point out, otherwise im happy for some general comments. :)

    -kenny!
     
  11. Sim

    Sim Forum Administrator Staff Member

    Ratings:
    +531 / 0 / -0
    Remove Magnetic Shield.

    It's exactly the same as Tinki3's.

    Nice spells!
     
  12. Kenny

    Kenny Back for now.

    Ratings:
    +202 / 0 / -0
    > Remove Magnetic Shield

    It's exactly the same as Tinki3's


    Is it really necessary to remove it?

    As far as i know, as i have just looked at Tinki3's, his is done in GUI and more then likely not MUI.Also these are spells that i believe people might find helpful and/or useful for their maps or just to learn JASS. I have purposely set out these skills to give great configurability and readability to those people who might need it, therefore i think it is unnecessary to remove it. After all, arn't there like 5 Omnislashes on this site? I was going to put mine up for people as well, but i realised the excessive amounts on this site, so i refrained from doing so.

    Anyways, thanks for the comment..
     
  13. GoGo-Boy

    GoGo-Boy You can change this now in User CP

    Ratings:
    +40 / 0 / -0
    Agree there, why to remove it? MUI, MPI and optimized... he could give a reference to Tinki3, though it seems like he didn't know about his. But removing it is a bit harsh, since you can't deny it's usefulness.
     
  14. Sim

    Sim Forum Administrator Staff Member

    Ratings:
    +531 / 0 / -0
    > After all, arn't there like 5 Omnislashes on this site?

    The 5 omnislashes have something different between them, or at least I believe.

    Anyways, 2 exact same spells shouldn't be featured into the section, especially considering the fact this spellpack isn't following any specific them and therefore the spell isn't really needed.

    > since you can't deny it's usefulness.

    It is useful, but we already have such a spell in the section.

    But... as the spell is in JASS and is coded completely different as Tinki3's, leave it in the spellpack for configurability purposes.

    In fact, approved. :)
     
  15. Kenny

    Kenny Back for now.

    Ratings:
    +202 / 0 / -0
    Updated!

    - Elemental Helix is now 100% MUI, as it can now freeze an already frozen unit. Downside is that it is a little harder to import.
    - Various changes to do with cleaning and fixing some stuff :)
    - Fixed up my use of groups - better use, cleaning etc.
    - Also fixed the CSSafety library in the map to compile with jasshelper.

    All feedback is welcome and appreciated.
     
  16. Kenny

    Kenny Back for now.

    Ratings:
    +202 / 0 / -0
    Updated again!

    - Minor script changes to all spells, but nothing drastic.
    - Elemental Helix has been tweeked a bit, now has a percent change to deal more damagein an area of effect.
    - Elemental Helix now freezes units in the end area of effect properly, as it did not really freeze them before.
    - Bit of other stuff, cleaning etc...

    Yeah, as usual, feedback is appreciated, I'd like to know how to improve...

    Test these out ingame, as the movment for Helix is pretty cool and the firewall is also unique :).
     
  17. Anti-krazy

    Anti-krazy New Member

    Ratings:
    +5 / 0 / -0
    Lol can anyone make the firewall GUI trigger?
     
  18. Cohadar

    Cohadar master of fugue

    Ratings:
    +209 / 0 / -0
    This spell has a bug:
    JASS:
    
            call SetUnitScale(d.flame,Scale,Scale,0.00)
            call DestroyEffect(AddSpecialEffect(Begin_effect,d.flamex,d.flamey))
            call DamageArea(d.caster,d.flamex,d.flamey,DamageAoE(d.level),BeginDamage(d.level))
            call KillTrees(d.flamex,d.flamey,Trees_range)
            call UnitApplyTimedLife(d.flame,'BTLF',Duration(d.level))
            call SetUnitAbilityLevel(d.flame,Abil2_id,d.level)
            call PauseUnit(d.flame,true)
            call PauseUnit(d.flame,false)


    should be:
    JASS:
    
            call SetUnitScale(d.flame,Scale,Scale,0.00)
            call DestroyEffect(AddSpecialEffect(Begin_effect,d.flamex,d.flamey))
            call DamageArea(d.caster,d.flamex,d.flamey,DamageAoE(d.level),BeginDamage(d.level))
            call KillTrees(d.flamex,d.flamey,Trees_range)
            call UnitApplyTimedLife(d.flame,'BTLF',Duration(d.level))
            call SetUnitAbilityLevel(d.flame,Abil2_id,d.level)
            //---- this fixes a bug with leveling a perma immolation
            call SetPlayerAbilityAvailable(GetOwningPlayer(caster), Abil2_id, false)
            call SetPlayerAbilityAvailable(GetOwningPlayer(caster), Abil2_id, true)
            call PauseUnit(d.flame,true)
            call PauseUnit(d.flame,false)


    Another spell with this problem. <-------<<
     
  19. waaaks!

    waaaks! Zinctified

    Ratings:
    +256 / 0 / -0
    can u update the spellpack? change cssafety to timerutils?
     
  20. Blackrage

    Blackrage Ultra Cool Member

    Ratings:
    +25 / 0 / -0
    I think the Elemental Helix is already made =/
     

Share This Page