I'm working on a spell based on flame strike , but it doesn't work for some reason , as you can tell the spell is supposed to do damage to units in target area ONCE, I chose flame strike as a base because of the spell aoe effect since I tried it with channel and it didn't work.
Please Help!
Please Help!
JASS:
globals
player udg_p
endglobals
function us takes nothing returns boolean
if IsUnitEnemy(GetFilterUnit(), udg_p) == TRUE then
return TRUE
else
return FALSE
endif
endfunction
function fs1 takes nothing returns boolean
if GetSpellAbilityId() == 'A01Q' then
return TRUE
else
return FALSE
endif
endfunction
function Trig_Flame_Strike_Actions takes nothing returns nothing
local unit t
local unit caster = GetTriggerUnit()
local integer ent = GetHeroInt(caster, TRUE)
local integer lvl = GetUnitAbilityLevel(caster, 'A01Q')
local group g = CreateGroup()
local location loc = GetSpellTargetLoc()
set udg_p = GetOwningPlayer(caster)
set g = GetUnitsInRangeOfLocMatching(200, loc, Condition(function us))
loop
set t = FirstOfGroup(g)
exitwhen t == null
if lvl == 1 then
call UnitDamageTargetBJ(caster, t, 50 + 1/4*ent, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_FIRE)
elseif lvl == 2 then
call UnitDamageTargetBJ(caster, t, 75 + 1/2*ent, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_FIRE)
elseif lvl == 3 then
call UnitDamageTargetBJ(caster, t, 100 + 3/4*ent, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_FIRE)
endif
call GroupRemoveUnit(g, t)
endloop
call DestroyGroup(g)
endfunction
//===========================================================================
function InitTrig_Flame_Strike takes nothing returns nothing
set gg_trg_Flame_Strike = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Flame_Strike, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition( gg_trg_Flame_Strike, Condition(function fs1))
call TriggerAddAction( gg_trg_Flame_Strike, function Trig_Flame_Strike_Actions )
endfunction
Last edited: