Spell Lasso - The Real Dismember

emjlr3

Change can be a good thing
Reaction score
395
Lasso v1.00

lasso.jpg

Toss a magical rope around the target, grabbing it and holding it close.
.

Why Dismember sucks:
It has screwy casting distances, and neither the caster nor target can move during the spell.​

Why Lasso doesn't suck:
Both the caster and target can move while a unit is lassoed. The user can input a break distance at which point the lasso will snap, a minimum distance required for the lasso to illicit a pull effect, as well as an equation which allows completely unique pulling physics. In other words, this is what Dismember should have been.​

Spell Code
JASS:
scope Lasso initializer Init

private keyword data

globals
    // Configuration Options:
    private integer Abil_ID = 'A000' // Lasso ability rawcode
    private real Interval = .04 // Timer interval
    private real Height = 30. // Height of lightning
    private string Light = "LEAS" // Lightning effect created
    private string Sfx = "Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl" // Effect created when a untit is pulled
    
    // Needed Globals:
    public trigger Trig = null
    private timer T = CreateTimer()
    private location L1 = null
    private location L2 = null
    private integer I = 0
    private data array D
endglobals

// Configuration Functions:
private function MaxDur takes integer lvl returns real
    return 10. // Max duration for spell
endfunction
private function PullEq takes integer lvl, real dist returns real
    return dist/50. // Equation for the strength of the pull effect per timer interval
endfunction
private function SlackDist takes integer lvl returns real
    return 200. // Distance at which no pull effect is created (all distances under this value)
endfunction
private function BreakDist takes integer lvl returns real
    return 800. // Distance at which the lasso snaps
endfunction

//***** No Touching Past This Point *****\\
private struct data
    unit u = null
    unit targ = null
    integer lvl
    lightning lasso = null
    real time = 0.
    
    method onDestroy takes nothing returns nothing
        call DestroyLightning(.lasso)
    endmethod
endstruct

private function Update takes nothing returns nothing
    local data d 
    local integer i = 1
    local real dist
    local real ang
    
    loop
        exitwhen i>I
        set d = D<i>
        
        set dist = SquareRoot(Pow(GetUnitX(d.u) - GetUnitX(d.targ), 2) + Pow(GetUnitY(d.u)-GetUnitY(d.targ),2))
        if GetWidgetLife(d.u)&lt;.405 or GetWidgetLife(d.targ)&lt;.405 or d.time&gt;MaxDur(d.lvl) or dist&gt;BreakDist(d.lvl) then
            call d.destroy()
            set D<i> = D<i>
            set I = I - 1
            set i = i - 1
        else    
            if dist&gt;SlackDist(d.lvl) then
                set ang = Atan2(GetUnitY(d.targ) - GetUnitY(d.u), GetUnitX(d.targ) - GetUnitX(d.u))
                call SetUnitX(d.targ,GetUnitX(d.targ)-PullEq(d.lvl,dist)*Cos(ang))
                call SetUnitY(d.targ,GetUnitY(d.targ)-PullEq(d.lvl,dist)*Sin(ang))
                call DestroyEffect(AddSpecialEffectTarget(Sfx,d.targ,&quot;origin&quot;))
            endif
            set L1 = GetUnitLoc(d.u)
            set L2 = GetUnitLoc(d.targ)
            call MoveLightningEx(d.lasso,true,GetUnitX(d.u),GetUnitY(d.u),GetLocationZ(L1)+Height,GetUnitX(d.targ),GetUnitY(d.targ),GetLocationZ(L2)+Height)
            call RemoveLocation(L1)
            call RemoveLocation(L2)
    
            set d.time = d.time + Interval
        endif
        
        set i = i + 1
    endloop
    
    if I==0 then
        call PauseTimer(T)
    endif
endfunction
private function Conds takes nothing returns boolean
    return GetSpellAbilityId()==Abil_ID
endfunction
private function Acts takes nothing returns nothing
    local data d = data.create()
    
    set d.u = GetTriggerUnit()
    set d.targ = GetSpellTargetUnit()
    set d.lvl = GetUnitAbilityLevel(d.u,Abil_ID)
    set L1 = GetUnitLoc(d.u)
    set L2 = GetUnitLoc(d.targ)
    set d.lasso = AddLightningEx(Light,true,GetUnitX(d.u),GetUnitY(d.u),GetLocationZ(L1)+Height,GetUnitX(d.targ),GetUnitY(d.targ),GetLocationZ(L2)+Height)
    
    set I = I + 1
    set D<i> = d
    if I==1 then
        call TimerStart(T,Interval,true,function Update)
    endif
    
    call RemoveLocation(L1)
    call RemoveLocation(L2)
endfunction

private function Init takes nothing returns nothing
    set Trig = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(Trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(Trig,Condition(function Conds))
    call TriggerAddAction(Trig,function Acts)
endfunction

endscope</i></i></i></i>


Don't mind the other triggers in the map. All you need to look at is what is contained within the Spells folder, specifically the trigger Lasso.​

Enjoy and please comment!
 

Attachments

  • lasso.jpg
    lasso.jpg
    48.6 KB · Views: 459
  • Lasso 1.00.w3x
    205 KB · Views: 717

the_ideal

user title
Reaction score
61
Very nice. I don't know JASS, but looking at it in game, it's a great spell. Good job, +rep.
 

Fluffball

Well-Known Member
Reaction score
35
Blizz should rehire their spell team

and their modelling team for Hatebreeder
 

Darius34

New Member
Reaction score
30
Regarding the comparison with Dismember, why would you be able to move while being bitten and chowed down on? o_O

But nice job. It works very smoothly and everything.
 

Forty

New Member
Reaction score
6
omg i love you and hate you...

i love you because its awesome and well-coded.
but i hate you because i had the same idea just yesterday :/

+rep anyway

@aceheart:

the functions take a level argument, so your data can be more dynamic
 

quraji

zap
Reaction score
144
So people who use this and actually look at the code can base the values on spell level :thup:

I think AceHart was asking "Why not constants?" in light of the fact that at the moment the functions don't actually use the level :p
 

emjlr3

Change can be a good thing
Reaction score
395
its all up to the users discression

Regarding the comparison with Dismember, why would you be able to move while being bitten and chowed down on? o_O

But nice job. It works very smoothly and everything.

if that be the case, then why on earth are they connected by a rope?
 

Mike889

New Member
Reaction score
15
Aha, that's awesomee!!

Increadible! It is actually something I'm going to use on my map.
^^

You rules emjlr3!
It is cool to mix this spell with another one, like Banish for example. I changed the damage type to spell and the result is a ghost trying to run from your rope ^^ And then you can freely cast your channeling spells.
 

Nexor

...
Reaction score
74
I made a very simple first-try JASS spell using lightnings to link to your target and in a few days others make similar spells :S

between good job, I couldn't make something like this
 

Darius34

New Member
Reaction score
30
if that be the case, then why on earth are they connected by a rope?
Uh, really? I don't recall. Dismember is Aerial-Shackles-based, but it doesn't use the Aerial Shackles animation IIRC.
 

emjlr3

Change can be a good thing
Reaction score
395
perhaps I am mistaken then
 
Reaction score
456
> Why not global constants?
It's better if the spell writer leaves some constants to functions, so they can differ from level to level.
 

emjlr3

Change can be a good thing
Reaction score
395
no one seems to hate this or have any problems, so I'll move it
 

wellwish3r

wishes wells.
Reaction score
52
Dismember does not connect the two units with a rope, it just uses a blood animation, instead of the shackle animation :p
 

emjlr3

Change can be a good thing
Reaction score
395
um....this uses a struct stack, no attachment system needed
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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