N
nossej
Guest
this was suppose to damage units around the caster when i cast a spell.
the lightning effect is there, but the thing is it wont damage the unit
why? why? why? and why? :banghead:
the lightning effect is there, but the thing is it wont damage the unit
why? why? why? and why? :banghead:
JASS:
function Trig_Holy_Thunder_Conditions takes nothing returns boolean
return (GetSpellAbilityId() == 039;A01D039; or GetSpellAbilityId() == 039;A019039; or GetSpellAbilityId() == 039;A002039; or GetSpellAbilityId() == 039;A018039;)
endfunction
function filterUnit takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) and GetUnitAbilityLevel(GetFilterUnit(), 039;B00G039;) > 0
endfunction
function Trig_Holy_Thunder_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit victim
local integer spellLvl = GetUnitAbilityLevel(caster, 039;A01I039;)
local integer dmg = spellLvl * 100
local group victims = CreateGroup()
call GroupEnumUnitsInRange(victims, GetUnitX(caster), GetUnitY(caster), 600, Condition(function filterUnit))
loop
set victim = FirstOfGroup(victims)
exitwhen victim == null
call UnitDamageTarget(caster, victim, dmg, true, true, ATTACK_TYPE_HERO, DAMAGE_TYPE_DIVINE, null)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\Bolt\\BoltImpact.mdl", victim, "chest"))
call GroupRemoveUnit(victims, victim)
endloop
set caster = null
set victim = null
set victims = null
endfunction
//===========================================================================
function InitTrig_Holy_Thunder takes nothing returns nothing
local trigger gg_trg_Holy_Thunder = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Holy_Thunder, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Holy_Thunder, Condition( function Trig_Holy_Thunder_Conditions ) )
call TriggerAddAction( gg_trg_Holy_Thunder, function Trig_Holy_Thunder_Actions )
endfunction