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: 473
  • Lasso 1.00.w3x
    205 KB · Views: 741

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.
  • 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