Spell Tornado

Tom Jones

N/A
Reaction score
437
btntornadovf2.jpg


Tornado.
Code: vJass.
JASS:
//#######################################################################################################
//#Tornado - By Tom Jones.
//#######################################################################################################
//#Requirements:
//#1) vJass.
//#2) Alternatively SAS.
//#
//#Implementation:
//#1) Copy/paste this trigger from this map to your map.
//#2) Copy/paste the SsaS trigger from this map to your map. Alternatively you could change the calls to
//#   SsaS with your prefered struct passing system.
//#3) Copy/paste the relevant abilities, units, and buffs from this map to your map. Alternatively you
//#   could create new abilities, units or buffs, or you could use existing ones.
//#4) Modifiy the variables in the Options section below. Variables expecting raw data is important, so
//#   make sure the values match those from you map. You can view your map's raw data by pressing ctrl+d
//#   in the object editor.
//#######################################################################################################

//#######################################################################################################
//#Options.
//#######################################################################################################
scope Tornado
globals 
    private integer SPELL_ID            = 'A000' //Raw data for the base ability.
    private string  VFX_TARGET_HIT      = "Abilities\\Spells\\Other\\Tornado\\Tornado_Target.mdl"
    private string  VFX_HIT_GROUND      = "Abilities\\Spells\\Other\\Volcano\\VolcanoDeath.mdl"
    private integer DUMMY_SPELL_ID      = 'A001' //Raw data for the dummy ability.
    private string  DUMMY_SPELL_ORDER   = "slow" //Orderstring for the dummy ability.
    private integer MISSILE_UNIT_ID     = 'u001' //Raw data for the missile unit.
    private integer DUMMY_UNIT_ID       = 'u000' //Raw data for the dummy unit.
    private real    MISSILE_SPEED       = 600.   
    private real    MISSILE_MAX_RANGE   = 1111.
    private real    ROTATION_SPEED      = 1000.  //Effects the speed of both the rotation and the toss.
    private real    ROTATION_MAX_Z      = 400.   //Determines how high a unit will rotate before getting tossed.
    private real    ROTATION_ARC        = 0.25   //Arc of the toss.
endglobals

//#######################################################################################################
//#Triggercode - Do not modify below here unless you know what you are doing.
//#######################################################################################################
//! runtextmacro SAS_Instance()
globals
    private real INTERVAL = 0.01
endglobals

private struct victimdata
    unit v
    real dist
    real angle
    real x
    real y
    real z 
    real multiplier
    effect vfx
    boolean rotate
    integer next
    integer prev
    
    method onDestroy takes nothing returns nothing
        set .dist = 0
        set .z = 0
        set victimdata(.next).prev = .prev
        set victimdata(.prev).next = .next
        set .next = 0
        set .prev = 0
        call DestroyEffect(.vfx)
    endmethod
endstruct

private struct data
    unit u
    unit d
    player p
    victimdata first
    real angle
    real dist
    real x
    real y
    trigger trig
    timer t
    
    static method KillDestructable takes nothing returns nothing
        call KillDestructable(GetEnumDestructable())
    endmethod
    
    static method onTick takes nothing returns nothing
        local data this = GetFrom(GetExpiredTimer())
        local victimdata enum = .first
        local rect rectangle
        local unit d
        
        if .dist >= MISSILE_MAX_RANGE then
            if IsUnitType(.d,UNIT_TYPE_DEAD) == true then
                if .first == 0 then
                    call this.destroy()
                    return
                endif
            else
                call KillUnit(.d)
                call DestroyTrigger(.trig)
            endif
        else
            set .dist = .dist+(MISSILE_SPEED*INTERVAL)
            set .x = .x+(MISSILE_SPEED*INTERVAL)*Cos(.angle)
            set .y = .y+(MISSILE_SPEED*INTERVAL)*Sin(.angle)
            call SetUnitPosition(.d,.x,.y)
        endif
        loop
            exitwhen enum == 0
            if enum.rotate == true then
                set enum.angle = enum.angle+(bj_DEGTORAD*(ROTATION_SPEED*(INTERVAL)))
                set enum.dist = enum.dist+(ROTATION_SPEED*(INTERVAL*0.1))
                set enum.x = .x+enum.dist*Cos(enum.angle)
                set enum.y = .y+enum.dist*Sin(enum.angle)
                set enum.z = enum.z+(ROTATION_SPEED*(INTERVAL*0.5))
                call SetUnitFacing(enum.v,GetUnitFacing(enum.v)+150)
                if enum.z >= ROTATION_MAX_Z or (.x-100 <= GetCameraBoundMinX() or .x+100 >= GetCameraBoundMaxX() or .y-100 <= GetCameraBoundMinY()  or .y+100 >= GetCameraBoundMaxY()) then
                    set enum.rotate = false
                    set enum.multiplier = ROTATION_SPEED*INTERVAL
                    set enum.multiplier = (-(enum.multiplier)-SquareRoot(((enum.multiplier*enum.multiplier)-4*(-ROTATION_ARC)*ROTATION_MAX_Z)))/(2*-ROTATION_ARC)
                    if enum.multiplier <= 0 then
                        set enum.multiplier = ROTATION_SPEED*INTERVAL
                        set enum.multiplier = (-(enum.multiplier)+SquareRoot(((enum.multiplier*enum.multiplier)-4*(-ROTATION_ARC)*ROTATION_MAX_Z)))/(2*-ROTATION_ARC)
                    endif
                    set enum.angle = Atan2(.y-enum.y,.x-enum.x)
                    set enum.dist = 0
                endif
            else
                set enum.dist = enum.dist+(enum.multiplier*INTERVAL*2)
                set enum.x = enum.x+(ROTATION_SPEED*INTERVAL*1.5)*Cos(enum.angle)
                set enum.y = enum.y+(ROTATION_SPEED*INTERVAL*1.5)*Sin(enum.angle)
                set enum.z = ((-ROTATION_ARC)*(enum.dist*enum.dist))+((ROTATION_SPEED*(INTERVAL))*enum.dist)+ROTATION_MAX_Z
                if enum.z <= 0. then
                    if enum == .first then
                        set .first = .first.next
                    endif
                    set rectangle = Rect(enum.x-200,enum.y-200,enum.x+200,enum.y+200)
                    call EnumDestructablesInRect(rectangle,null,function data.KillDestructable)
                    call PauseUnit(enum.v,false)
                    call SetUnitPathing(enum.v,true)
                    if IsUnitType(enum.v,UNIT_TYPE_HERO) == true then
                        if GetLocalPlayer() == GetOwningPlayer(enum.v) then
                            call SelectUnit(enum.v,true)
                        endif
                    endif
                    set d = CreateUnit(.p,DUMMY_UNIT_ID,enum.x,enum.y,0)
                    call UnitAddAbility(d,DUMMY_SPELL_ID)
                    call SetUnitAbilityLevel(d,DUMMY_SPELL_ID,GetUnitAbilityLevel(.u,SPELL_ID))
                    call IssueTargetOrder(d,DUMMY_SPELL_ORDER,enum.v)
                    call UnitApplyTimedLife(d,'BTLF',1.5)
                    call DestroyEffect(AddSpecialEffect(VFX_HIT_GROUND,enum.x,enum.y))
                    call enum.destroy()
                    call RemoveRect(rectangle)
                    set rectangle = null
                    set d = null
                endif
            endif
            call SetUnitPosition(enum.v,enum.x,enum.y)
            call SetUnitFlyHeight(enum.v,enum.z,0)
            set enum = enum.next
        endloop
    endmethod
        
    static method onHit takes nothing returns boolean
        local data this = GetFrom(GetTriggeringTrigger())
        local unit v = GetTriggerUnit()
        local victimdata enum = .first
        
        loop
            exitwhen enum == 0 or enum.v == v
            set enum = enum.next
        endloop
        if IsUnitEnemy(v,.p) == true and enum == 0 then
            set enum = victimdata.create()
            set enum.rotate = true
            set enum.v = GetTriggerUnit()
            set enum.vfx = AddSpecialEffectTarget(VFX_TARGET_HIT,enum.v,"origin")
            call UnitAddAbility(enum.v,'Amrf')
            call UnitRemoveAbility(enum.v,'Amrf')
            call PauseUnit(enum.v,true)
            call SetUnitPathing(enum.v,false)
            if .first == 0 then
                set .first = enum
            else
                set .first.prev = enum
                set enum.next = .first
                set .first = enum
            endif
        endif
        set v = null
        return false
    endmethod
    
    static method onCast_Conditions takes nothing returns boolean
        return GetSpellAbilityId() == SPELL_ID
    endmethod
    static method onCast takes nothing returns nothing
        local data this = data.allocate()
        local location loc = GetSpellTargetLoc()
   
        set .u = GetTriggerUnit()
        set .p = GetOwningPlayer(.u)
        set .x = GetUnitX(.u)
        set .y = GetUnitY(.u)
        set .angle = Atan2(GetLocationY(loc)-.y,GetLocationX(loc)-.x)
        set .d = CreateUnit(.p,MISSILE_UNIT_ID,.x,.y,0)
        set .trig = CreateTrigger()
        call AttachTo(.trig,this)
        call TriggerRegisterUnitInRange(.trig,.d,100,null)
        call TriggerAddCondition(.trig,Condition(function data.onHit))
        if .t == null then
            set .t = CreateTimer()
        endif
        call AttachTo(.t,this)
        call TimerStart(.t,INTERVAL,true,function data.onTick)
        call RemoveLocation(loc)
        set loc = null
    endmethod
    
    method onDestroy takes nothing returns nothing
        set .dist = 0
        set .first = 0
        call RemoveUnit(.d)
        call PauseTimer(.t)
    endmethod
    static method onInit takes nothing returns nothing
        local unit u = CreateUnit(Player(15),MISSILE_UNIT_ID,0,0,0)
        
        call UnitAddAbility(u,SPELL_ID)
        call UnitAddAbility(u,DUMMY_SPELL_ID)
        call RemoveUnit(CreateUnit(Player(15),DUMMY_UNIT_ID,0,0,0))
        call RemoveUnit(u)
        set u = null
    endmethod
endstruct

//#######################################################################################################
//#Initialization.
//#######################################################################################################
function InitTrig_Tornado takes nothing returns nothing
    set gg_trg_Tornado = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Tornado,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_Tornado,Condition(function data.onCast_Conditions))
    call TriggerAddAction(gg_trg_Tornado, function data.onCast)
endfunction
endscope
MUI: Yep.
Leakless: Yep.
Target: Point.

Description:
Sends forth a tornado that slows units' movespeed and attackspeed.

Level 1 - Slows attackspeed by 10% and movespeed by 30%.
Level 2 - Slows attackspeed by 15% and movespeed by 40%.
Level 3 - Slows attackspeed by 20% and movespeed by 50%.
Level 4 - Slows attackspeed by 25% and movespeed by 60%.

tornadoscreenie2bo7.jpg


Please report any bugs or script errors.
 

Attachments

  • Tornado.w3x
    46.4 KB · Views: 324

ayumilove

Youtube account suspended! youtube.com/ayumilove8
Reaction score
110
Lol <3

very nice tornado

you know what i did when i cast the tornado?

i made the bad guys flew out from the map (out of the map boundary) <3

and the bad guys can't be seen again XD

i like this tornado compare to the tree, more unique ^^
 

Tom Jones

N/A
Reaction score
437
You flew the bad guys out of bound, or just up on a cliff?
I made it pretty impossible to get tossed out of bound, but I'll have a look.
i like this tornado compare to the tree, more unique ^^
This was only a brainstorming idea, I didn't make it before today.
 

elmstfreddie

The Finglonger
Reaction score
203
Can you make an ability where someone drags something (like there's a chain and if it's tight it follows, if you turn towards it it won't move until the chain is tight again etc) I dunno why, but would be cool lol
 

ayumilove

Youtube account suspended! youtube.com/ayumilove8
Reaction score
110
You flew the bad guys out of bound, or just up on a cliff?
I made it pretty impossible to get tossed out of bound, but I'll have a look.
This was only a brainstorming idea, I didn't make before today.

its tossed out of the map, you know how i know it, check from the replay or you could either follow and see your tornado, the tornado is your unit which enables you to see right? when the tornado move, you are able to see what the tornado sees
 

Cilla

is watching you! Ahh, fresh meat!
Reaction score
39
This looks awesom. Ill make use of it in my map. Rep ;)
 

Chocobo

White-Flower
Reaction score
409
Why does camera shaker create server splits?

It depends on what you want exactly as a shaker. If you are using First Person Camera, you should be able just by detecting the unit. If you are using Third Person Camera, the constant natives aren't able to handle an argument for which player, they only return a location or a real, which will be returned differently on each player, and desync all then.
 

waaaks!

Zinctified
Reaction score
256
this spell is a good example of wave kind of spells, just like frost wave, that slows all the units in its path........
 

SFilip

Gone but not forgotten
Reaction score
634
Very nice, I really like the spinning effect. :)
Approved.
 

neckface

terrain contest winner! :) dance contest loser. :(
Reaction score
34
This is a really fun spell and an original idea!

My only issue with it is that you gain vision of the Tornado, and it travels on a relatively long path... this can be exploited to cheesily explore hidden areas. :p
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top