Need some help making a custom channeling spell

Summoned

New Member
Reaction score
51
I'm working on this spell that's basically a continuous stream of carrion swarms that lasts for as long as the caster does not do anything else. The stream of carrion swarms is the easy part, but I'm having a hard time making it so the caster actually just stands there and channels the spell. Basically what ends up happening is, without continuously spamming the "stop" command every tenth of a second or so, it'll rush off to the nearest enemy and start doing normal attacks while churning out the swarms.

Any ideas?
 
Reaction score
54
So, basically you want to convert Carrion Swarm to a channeling ability, yes?

I find that if you base your spell on Carrion Swarm, a non-channeling ability, you're going to have to deal with the channeling aspects through triggering.


Instead, I would base the spell on Channel. Change Data - Follow through time and the unit should behave as it were channeling.

Trigger:
  • ChannelStart
    • Events
      • Unit - Unit starts the effect of an ability
    • Actions
      • Start DummyTrigger


Trigger:
  • ChannelFinish
    • Events
      • Unit - Unit finishes casting an ability
    • Actions
      • Stop DummyTrigger

Trigger:
  • DummyTrigger:
    • Events
      • Time - Every x seconds
    • Actions
      • Create a dummy that casts carrion swarm toward target of the ability, saved in a variable of course.


Be sure to check for leaks, add conditions, format the channel ability.
 

Summoned

New Member
Reaction score
51
Well, I actually have everything else worked out. Basing it on a normal Channel with "follow-through time" won't work because I want the spell to continue channeling forever as long as the caster has mana. Only problem I have is preventing the casting unit from trying to take a swipe at any enemy that comes into acquisition range without some silly "stop"/"holdposition" spamming. Just wondering if there's any other way of preventing a caster from attacking without outright pausing it.

Explanation: This spell can either target a unit or a point. If targeted on a unit, the stream of carrion swarms will begin following the unit. If targeting a point, it'll just keep shooting at the point.

JASS:
function DI_Constants takes nothing returns nothing
    globals
        integer DI_SPELLID = 'A01L'
        integer DI_WAVEID1 = 'A01N'
        integer DI_WAVEID2 = 'A01O'
        integer DI_SPELLDUMMY = 'n002'
        real DI_MANACOSTBASE = 20
        real DI_MANACOSTMULT = 20
        string DI_WAVEORDER = "carrionswarm"
    endglobals
endfunction

function DI_Target takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit caster = H2U(GetHandleHandle(t, "caster"))
    local unit target = H2U(GetHandleHandle(t, "target"))
    local location castloc = GetUnitLoc(caster)
    local location tarloc = GetUnitLoc(target)
    local real angle = AngleBetweenPoints(castloc, tarloc)
    local integer sklvl = GetHandleInt(t, "sklvl")
    local real manacost = (DI_MANACOSTBASE + (DI_MANACOSTMULT * I2R(sklvl))) / 5
    local integer N = GetHandleInt(t, "N")
    
    if (GetUnitState(caster, UNIT_STATE_MANA) < manacost) or (GetUnitState(target, UNIT_STATE_LIFE) <= 0) then
        call PauseTimer(t)
        call IssueImmediateOrder(caster, "stop")
        call SetUnitAnimation(caster, "stand")
        set caster = null
        set target = null
        call RemoveLocation(castloc)
        call RemoveLocation(tarloc)
        call FlushHandleLocals(t)
        call DestroyTimer(t)    
    elseif (GetUnitCurrentOrder(caster) != null) then
        call PauseTimer(t)
        call SetUnitAnimation(caster, "stand")
        set caster = null
        set target = null
        call RemoveLocation(castloc)
        call RemoveLocation(tarloc)
        call FlushHandleLocals(t)
        call DestroyTimer(t)
    else
        set N = N + 1
        call SetHandleInt(t, "N", N)
        call IssueImmediateOrder(caster, "stop")
        call IssueImmediateOrder(caster, "holdposition")
        call SetUnitFacing(caster, angle)
        call SetUnitAnimation(caster, "slam")
        if (ModuloInteger(N, 2) == 0) then
            call SetUnitState(caster, UNIT_STATE_MANA, (GetUnitState(caster, UNIT_STATE_MANA) - manacost))
            set bj_lastCreatedUnit = CreateUnitAtLoc(GetOwningPlayer(caster), DI_SPELLDUMMY, castloc, 0)
            call UnitApplyTimedLife(bj_lastCreatedUnit, 'BTLF', 3)
            call UnitAddAbility(bj_lastCreatedUnit, DI_WAVEID1)
            call SetUnitAbilityLevel(bj_lastCreatedUnit, DI_WAVEID1, sklvl)
            call IssuePointOrderLoc(bj_lastCreatedUnit, DI_WAVEORDER, tarloc)
        
            set bj_lastCreatedUnit = CreateUnitAtLoc(GetOwningPlayer(caster), DI_SPELLDUMMY, castloc, 0)
            call UnitApplyTimedLife(bj_lastCreatedUnit, 'BTLF', 3)
            call UnitAddAbility(bj_lastCreatedUnit, DI_WAVEID2)
            call SetUnitAbilityLevel(bj_lastCreatedUnit, DI_WAVEID2, sklvl)
            call IssuePointOrderLoc(bj_lastCreatedUnit, DI_WAVEORDER, tarloc)
        endif
    endif
    
    set caster = null
    set target = null
    call RemoveLocation(castloc)
    call RemoveLocation(tarloc)
    
endfunction

function DI_Target_Start takes unit caster, unit target, integer sklvl returns nothing
    local timer t = CreateTimer()
    call SetHandleHandle(t, "caster", caster)
    call SetHandleHandle(t, "target", target)
    call SetHandleInt(t, "sklvl", sklvl)
    call TimerStart(t, 0.1, true, function DI_Target)
endfunction

function DI_Point takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit caster = H2U(GetHandleHandle(t, "caster"))
    local real angle = GetHandleReal(t, "angle")
    local location castloc = GetUnitLoc(caster)
    local location tarloc = PolarProjectionBJ(castloc, 50, angle)
    local integer sklvl = GetHandleInt(t, "sklvl")
    local real manacost = (DI_MANACOSTBASE + (DI_MANACOSTMULT * I2R(sklvl))) / 5
    local integer N = GetHandleInt(t, "N")
    
    if (GetUnitState(caster, UNIT_STATE_MANA) < manacost) then
        call IssueImmediateOrder(caster, "stop")
        call SetUnitAnimation(caster, "stand")
        call PauseTimer(t)
        set caster = null
        call RemoveLocation(castloc)
        call RemoveLocation(tarloc)
        call FlushHandleLocals(t)
        call DestroyTimer(t)
    elseif (GetUnitCurrentOrder(caster) != null) then
        call PauseTimer(t)
        call SetUnitAnimation(caster, "stand")
        set caster = null
        call RemoveLocation(castloc)
        call RemoveLocation(tarloc)
        call FlushHandleLocals(t)
        call DestroyTimer(t)
    else
        set N = N + 1
        call SetHandleInt(t, "N", N)
        call IssueImmediateOrder(caster, "stop")
        call IssueImmediateOrder(caster, "holdposition")
        call SetUnitFacing(caster, angle)
        call SetUnitAnimation(caster, "slam")
        if (ModuloInteger(N, 2) == 0) then
            call SetUnitState(caster, UNIT_STATE_MANA, (GetUnitState(caster, UNIT_STATE_MANA) - manacost))
            set bj_lastCreatedUnit = CreateUnitAtLoc(GetOwningPlayer(caster), DI_SPELLDUMMY, castloc, 0)
            call UnitApplyTimedLife(bj_lastCreatedUnit, 'BTLF', 3)
            call UnitAddAbility(bj_lastCreatedUnit, DI_WAVEID1)
            call SetUnitAbilityLevel(bj_lastCreatedUnit, DI_WAVEID1, sklvl)
            call IssuePointOrderLoc(bj_lastCreatedUnit, DI_WAVEORDER, tarloc)
        
            set bj_lastCreatedUnit = CreateUnitAtLoc(GetOwningPlayer(caster), DI_SPELLDUMMY, castloc, 0)
            call UnitApplyTimedLife(bj_lastCreatedUnit, 'BTLF', 3)
            call UnitAddAbility(bj_lastCreatedUnit, DI_WAVEID2)
            call SetUnitAbilityLevel(bj_lastCreatedUnit, DI_WAVEID2, sklvl)
            call IssuePointOrderLoc(bj_lastCreatedUnit, DI_WAVEORDER, tarloc)
        endif
    endif
    
    set caster = null
    call RemoveLocation(castloc)
    call RemoveLocation(tarloc)
endfunction

function DI_Point_Start takes unit caster, real angle, integer sklvl returns nothing
    local timer t = CreateTimer()
    call SetHandleHandle(t, "caster", caster)
    call SetHandleReal(t, "angle", angle)
    call SetHandleInt(t, "sklvl", sklvl)
    call TimerStart(t, 0.1, true, function DI_Point)
endfunction

function Trig_Darkness_Inferno_Actions takes nothing returns nothing
    local integer sklvl
    local unit caster
    local unit target
    local real angle
    local location castloc
    local location tarloc
    if (GetSpellAbilityId() == DI_SPELLID) then
        set caster = GetTriggerUnit()
        set sklvl = GetUnitAbilityLevel(caster, DI_SPELLID)
        if (GetSpellTargetUnit() != null) then
            set target = GetSpellTargetUnit()
            call IssueImmediateOrder(caster, "holdposition")
            call DI_Target_Start(caster, target, sklvl)
        else
            set castloc = GetUnitLoc(caster)
            set tarloc = GetSpellTargetLoc()
            set angle = AngleBetweenPoints(castloc, tarloc)
            call RemoveLocation(castloc)
            call RemoveLocation(tarloc)
            call IssueImmediateOrder(caster, "holdposition")
            call DI_Point_Start(caster, angle, sklvl)
        endif
        set caster = null
    endif
endfunction

//===========================================================================
function InitTrig_Darkness_Inferno takes nothing returns nothing
    set gg_trg_Darkness_Inferno = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Darkness_Inferno, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddAction( gg_trg_Darkness_Inferno, function Trig_Darkness_Inferno_Actions )
endfunction
 

Silver

New Member
Reaction score
21
You could freeze the unit, this will stop it from attacking but it will also stop animating. Might look weird (but you could add to the tooltip that this is a side effect, find a way to make it fit in?)

You could change ownership but retain colour, give it to neutral passive?

Of course, what might be best is to base the spell off channel, and change its effects (mainly to make it a dummy ability but keeping the channeled part), then add the carrion swarm via triggers.
 

Summoned

New Member
Reaction score
51
You could freeze the unit, this will stop it from attacking but it will also stop animating. Might look weird (but you could add to the tooltip that this is a side effect, find a way to make it fit in?)

You could change ownership but retain colour, give it to neutral passive?
Freezing the unit or changing ownership causes major issues, mainly I want the player to be able to break the channeling effect by moving or attacking or casting another spell, etc.

Of course, what might be best is to base the spell off channel, and change its effects (mainly to make it a dummy ability but keeping the channeled part), then add the carrion swarm via triggers.
This won't work because the "channeling" has a fixed duration. It also seems to automatically break the spell because the game considers the channel follow-through to be a type of non-null order?

Thanks for trying to help, though. I think I'll stick with the silly jerk action spell for now.
 
Reaction score
54
Not yet!

Are you ok with disabling the unit attack for the duration of the spell?
If so, have a dummy cast Drunken Haze on it, and remove it when spell is over.
 

Summoned

New Member
Reaction score
51
Actually, that sounds like a nice idea. Going to give it a try.

EDIT: Seems to work alright. Looks a bit weird with the attack button disappearing and all, but much better than spamming stop and hold position over and over and over.
 
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

      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