- Joined
- Mar 23, 2008
- Messages
- 942
Spell don't heal
I have a spell that heals in a area for 10s, but its not working at all.
AREA NON-CHANNEL HEALING
Thanks in advance!
I have a spell that heals in a area for 10s, but its not working at all.
AREA NON-CHANNEL HEALING
JASS:
scope SoutenKisshunNC initializer InSoutenKisshunNC
globals
private integer RADIUS = 300
endglobals
private struct SK
unit caster
real heal
real x
real y
integer count
unit sfx
endstruct
globals
private player tp
endglobals
private function SoutenKisshunNC_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A04Z' )
endfunction
private function SoutenKisshunNC_Group takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), tp) != true ) and (GetWidgetLife(GetFilterUnit()) > 0.405)
endfunction
private function SoutenKisshunNC_Heal takes nothing returns nothing
local SK s = GetTimerData(GetExpiredTimer())
local group hgroup = CreateGroup()
local unit tu
if (s.count <= 40) then
set tp = GetOwningPlayer(s.caster)
call GroupEnumUnitsInRange(hgroup, s.x, s.y, RADIUS, Condition(function SoutenKisshunNC_Group))
loop
set tu = FirstOfGroup(hgroup)
exitwhen tu == null
call SetUnitState(tu, UNIT_STATE_LIFE, GetUnitState(tu, UNIT_STATE_LIFE) + s.heal)
call GroupRemoveUnit(hgroup, tu)
endloop
call DestroyGroup(hgroup)
set hgroup = null
set tp = null
set s.count = s.count + 1
else
call ReleaseTimer(GetExpiredTimer())
call s.destroy()
call RemoveUnit(s.sfx)
set s.sfx = null
set s.caster = null
endif
endfunction
private function SoutenKisshunNC_Actions takes nothing returns nothing
local SK s = SK.create()
local timer t = NewTimer()
local location target = GetSpellTargetLoc()
set s.x = GetLocationX(target)
set s.y = GetLocationY(target)
set s.caster = GetTriggerUnit()
set s.heal = GetUnitAbilityLevel(s.caster, 'A04R') * 2.5
set s.sfx = CreateUnit(GetOwningPlayer(s.caster), 'h01A', s.x, s.y, 90)
call SetUnitScale(s.sfx, 2, 2, 2)
call SetTimerData(t,s)
call TimerStart(t, 0.25, true, function SoutenKisshunNC_Heal)
call RemoveLocation(target)
set target = null
endfunction
//===========================================================================
function InSoutenKisshunNC takes nothing returns nothing
local trigger t_SoutenKisshunNC = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t_SoutenKisshunNC, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t_SoutenKisshunNC, Condition( function SoutenKisshunNC_Conditions ) )
call TriggerAddAction( t_SoutenKisshunNC, function SoutenKisshunNC_Actions )
set t_SoutenKisshunNC = null
endfunction
endscope
Thanks in advance!
Last edited: