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
 

jig7c

Stop reading me...-statement
Reaction score
123
in the ability, is Self checked on in the Targets Allowed?
 

roaaaarrrr

New Member
Reaction score
33
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.
 

sLsIDK

New Member
Reaction score
13
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
 

black.sheep

Active Member
Reaction score
24
I think i've found the issue. For some weird reason to order ID changes? Anyone got any idea what it would change to?
 

roaaaarrrr

New Member
Reaction score
33
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 Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top