JASS:
function Deal_AoE_Bonus takes integer high, unit caster, location p returns nothing
local group g
local unit u
local integer result
local unit y
set result = GetRandomInt(1,high)
set g = GetUnitsInRangeOfLocAll(GetHandleReal(y, "range"), p)
set u = FirstOfGroup(g)
//DEBUGSHITcall DisplayTextToPlayer(Player(0),0,0,I2S(result))
loop
exitwhen u==null
set u = FirstOfGroup(g)
if IsUnitEnemy(u, GetOwningPlayer(caster))==true then
//DEBUGSHITcall UnitDamageTarget(caster, u, I2R(result), true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
call SetUnitState (u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_LIFE)-I2R(result))
call DisplayTextToPlayer(Player(0),0,0,I2S(result))
call GroupRemoveUnit(g,u)
endif
endloop
set g = null
set u = null
//set caster = null
//set p = null
set y= null
call SetHandleInt(y, "range", 0)
call FlushHandleLocals(y)
endfunction
//=========================================
//The Trigger
//=========================================
function CheckAoESpell takes nothing returns boolean
local unit y = GetTriggerUnit()
//WhateverSpell
if GetSpellAbilityId()=='A020' then
call SetHandleReal(y, "range", 350.00)
set y = null
return true
endif
set y = null
return false
endfunction
function AoE_Bonus takes nothing returns nothing
local integer loopcounter = 0
local integer currentitem
local unit x
//DEBUGSHITcall call DisplayTextToPlayer(Player(0),0,0,"HIT")
//========================================================
//Whatever Item
//========================================================
if UnitHasItemOfTypeBJ(GetTriggerUnit(),'I02A') == true then
set x = GetTriggerUnit()
set currentitem = 'I02A'
call DisplayTextToPlayer(Player(0),0,0,"Sorc Dagger")
call CountNumberOfItemOnUnit(currentitem,GetTriggerUnit())
//call TriggerSleepAction(.10)
set loopcounter = GetHandleInt(x, "sum")
loop
exitwhen loopcounter == 0
//DEBUGSHITcall DisplayTextToPlayer(Player(0),0,0,"|CFF8801BDThis loop will be fired "+I2S(loopcounter)+" time(s).")
call Deal_AoE_Bonus(25,GetTriggerUnit(),GetUnitLoc(GetTriggerUnit()))
set loopcounter = loopcounter - 1
endloop
endif
set x = null
call SetHandleInt(x, "sum", 0)
//========================================================
call FlushHandleLocals(x)
endfunction
function InitTrig_AoEBonus takes nothing returns nothing
set gg_trg_AoEBonus = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_AoEBonus, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_AoEBonus, Condition(function CheckAoESpell))
call TriggerAddAction(gg_trg_AoEBonus, function AoE_Bonus)
endfunction
Deal_AoE_Bonus isn't getting fired. Everything else is though, even the loop within AoE_Bonus. Please help