Laiev
Hey Listen!!
- Reaction score
- 188
well... what happen?...
the spell run without any problem, but when you cast in a point which got death units, the loop stop (?)...
any help will be welcome
the spell run without any problem, but when you cast in a point which got death units, the loop stop (?)...
any help will be welcome
JASS:
scope HolyLight
globals
private constant integer AbilId = 039;A08F039; //ability id
private constant real Damage = 25.0 //damage per level
private constant integer Aoe = 400 //area of effect which will grow
private constant integer AoeGrow = 100 //grow rate of aoe of spell
private constant string EffectEnemy = "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl" //effect in enemy when damage happen
private constant string EffectAlly = "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" //effect in ally when heal happen
private constant string Attach = "origin" //position of effect
endglobals
private function HolyLight_Conditions takes nothing returns boolean
return GetSpellAbilityId() == AbilId
endfunction
private function UnitFilter takes nothing returns boolean
local unit u = GetFilterUnit()
return IsUnitType(u, UNIT_TYPE_STRUCTURE) == false and IsUnitType(u, UNIT_TYPE_DEAD) == false
endfunction
private function HolyLight_Actions takes nothing returns nothing
local unit u
local unit cast = GetTriggerUnit()
local location p = GetSpellTargetLoc()
local integer i = 0
local integer n = 1
local group g = CreateGroup ()
loop
exitwhen i >= Aoe
call CreateEffectCircle (p, i, n, "Abilities\\Spells\\Items\\ResourceItems\\ResourceEffectTarget.mdl", 2)
call GroupEnumUnitsInRangeOfLoc (g, p, I2R(i), Filter(function UnitFilter))
loop
set u = FirstOfGroup (g)
exitwhen u == null
if IsUnitEnemy (u, GetOwningPlayer (cast)) == true then
call DestroyEffect (AddSpecialEffectTarget (EffectEnemy, u, Attach))
call UnitDamageTarget (GetTriggerUnit(), u, Damage * ( GetUnitAbilityLevel (GetTriggerUnit(), AbilId)), true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
call GroupRemoveUnit(g,u)
else
call DestroyEffect (AddSpecialEffectTarget (EffectAlly, u, Attach))
call SetWidgetLife(u, GetWidgetLife(u) + Damage * (GetUnitAbilityLevel (GetTriggerUnit(), AbilId)))
call GroupRemoveUnit(g,u)
endif
endloop
call DestroyGroup (g)
set g = null
set i = i + AoeGrow
set n = n + 10
call TriggerSleepAction (.3)
endloop
call RemoveLocation (p)
set p = null
endfunction
//===========================================================================
function InitTrig_Holy_Light takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function HolyLight_Conditions ) )
call TriggerAddAction( t, function HolyLight_Actions )
endfunction
endscope