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.
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 = 039;A08Y039;
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