Issue with channeling ability

black.sheep

Active Member
Reaction score
24
I made a channeling heal spell, based on channel. It works fine, except when you target it on the caster, it seems to force the user to use stop.
Any reason why this would happen? I use the ability via a item if that effects it in any way.

JASS:
scope medkit initializer i
    private struct medDat
        unit u
        unit t
        effect e
    endstruct
    
    globals
        private constant integer MEDID = 'A08Y'
        private constant real HEALRATE = 50
        private constant real BREAKRANGE = 325
        private constant string EFFECT = "Abilities\\Spells\\NightElf\\Rejuvenation\\RejuvenationTarget.mdl"
        private constant string ATTACHPOINT = "chest"
        private constant real TIMEROUT = 0.3
        
        private timer time = CreateTimer()
        private integer dbIndex = -1
        private medDat array medDB
    endglobals
    
    private function c takes nothing returns boolean
        return GetSpellAbilityId() == MEDID
    endfunction
    
    private function p takes nothing returns nothing
        local medDat tempDat
        local integer index=0
        loop 
            exitwhen index>dbIndex
            set tempDat=medDB[index]
            call SetUnitState(tempDat.t,UNIT_STATE_LIFE,GetUnitState(tempDat.t,UNIT_STATE_LIFE)+(HEALRATE*TIMEROUT))
            if tempDat.t != tempDat. u then
                call SetUnitFacingTimed(tempDat.u,A2PXY(GetUnitX(tempDat.u),GetUnitY(tempDat.u),GetUnitX(tempDat.t),GetUnitY(tempDat.t)),0)
            endif
            if D2PXY(GetUnitX(tempDat.t),GetUnitY(tempDat.t),GetUnitX(tempDat.u),GetUnitY(tempDat.u)) > BREAKRANGE or GetUnitCurrentOrder(tempDat.u) != 852008 then
                call IssueImmediateOrder(tempDat.u,"stop")
                call DestroyEffect(tempDat.e)
                call tempDat.destroy()
                set medDB[index]=medDB[dbIndex]
                set dbIndex=dbIndex-1
                if dbIndex==-1 then
                    call PauseTimer(time)
                endif
            endif
            set index=index+1
        endloop
    endfunction
    
    private function a takes nothing returns nothing
        local medDat tempDat=medDat.create()
        set tempDat.u = GetTriggerUnit()
        set tempDat.t = GetSpellTargetUnit()
        set tempDat.e = AddSpecialEffectTarget(EFFECT,tempDat.t,ATTACHPOINT)
        set dbIndex=dbIndex+1
        set medDB[dbIndex]=tempDat
        if dbIndex==0 then
            call TimerStart(time,TIMEROUT,true,function p)
        endif
    endfunction
    
    private function i takes nothing returns nothing
        local trigger t=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t,Condition(function c))
        call TriggerAddAction(t,function a)
    endfunction
endscope
 
in the ability, is Self checked on in the Targets Allowed?
 
That shouldnt have anything to do with it. It wouldnt even let you target yourself if that was the case. Im guessing it has something to do with this.

JASS:
            if D2PXY(GetUnitX(tempDat.t),GetUnitY(tempDat.t),GetUnitX(tempDat.u),GetUnitY(tempDat.u)) > BREAKRANGE or GetUnitCurrentOrder(tempDat.u) != 852008 then
                call IssueImmediateOrder(tempDat.u,"stop")


I'm not sure what D2PXY is or what that order # is, but I bet it is causing your unit to stop channeling due to one of those things. Try tweaking that or explaining more what that 'if' line is doing.
 
D2PXY sounds like Distance 2 Point XY.

Also there's a space:___v (don't know if that affects anything in JASS)
if tempDat.t != tempDat. u then
 
I think i've found the issue. For some weird reason to order ID changes? Anyone got any idea what it would change to?
 
Not sure what you are asking. The order ID you have is for 'UseSlot1' and Im not sure what you are doing with that...
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      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