The Simple spell causes units around the target unit to take damage based on some variables, simple as that.
-I don't want to keep the group, thus using a empty global group (gr) declared at initialization.
-As far as I understand, there is no way to pass parameters through a filter, so this is how I've tried to go about it:
Is this acceptable? Nulling of private globals is required?
What is the best way to deal with this?
Thanks in advance
EDIT: Corrected an error - added what I've done so far
-I don't want to keep the group, thus using a empty global group (gr) declared at initialization.
JASS:
function Simple_Filter takes nothing returns boolean
local unit uf=GetFilterUnit()
//The next line shows what needs to be done with the filtered units
//call UnitDamageTarget(u,uf,dmg,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_FIRE,WEAPON_TYPE_WHOKNOWS)
set uf=null
return false
endfunction
function Trig_Simple_Actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local unit ust=GetSpellTargetUnit()
local real x=GetUnitX(ust)
local real y=GetUnitY(ust)
local real dmg=40*GetUnitAbilityLevel(u,GetSpellAbilityId())+GetHeroStr(u,true)
local real aoe=300.
call GroupEnumUnitsInRange(gr,x,y,aoe,Filter(function Simple_Filter))
set u=null
set ust=null
endfunction
-As far as I understand, there is no way to pass parameters through a filter, so this is how I've tried to go about it:
JASS:
scope HB
globals
private unit uu
private unit uust
private real dmg
endglobals
function Simple_Filter takes nothing returns boolean
local unit uf=GetFilterUnit()
call UnitDamageTarget(uu,uf,dmg,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_FIRE,WEAPON_TYPE_WHOKNOWS)
set uf=null
return false
endfunction
function Trig_Simple_Actions takes nothing returns nothing
local real x
local real y
local real aoe=300.
set uu=GetTriggerUnit()
set uust=GetSpellTargetUnit()
set x=GetUnitX(uust)
set y=GetUnitY(uust)
set dmg=40*GetUnitAbilityLevel(uu,GetSpellAbilityId())+GetHeroStr(uu,true)
call GroupEnumUnitsInRange(gr,x,y,aoe,Filter(function Hellfire_Bolt_Filter))
endfunction
endscope
Is this acceptable? Nulling of private globals is required?
What is the best way to deal with this?
Thanks in advance
EDIT: Corrected an error - added what I've done so far