Spell Bond ( tell me if you have a better name for this )

Viikuna

No Marlo no game.
Reaction score
265
Bond

New spell by me.

It is an AoE spell
Description: Links 3 to 5 units from target are together with a magical chain. Units linked like this, cannot go too far from eachother. If any of these Units dies, the link is broken, if not, the link will last up to 15 seconds.

It uses TimerUtils ( made by Vexorian )
here is the code:
JASS:
scope Bond initializer init

globals
     // spells Ability ID
     private constant integer ABILITY_ID = 'A000'
    // timer period, the smaller period, the smoother movement + greater lagg
     private constant real TIMER_PERIOD = 0.025
     // number of targets is calculated like this: MAX_TARGETS_LEVEL * AbilityLevel + MAX_TARGETS_BASE
     private constant integer MAX_TARGETS_BASE = 5
     private constant integer MAX_TARGETS_LEVEL = 0
     // Maximum number of targets in last spell level level, this is kinda important, because I use iot to set up array members
     // note that minimum number of targets is allways 3
     private constant integer MAX_TARGETS_MAX = 5
     // Spell AoE
     private constant real RADIUS_LEVEL = 150
     private constant real RADIUS_BASE = 20
     // spell Duration
     private constant real DURATION_BASE = 15.0 / TIMER_PERIOD
     private constant real DURATION_LEVEL = 0.0 / TIMER_PERIOD
     // effect path for that nice buff effect
      private constant string EFFECT_PATH = "Abilities\\Spells\\Orc\\StasisTrap\\StasisTotemTarget.mdl"
      private constant string ATTACH_PATH = "origin"
      private constant string LIGHTNING_CODE = "SPLK"
      // the length of magical chain
      private constant real LENGTH = 2000.0
endglobals
// here is the filter
private function Filtterinpaska takes nothing returns boolean
    return GetWidgetLife(GetFilterUnit()) > 0.0451 and GetUnitFlyHeight(GetFilterUnit()) == 0 and IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false
endfunction

globals
     private filterfunc True 
     private filterfunc F
     private integer TempI = 0
     private group TempG = CreateGroup()
endglobals

private struct Data
     unit array u[MAX_TARGETS_MAX]
     real array x[MAX_TARGETS_MAX]
     real array y[MAX_TARGETS_MAX]
     real array oldx[MAX_TARGETS_MAX]
     real array oldy[MAX_TARGETS_MAX]
     effect array e[MAX_TARGETS_MAX]
     lightning array l[MAX_TARGETS_MAX]
     integer count = 0
     integer duration
     integer iL = 0
     integer iU = 0
     timer t
     
     method lightningStart takes real dur returns nothing
         local integer i = this.iU
         local real x
         local real y
         local real x2
         local real y2
         local boolean b = false
         set this.iL = R2I(dur / TIMER_PERIOD)
         loop
            set y = this.y<i>
            set x = this.x<i>
            set x2 = this.x[i - 1]
            set y2 = this.y[i - 1]
            call MoveLightning(this.l<i>,true,x,y,x2,y2)
            call SetLightningColor(this.l<i>,1.0,1.0,1.0,1.0)
            set i = i - 1
            exitwhen i == 1
        endloop
        set y = this.y[1]
        set x = this.x[1]
        set x2 = this.x[this.iU]
        set y2 = this.y[this.iU]
        call MoveLightning(this.l[1],true,x,y,x2,y2)
        call SetLightningColor(this.l<i>,1.0,1.0,1.0,1.0)
     endmethod
     
     method lightningEnd takes nothing returns nothing
         local integer i = this.iU
         loop
             exitwhen i == 0
             call SetLightningColor(this.l<i>,1.0,1.0,1.0,0.0)
             set i = i - 1
         endloop
     endmethod
     
     method alive takes nothing returns boolean
          local integer i = 1
          local boolean b = false
          loop
              if GetWidgetLife(this.u<i>) &lt;= 0.0451 then
                  set b = true
              endif
              exitwhen i == this.iU or b == true
              set i = i + 1
          endloop
          return b
     endmethod
     
     method bondLength takes nothing returns boolean
        local integer i = this.iU
        local real dx
        local real dy
        local real d = 0.0
        loop
            set dx = this.x<i>- this.x[i - 1]
            set dy = this.y<i>- this.y[i - 1]
            set d = d + SquareRoot(dx * dx + dy * dy)
            set i = i - 1
            exitwhen i == 1
        endloop
        set dx = this.x[1] - this.x[this.iU]
        set dy = this.y[1] - this.y[this.iU]
        set d = d + SquareRoot(dx * dx + dy * dy)
        if d &gt; LENGTH then
            return true
        endif
        return false
     endmethod
     
     method onDestroy takes nothing returns nothing
         local integer i = this.iU
         call ReleaseTimer(this.t)
         loop
             exitwhen i == 0
             call DestroyEffect(this.e<i>)
             call DestroyLightning(this.l<i>)
             set i = i - 1
         endloop
     endmethod
endstruct

private function CountUnits takes nothing returns nothing
     set TempI = TempI + 1
endfunction

private function ItIsTrue takes nothing returns boolean
    return true
endfunction

private function Poot takes nothing returns nothing
    local Data d = GetTimerData(GetExpiredTimer())
    local integer i = d.iU
    local boolean lb = false
    set d.duration = d.duration - 1
    if d.duration &lt; 0 or d.alive() == true then
        call d.destroy()
    else
        loop
            set d.x<i> = GetUnitX(d.u<i>)
            set d.y<i> = GetUnitY(d.u<i>)
            if d.oldx<i> != d.x<i> or d.oldy<i> != d.y<i> then
                if d.bondLength() == true then
                    call SetUnitX(d.u<i>,d.oldx<i>)
                    call SetUnitY(d.u<i>,d.oldy<i>)
                    set lb = true
                else
                    set d.oldx<i> = d.x<i>
                    set d.oldy<i> = d.y<i>
                endif
            endif
            set i = i - 1
            exitwhen i == 0
        endloop
        if lb == true then
            call d.lightningStart(0.025)
        endif
        if d.iL == 0 then
            call d.lightningEnd()
        else
            set d.iL = d.iL - 1
        endif
    endif
endfunction

private function A takes nothing returns nothing
     local location loc = GetSpellTargetLoc()
     local unit u = GetTriggerUnit()
     local real x = GetLocationX(loc)
     local real y = GetLocationY(loc)
     local integer level = GetUnitAbilityLevel(u,ABILITY_ID)
     local integer i = 1
     local integer w = MAX_TARGETS_LEVEL * level + MAX_TARGETS_BASE 
     local integer dur = R2I(DURATION_LEVEL * level + DURATION_BASE)
     local Data d
     call GroupEnumUnitsInRange(TempG,x,y,RADIUS_LEVEL * level + RADIUS_BASE,F)
     call ForGroup(TempG,function CountUnits)
     if TempI &gt;= 3 then
         set d = Data.create() 
         loop
             set u = FirstOfGroup(TempG)
             exitwhen u == null or i &gt; w
             set d.u<i> = u
             set d.x<i> = GetUnitX(d.u<i>)
             set d.y<i> = GetUnitY(d.u<i>)
             set d.oldx<i> = d.x<i>
             set d.oldy<i> = d.y<i>
             set d.duration = dur
             set d.e<i> = AddSpecialEffectTarget(EFFECT_PATH,d.u<i>,ATTACH_PATH)
             set d.l<i> = AddLightning(LIGHTNING_CODE,false,10.0,10.0,0.0,0.0)
             call SetLightningColor(d.l<i>,1.0,1.0,1.0,0.0)
             set i = i + 1
             call GroupRemoveUnit(TempG,u)
         endloop
         set d.iU = i - 1
         set d.t = NewTimer()
         call SetTimerData(d.t,d)
         call TimerStart(d.t,TIMER_PERIOD,true,function Poot)
         call d.lightningStart(1.0)
     else
         call GroupClear(TempG)
         set u = null
     endif
     set TempI = 0
     call RemoveLocation(loc)
     set loc = null
endfunction

private function B takes nothing returns boolean
    return GetSpellAbilityId() == ABILITY_ID
endfunction

private function init takes nothing returns nothing
    local trigger t = CreateTrigger()
    local integer i = 0
    set True = Filter(function ItIsTrue)
    set F = Filter(function Filtterinpaska)
    loop
        call TriggerRegisterPlayerUnitEvent(t,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,True)
        set i = i + 1
        exitwhen i == bj_MAX_PLAYER_SLOTS
    endloop
    call TriggerAddCondition(t,Condition(function B))
    call TriggerAddAction(t,function A)
endfunction

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


map: View attachment Bond.w3x

I havent tested it too much, so tell me if there is something, that needs fixing.

Screenshots: none. It looks allmost exactly like spirit link, it uses same lightning effect and everything. You see it, when you test it.
 

Tyman2007

Ya Rly >.
Reaction score
74
Umm, so what exactly does it do? you only said it links them together, does it like even out health orr... like transfer damage... orr..... what...
 

Viikuna

No Marlo no game.
Reaction score
265
Really minor 2 line update, which actually maters quite a lot.

And I need someone to test it, and give me some comments too.
 

Bloodcount

Starcraft II Moderator
Reaction score
297
Hm... looks cool.Why don't you make the chain to stay for as long as the spell is active?Anyway, good spell. +rep,
 

Viikuna

No Marlo no game.
Reaction score
265
Thanks, I too think it turned up to be a really nice spell.

I just think it looks better this way. If there be lightnings all the time, I would get bored.

Thats why there are those thunderclap effects on units; they show if your unit is linked or not.
This was mostly inspired by spirit link ofc. It has lightning only on cast, but effects remain trought the whole duration.
 

Viikuna

No Marlo no game.
Reaction score
265
It uses only one group, that is true, but the spell is MUI. ( This means that you can cast it multiple times and it works. )
 

bananaHUNT

You can change this now in User CP
Reaction score
55
I had the same idea for a spell contest here, i did it in GUI but i cant code for shit lol. nice spell though, i called it Bonds of Decay :)
 

Romek

Super Moderator
Reaction score
964
This needs a screenshot.
You could also make it use 1 timer. :)
 

Viikuna

No Marlo no game.
Reaction score
265
Oh, someone is bumping my spells.

Hm, I think this needs complete remake. Now this kinda sucks IMO.
 

Romek

Super Moderator
Reaction score
964
If you consider this abandoned, I'll graveyard it.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • 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

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top