Spell Regenerative Cyclone

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
Regenerative Cyclone

Description:
Your caster summons powerful winds to push her enemies away and heal nearby allies for 10+(40*Level of Ability) in a 450 range.

Uses:
Only Jass NewGen

Settings:

SPELL_ID (integer) = the spell id of the base spell used for the ability, this can be any ability you want as order strings do not matter and targets do not matter.

MOVE_TO_MAX (boolean) = if true this ability will push units to the max range, but not past. if false, this will push units the distance of the max range from their current point, resulting in a farther and longer push

IGNORE_UNIT_PATHING[/color] (boolean) = if true this ability's push will ignore pathing of units for the pushed targets

IGNORE_PATHING (boolean) = if true this overrides IGNORE_UNIT_PATHING because the pushed units will have pathing turned off until they complete the push

DURATION (real) = the duration of the push, if set to 0 the push will be instant or nearly instant

INTERVAL (real) = the interval at which units are moved for the push, currently 0.02 seconds for a smooth push

STUN (boolean) = if true the units will be pause for the duration of the push, best for unruly units who want to move the way opposite the stun

implimentation:
step 1: create a new spell
step 2: get spell id (check the view option view as raw data and find the spell, ID next to name)
step 3: create a trigger, convert to custom text in edit, and replace with below code
step 4: set [ljass]private constant integer SPELL_ID = '[Your Spell id replaces these brackets]'[/ljass]

Code:
JASS:
scope RejuvenationCyclone initializer OnInit
    
    globals
        private constant integer SPELL_ID = 'A000'
//this is the spell ID (under the view tab, check view raw data and find your spell to get this)

        private constant boolean MOVE_TO_MAX = false
//if true this will move units to max range and not past it

        private constant boolean IGNORE_UNIT_PATHING = true
//if true this push will ignore unit pathing

        private constant boolean IGNORE_PATHING = false
//if this is true the push will ignore pathing period

        private constant real DURATION = 0.5
//this is the max duration of  the push, when set to 0 it will be instant

        private constant real INTERVAL = 0.02
//CAN NOT BE 0.00, this is the interval at which the push is issued, frequency relates directly with smoothness and lag

        private constant boolean STUN = true
//set to false if you dont want the units to be stunned while pushed

        private timer RCLLTIMER = CreateTimer() //DO NOT CHANGE
    endglobals
    
    struct RCLL extends array
        unit pushTarget
        real changeX
        real changeY
        integer changeCount
        
        integer next
        integer previous
        
        static integer array recycleList
        static integer lastRecycled = 0
        static integer listSize = 0
        
        private static method Allocate takes nothing returns thistype
            local integer i = RCLL.recycleList[0]
            if (i == 0) then
                set RCLL.listSize = RCLL.listSize + 1
                return RCLL.listSize
            endif
            set RCLL.recycleList[0] = RCLL.recycleList<i>
            set RCLL.recycleList<i> = 0
            return i
        endmethod
        
        static method linkUnit takes unit u, real x, real y returns nothing
            local thistype this = thistype.Allocate()
            set this.pushTarget = u
            set this.changeX = x
            set this.changeY = y
            set this.changeCount = 0
            set this.next = 0
            set this.previous = thistype[0].previous
            set thistype[thistype[0].previous].next = this
            set thistype[0].previous = this
        endmethod
    
        static method removeLink takes integer i returns nothing
            set thistype[thistype<i>.previous].next = thistype<i>.next
            set thistype[thistype<i>.next].previous = thistype<i>.previous
            set thistype.recycleList[thistype.lastRecycled] = i
            set thistype.lastRecycled = i
            set thistype.recycleList<i> = 0
        endmethod
    endstruct

    private function Core takes nothing returns nothing
        local integer i = RCLL[0].next
        local location a
        local real x
        local real y
        loop
            if RCLL[0].next == 0 then
                call PauseTimer(RCLLTIMER)
            endif
            exitwhen i == 0
            if IGNORE_UNIT_PATHING == true then
                call SetUnitPathing(RCLL<i>.pushTarget, false)
            elseif IGNORE_PATHING == true then
                call SetUnitPathing(RCLL<i>.pushTarget, false)
            endif
            if STUN then
                call PauseUnit(RCLL<i>.pushTarget, true)
            endif
            set a = GetUnitLoc(RCLL<i>.pushTarget)
            set x = GetLocationX(a)
            set y = GetLocationY(a)
            call SetUnitX(RCLL<i>.pushTarget, RCLL<i>.changeX + x)
            call SetUnitY(RCLL<i>.pushTarget, RCLL<i>.changeY + y)
            if IGNORE_PATHING == false then
            if IGNORE_UNIT_PATHING == false then
                call SetUnitPathing(RCLL<i>.pushTarget, true)
            endif
            endif
            set RCLL<i>.changeCount = RCLL<i>.changeCount + 1
            if RCLL<i>.changeCount == R2I(DURATION / INTERVAL) then
                if IGNORE_PATHING or IGNORE_UNIT_PATHING then
                    call SetUnitPathing(RCLL<i>.pushTarget, true)
                endif
                if STUN then
                    call PauseUnit(RCLL<i>.pushTarget, false)
                endif
                call RCLL.removeLink(i)
            endif
            set a = null
            set i = RCLL<i>.next
        endloop
    endfunction
    
    private function GroupFilter takes nothing returns boolean
        local boolean bool
        set bool = not IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE)
        set bool = bool and not IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING)
        set bool = bool and not IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL)
        set bool = bool and not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)
        set bool = bool and not IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)
        return bool
    endfunction
    
    private function OnInitActions takes nothing returns boolean
        local real rx
        local real ry
        local group g = CreateGroup()
        local unit u
        local real x = GetUnitX(GetTriggerUnit())
        local real y = GetUnitY(GetTriggerUnit())
        local real bx
        local real by
        local real r
        if GetSpellAbilityId() == SPELL_ID then
             call GroupEnumUnitsInRange(g, x, y, 450, Filter(function GroupFilter))
             loop
                 set u = FirstOfGroup(g)
                 exitwhen (u == null)
                 if IsUnitEnemy(u,GetOwningPlayer(GetTriggerUnit())) then
                     set bx = GetUnitX(u)
                     set by = GetUnitY(u)
                         set r = bj_RADTODEG * Atan2(by - y, bx - x)
                     if (MOVE_TO_MAX == true) then
                         set rx = bx + 450 * Cos(r * bj_DEGTORAD)
                         set ry = by + 450 * Sin(r * bj_DEGTORAD)
                     elseif (MOVE_TO_MAX == false) then
                         set rx = x + 450 * Cos(r * bj_DEGTORAD)
                         set ry = y + 450 * Sin(r * bj_DEGTORAD)
                     endif
                     set rx = ((rx - x) /(DURATION / INTERVAL))
                     set ry = ((ry - y)/(DURATION / INTERVAL))
                     call RCLL.linkUnit(u, rx, ry)
                 elseif (IsPlayerAlly(GetOwningPlayer(GetTriggerUnit()), GetOwningPlayer(u)) == true) then
                     call SetUnitState(u, UNIT_STATE_LIFE, (GetUnitState(u, UNIT_STATE_LIFE) + 10.0 + (40.0 * GetUnitAbilityLevel(GetTriggerUnit(), SPELL_ID))))
                 endif
                 call GroupRemoveUnit(g, u)
             endloop
        call TimerStart(RCLLTIMER, INTERVAL, true, function Core)
        endif
        call DestroyGroup(g)
        set g = null
        set u = null
        return true
    endfunction
    
    private function OnInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t, Filter(function OnInitActions))
        set t = null
    endfunction
endscope</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>


Change Log and Soon to come
Change Log:
  • v1.00 - release - 12/3/2011

Soon to come:
  • Special Effects options
  • Healing function options
  • Damage Options
  • Propper Stun Option without glitch possiblities
 

Attachments

  • Regenerative Cyclone.w3x
    21.5 KB · Views: 379

luorax

Invasion in Duskwood
Reaction score
67
That filter should use comments ([ljass]/* */[/ljass]) instead of that local boolean.
 

Dirac

22710180
Reaction score
147
Not using existant libraries doesn't make the spell better, actually it makes it a lot worse
Remember that these libraries were written and revised by people who are experienced using vJass and their only purpose is to improve your code.
Haven't tested it yet, will when i have the time.
 

luorax

Invasion in Duskwood
Reaction score
67
All the functions should be merged into the struct, and by using the struct's initializer you could get rid of the library initializer. Also, indent the comments below the configurables.

This is a cool snippet.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top