Spell Temporal Vortex

WolfieeifloW

WEHZ Helper
Reaction score
372
Temporal Vortex
Created By: Wolfie[NoCT]

Version:
2.0

If something needs to be added for these to be approved, please tell me mods.


Credits:
Spell editing, idea, and triggers were created by Wolfie[NoCT].


If you take the time to download / look at these, please at least leave a comment.
Don't forget to rate also (using the stars
rating_5.gif
) !

temporalvortexk.jpg

Screenshots serve no justice, try the spell out ingame.


Features:
  • An Offense and Defense mode
  • Leakless
  • Lagless
  • MUI



Spell Description
Learn Temporal Vortex said:
Defense: Attackers have a chance to teleport away from this Hero. Teleported units cannot be affected by the vortex again for a certain time.
Level 1 - 6% chance, 300 units away, 4 second debuff.
Level 2 - 12% chance, 450 units away, 3 second debuff.
Level 3 - 18% chance, 600 units away, 2 second debuff.

Offense: Every 2.5 seconds, units are randomly chosen in an AoE around the Hero. These chosen units are pulled into the Hero.
Level 1 - 11% chance, pulls up to 1 unit, 500AoE.
Level 2 - 18% chance, pulls up to 2 units, 600AoE.
Level 3 - 25% chance, pulls up to 3 units, 700AoE.



Spell Code
JASS:
// +------------------------------------------------------------+
// |                                                            |
// |             -=-=- Temporal Vortex [v2.0] -=-=-             |
// |                -=-=- By Wolfie[NoCT] -=-=-                 |
// |                    Requires Jass NewGen                    |
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   Temporal Vortex (Defense):                               |
// |   Attackers have a chance to teleport away from this       |
// |      Hero. Teleported units cannot be affected by the      |
// |         vortex again for a certain time.                   |
// |                                                            |
// |   Temporal Vortex (Offense):                               |
// |   Every 2.5 seconds, units are randomly chosen in an       |
// |      AoE around the Hero. These chosen units are pulled    |
// |         into the Hero.                                     |
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   -=-=- How To Implement -=-=-                             |
// |      1. Copy this trigger into your map                    |
// |      2. Copy the buffs into your map                       |
// |      3. Copy the abilities into your map                   |
// |      4. Copy the dummies into your map                     |
// |      5. Make sure the 'Rawcodes' in the trigger match      |
// |            your buffs/abilities/units in Object Editor     |
// |      6. Customize the spell                                |
// |      7. Enjoy!                                             |
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   -=-=- Credits -=-=-                                      |
// |      Credits are not needed, but appreciated               |
// |         Just don't claim this as yours                     |
// |                                                            |
// +------------------------------------------------------------+
// |   -=-=- Version History -=-=-                              |
// |                                                            |
// |      Version 2.0                                           |
// |         - Major code revamp                                |
// |         - You now click the spell to change between        |
// |              the Defense/Offense modes                     |
// |         - Added map boundaries so units don't teleport     |
// |              outside the map (Thanks DrEvil)               |
// |                                                            |
// |      Older versions...                                     |
// |         Read changelog in thread                           |
// |                                                            |
// +------------------------------------------------------------+
scope TemporalVortex initializer Init

    globals
// +-------------------------------+
// |          MODIFY HERE          |
// |          MODIFY HERE          |
// |          MODIFY HERE          |
// +-------------------------------+
    // +--------------------------------+
    // |     Constant Configurables     |
    // +--------------------------------+
        private constant integer SPELLO = 'A000'
        //Rawcode of the "Temporal Vortex (Offense)" ability
        
        private constant integer SPELLD = 'A001'
        //Rawcode of the "Temporal Vortex (Defense)" ability
        
        private constant integer SPELLDEBUFF = 'A002'
        //Rawcode of the "Temporal Vortex Debuff" ability
        
        private constant integer DEFID = 'A003'
        //Rawcode of the "Temporal Vortex DBuff" ability
        
        private constant integer OFFID = 'A004'
        //Rawcode of the "Temporal Vortex OBuff" ability
        
        private constant integer DEBUFFID = 'B000'
        //Rawcode of the "Temporal Vortex" buff
        
        private constant integer DEFBUFF = 'B001'
        //Rawcode of the "Temporal Vortex (Defense)" buff
        
        private constant integer OFFBUFF = 'B002'
        //Rawcode of the "Temporal Vortex (Offense)" buff
        
        private constant integer DUMID = 'n000'
        //Rawcode of the "Dummy" unit
        
        private constant string ORDERONO = "replenishlifeon"
        //'Order String - Activate' of the Temporal Vortex (Offense) ability
        
        private constant string ORDEROND = "replenishmanaon"
        //'Order String - Activate' of the Temporal Vortex (Defense) ability
        
        private constant string ORDEROFFO = "replenishlifeoff"
        //'Order String - Deactivate' of the Temporal Vortex (Offense) ability
        
        private constant string ORDEROFFD = "replenishmanaoff"
        //'Order String - Deactivate' of the Temporal Vortex (Defense) ability
        
        private constant string BUFFORDER = "innerfire"
        //'Order String - Use/Turn On' of the Temporal Vortex (D/O)Buff abilities
        
        private constant string DEBUFFORDER = "slow"
        //'Order String - Use/Turn On' of the Temporal Vortex Debuff ability
        
        private constant real INTERVAL = 2.5
        //Time between each pull for Temporal Vortex Offense
        
        private constant string SFXOFF = "Abilities\\Spells\\Undead\\VampiricAura\\VampiricAuraTarget.mdl"
        //Path of the SFX used when you change to Temporal Vortex (Offense)
        
        private constant string SFXDEF = "Abilities\\Spells\\Undead\\ReplenishMana\\SpiritTouchTarget.mdl"
        //Path of the SFX used when you change to Temporal Vortex (Defense)
        
        private constant string SFXATTACH = "overhead"
        //Attachment point for the above SFX
        
        private constant string SFXSTART = "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl"
        //Path of the SFX used when the target starts to teleport
        
        private constant string SFXEND = "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl"
        //Path of the SFX used then target lands at teleported location
        
        //Advanced setting:
        private constant real ANGLE = 90.
        //The angle at which units teleport away
    endglobals
    
    // +--------------------------------+
    // |     Function Configurables     |
    // +--------------------------------+    
    private function DEFCHANCE takes integer level returns real
        return level * 6.
        //The chance for Temporal Vortex (Defense) to go off
    endfunction
    
    private function DEFDIST takes integer level returns real
        return (level * 150) + 150.
        //The distance units teleport away
    endfunction
    
    private function OFFCHANCE takes integer level returns real
        return (level * 7) + 4.
        //The chance for Temporal Vortex (Offense) to go off
    endfunction
    
    private function OFFDIST takes integer level returns real
        return (level + 100) + 400.
        //The distance units can get pulled from
    endfunction
    
    private function OFFNUM takes integer level returns integer
        return level * 1
        //The number of units to pull
    endfunction
    
// +----------------------------------------+
// |          NO TOUCHIE PAST HERE          |
// |          NO TOUCHIE PAST HERE          |
// |          NO TOUCHIE PAST HERE          |
// +----------------------------------------+
    globals
        private group OFF = CreateGroup()
        private group DEF = CreateGroup()
        private group OFFB = CreateGroup()
        private group PULL = CreateGroup()
        private group PULLB = CreateGroup()
        private integer OLDLVL = 0
        private unit DUMMY
        private player DEFP
        
        private real MAP_MIN_X 
        private real MAP_MAX_X 
        private real MAP_MIN_Y 
        private real MAP_MAX_Y 
    endglobals
    
    private function InMapX takes real x returns boolean
        return x > MAP_MIN_X and x < MAP_MAX_X 
    endfunction
    
    private function InMapY takes real y returns boolean
        return y > MAP_MIN_Y and y < MAP_MAX_Y 
    endfunction
    
    private function SetInX takes real x returns real
        if (x > MAP_MAX_X) then
            set x = MAP_MAX_X
        elseif (x < MAP_MIN_X) then
            set x = MAP_MIN_X
        endif
        return x
    endfunction
    
    private function SetInY takes real y returns real
        if (y > MAP_MAX_Y) then
            set y = MAP_MAX_Y
        elseif (y < MAP_MIN_Y) then
            set y = MAP_MIN_Y
        endif
        return y
    endfunction
    
    private function ActionsMethod takes unit whichUnit, integer dumAbil, group whatGroup returns nothing
        set DUMMY = CreateUnit(GetOwningPlayer(whichUnit), DUMID, GetUnitX(whichUnit), GetUnitY(whichUnit), bj_UNIT_FACING)
        call UnitAddAbility(DUMMY, dumAbil)
        call IssueTargetOrder(DUMMY, BUFFORDER, whichUnit)
        call UnitApplyTimedLife(DUMMY, 'BTLF', 1.)
        call GroupAddUnit(whatGroup, whichUnit)
    endfunction
    
    private function ChangeMethod takes unit whichUnit, integer oldSpell, integer newSpell, group oldGroup, group newGroup, integer dumAbil, string whichOrder, string whichSFX returns nothing
        set OLDLVL = GetUnitAbilityLevel(whichUnit, oldSpell)
        call UnitRemoveAbility(whichUnit, oldSpell)
        call UnitAddAbility(whichUnit, newSpell)
        call SetUnitAbilityLevel(whichUnit, newSpell, OLDLVL)
        if (IsUnitInGroup(whichUnit, oldGroup)) then
            call ActionsMethod(whichUnit, dumAbil, null)
            call GroupAddUnit(newGroup, whichUnit)
            call IssueImmediateOrder(whichUnit, whichOrder)
        endif
        call GroupRemoveUnit(oldGroup, whichUnit)
        call DestroyEffect(AddSpecialEffectTarget(whichSFX, whichUnit, SFXATTACH))
    endfunction
    
//====================================================================================================        
    private function Actions takes nothing returns boolean
        if (GetIssuedOrderId() == OrderId(ORDERONO)) then
            call ActionsMethod(GetTriggerUnit(), OFFID, OFF)
        elseif (GetIssuedOrderId() == OrderId(ORDEROND)) then
            call ActionsMethod(GetTriggerUnit(), DEFID, DEF)
        elseif (GetIssuedOrderId() == OrderId(ORDEROFFO)) then
            call UnitRemoveAbility(GetTriggerUnit(), OFFBUFF)
            call GroupRemoveUnit(OFF, GetTriggerUnit())
        elseif (GetIssuedOrderId() == OrderId(ORDEROFFD)) then
            call UnitRemoveAbility(GetTriggerUnit(), DEFBUFF)
            call GroupRemoveUnit(DEF, GetTriggerUnit())
        endif
        return false
    endfunction        
        
    private function Change takes nothing returns boolean
        if (GetSpellAbilityId() == SPELLO) then
            call ChangeMethod(GetTriggerUnit(), SPELLO, SPELLD, OFF, DEF, DEFID, ORDEROND, SFXDEF)
        elseif (GetSpellAbilityId() == SPELLD) then
            call ChangeMethod(GetTriggerUnit(), SPELLD, SPELLO, DEF, OFF, OFFID, ORDERONO, SFXOFF)
        endif
        return false
    endfunction
        
    private function DefActions takes nothing returns boolean
        local unit tu = GetTriggerUnit()
        local unit au = GetAttacker()
        local integer QT = GetUnitAbilityLevel(tu, SPELLD)
        local real ax = GetUnitX(au)
        local real ay = GetUnitY(au)
        local real facing = GetUnitFacing(au)
        if (GetRandomInt(0, 100) <= DEFCHANCE(QT) and IsUnitInGroup(tu, DEF) and GetUnitAbilityLevel(au, DEBUFFID) <= 0) then
            call DestroyEffect(AddSpecialEffect(SFXSTART, ax, ay))
            set DUMMY = CreateUnit(GetOwningPlayer(tu), DUMID, ax, ay, bj_UNIT_FACING)
            call UnitAddAbility(DUMMY, SPELLDEBUFF)
            call SetUnitAbilityLevel(DUMMY, SPELLDEBUFF, QT)
            call IssueTargetOrder(DUMMY, DEBUFFORDER, au)
            call UnitApplyTimedLife(DUMMY, 'BTLF', 1.)
            set facing = GetRandomReal(facing - ANGLE, facing + ANGLE)
            set ax = ax + DEFDIST(QT) * Cos(facing)
            set ay = ay + DEFDIST(QT) * Sin(facing)
            if (not InMapX(ax)) then
                set ax = SetInX(ax)
            endif
            if (not InMapY(ay)) then
                set ay = SetInY(ay)
            endif
            call SetUnitX(au, ax)
            call SetUnitY(au, ay)
            call DestroyEffect(AddSpecialEffect(SFXEND, ax, ay))
        endif
        set au = null
        set tu = null
        return false        
    endfunction
    
    private function CondGroup takes nothing returns boolean
        return IsUnitEnemy(GetFilterUnit(), DEFP) and IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false
    endfunction
    
    private function OffActions takes nothing returns nothing
        local unit fog
        local unit fogg
        local real fx
        local real fy
        local integer QT = 0
        
        if (CountUnitsInGroup(OFF) >= 1) then
        loop
        set fog = FirstOfGroup(OFF)
        set QT = GetUnitAbilityLevel(fog, SPELLO)
            if (GetRandomInt(0, 100) <= OFFCHANCE(QT)) then
                exitwhen fog == null
                    set DEFP = GetOwningPlayer(fog)
                    call GroupEnumUnitsInRange(PULL, GetUnitX(fog), GetUnitY(fog), OFFDIST(QT), Condition(function CondGroup))
                    set PULLB = GetRandomSubGroup(OFFNUM(QT), PULL)
                    loop
                    set fogg = FirstOfGroup(PULLB)
                    exitwhen fogg == null
                        set fx = GetUnitX(fogg)
                        set fy = GetUnitY(fogg)
                        call DestroyEffect(AddSpecialEffect(SFXSTART, fx, fy))
                        call SetUnitX(fogg, GetUnitX(fog))
                        call SetUnitY(fogg, GetUnitY(fog))
                        call DestroyEffect(AddSpecialEffect(SFXEND, fx, fy))
                        call GroupRemoveUnit(PULLB, fogg)
                    endloop
                    call GroupRemoveUnit(OFF, fog)
                    call GroupAddUnit(OFFB, fog)
            endif
        endloop
        loop
        set fog = FirstOfGroup(OFFB)
        exitwhen fog == null
            call GroupRemoveUnit(OFFB, fog)
            call GroupAddUnit(OFF, fog)
        endloop
        endif
    endfunction
        
//====================================================================================================
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        set MAP_MIN_X = GetRectMinX(bj_mapInitialPlayableArea) + 40
        set MAP_MAX_X = GetRectMaxX(bj_mapInitialPlayableArea) - 40
        set MAP_MIN_Y = GetRectMinY(bj_mapInitialPlayableArea) + 40 
        set MAP_MAX_Y = GetRectMaxY(bj_mapInitialPlayableArea) - 40
            
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_ORDER)
        call TriggerAddCondition(t, Condition(function Actions))
        
        set t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t, Condition(function Change))
        
        set t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ATTACKED)
        call TriggerAddCondition(t, Condition(function DefActions))
        
        set t = CreateTrigger()
        call TimerStart(CreateTimer(), INTERVAL, true, function OffActions)
    endfunction

endscope


Test map included.
Constructive criticism is welcomed, flaming is not.
This spell will only be submitted to TH.net.
Do not redistribute or modify without permission.

Hope you enjoy it!​

Changelog
v2.0
- Major code revamp
- You now click the spell to change between the Defense/Offense modes
- Added map boundaries so units don't teleport outside the map (Thanks DrEvil)


v1.7b
- Fixed SFX leak

v1.7
- Code touchup
- Fixed a minor bug

v1.6b
- Fixed loop pickedUnit setting
Credits to kenny!

v1.6
- Code layout touchup

v1.5b
- Code touchup
Replaced a location with X/Y

v1.5
- Major code revamp
Certain configs (can) use formulas now
Credits to Flare

v1.4c
- Code cleanup
Credits to Flare
- Fixed map description
- Fixed tooltip not showing level 4 for Offense
- Fixed code not showing description for Offense

v1.4b
- Fixed bug with hero stopping instead of holding
- Fixed spells to make them uncastable

v1.4
- Fixed up code more
- Added new subskill
Temporal Vortex (Offense)

v1.3
- Fixed up code
Credits to 'TriggerHappy

v1.2
- Fixed research icon
- Added configurable loop wait time
- Added more units to test map
They do less damage now too.

v1.1
- Added a 'learn' hotkey
- Added an SFX for when spell is active

v1.0
- Initial release
 

Attachments

  • opt-Temporal_Vortex_v14b.w3x
    25.7 KB · Views: 280
  • opt-Temporal_Vortex_v14c.w3x
    25.4 KB · Views: 298
  • opt-Temporal_Vortex_v15.w3x
    25.3 KB · Views: 310
  • opt-Temporal_Vortex_v15b.w3x
    25.3 KB · Views: 289
  • opt-Temporal_Vortex_v16.w3x
    25.2 KB · Views: 288
  • opt-Temporal_Vortex_v16b.w3x
    25.3 KB · Views: 286
  • opt-Temporal_Vortex_v17.w3x
    25.2 KB · Views: 281
  • opt-Temporal_Vortex_v17b.w3x
    24.9 KB · Views: 277
  • opt-Temporal_Vortex_v20.w3x
    22.1 KB · Views: 357

BlackRose

Forum User
Reaction score
239
More ideas? Hopefully they will be more eye-candy, infact, I don't care what spells do, as long as they look fancy :p

Your spell, Temporal Vortex, is just like a evasion, you turn it on, enemy units teleport away. Couldn't this spell also be made in GUI?

I found the code hard to look at, maybe it was because it was all in black writing (Normal WE), or I'm just dumb :p

Maybe add some comments to describe each function?

After all that, I will +REP you.

EDIT: .... my post was a bit late?
 

WolfieeifloW

WEHZ Helper
Reaction score
372
More ideas? Hopefully they will be more eye-candy, infact, I don't care what spells do, as long as they look fancy :p
Too much eye-candy is actually a bad thing, IMO.

Your spell, Temporal Vortex, is just like a evasion, you turn it on, enemy units teleport away. Couldn't this spell also be made in GUI?
It's like Evasion, yes.
And it has waits, so I don't think it can be easily made in GUI.

I found it hard to look at, maybe it was because it was all in black writing (Normal WE), or I'm just dumb :p
Probably because of normal WE ;) !

Maybe add some comments to describe each function?
The functions don't matter to users, everything is customizable at the top :) !

After all that, I will +REP you.
But I want my cookie now :( :p .
 

BlackRose

Forum User
Reaction score
239
I like non-laggy Eye-candy.

But I like to see how spells are made, I too am learning :p

How do you quote like that?

What cookie? Didn't I rep you?

---------------------------------

View my spell too :p
 

WolfieeifloW

WEHZ Helper
Reaction score
372
I like non-laggy Eye-candy.
That's a matter of opinion how much/how little SFX there should be.
I feel too much makes the spell feel like an ultimate.
The SFX are customizable to make them bigger/better SFX if you want :) .

But I like to see how spells are made, I too am learning :p
I'd suggest reading a tutorial then ;) .
Look into Ghan_04's tutorials, they're what helped me.

How do you quote like that?
Quote the users post, then copy this part:
[noparse]
[/noparse]
Before each part you want to quote.

What cookie? Didn't I rep you?
Ah yes, you did.
And what a fine cookie it was :p .

View my spell too :p
Looking it up now.
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
591
Depends on what you're planning to do.
Contact me when you get your next spell going.
 

BlackRose

Forum User
Reaction score
239
Suggestions:
- Make the test map bigger, with more attackers.
.......5 Mountain Kings don't help....

- That
- Added an SFX for when spell is active
isn't really noticable.
.......It's the Flak Cannons?

- Change the Research Icon.

Question:
- What's debuff?
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Suggestions:
- Make the test map bigger, with more attackers.
.......5 Mountain Kings don't help....
Test map size is fine;
I'll add more units though in v1.2.

- That
- Added an SFX for when spell is active
isn't really noticable.
.......It's the Flak Cannons?
It's quite noticeable ingame.
It's actually "GyroCopterImpact".

- Change the Research Icon.
Will be changed for v1.2.

Question:
- What's debuff?
The opposite of a buff.
It's a negative buff.



EDIT: UPDATE
Changelog
v1.2
- Fixed research icon
- Added configurable loop wait time
- Added more units to test map
They do less damage now too.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
I don't want to add more eye-candy as I don't want to make the spell look like an ultimate ;) !
And as I've said before, the SFX used are customizable;
So you can change them to a bigger/better SFX to achieve more eye-candy if so desired.
Oh, and thanks for the rating!

Any more comments/suggestions guys :) ?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top