the Immortal
I know, I know...
- Reaction score
- 51
I was making a spell using the "GroupEnumUnitsInRange". the result = 0 units even if I try to pick every unit on the map. (They have collision size > 0 and are random Neutral Hostile Units). I tried the same with "GroupEnumUnitsInRangeOfLoc" and again nothing happens. Here's the shortened version of the spell containing only the needed part (even this part itself doesn't work)
I cast the spell, the SFX is here and there's the message - "0 units in the group"
Any suggestions why it doesn't work? Or I am using it incorrectly? (or just tell me the stupid mistake I've probably made)
Code:
constant function IN_Effect takes nothing returns string
return "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl"
endfunction
function IN_Conds takes nothing returns boolean
return GetSpellAbilityId() == 'ANcl'
endfunction
function IN_Acts takes nothing returns nothing
local unit u = GetTriggerUnit()
local location p = GetUnitLoc(u)
local group g = null
call DestroyEffect(AddSpecialEffect(INEffect(), GetLocationX(p), GetLocationY(p))) //debug only
call GroupEnumUnitsInRangeOfLoc(g, p, 100000, null)
call BJDebugMsg(I2S(CountUnitsInGroup(g)) + " in the group")
call RemoveLocation(p)
call DestroyGroup(g)
set u = null
endfunction
function InitTrig_IN takes nothing returns nothing
set gg_trg_IN = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_IN, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(gg_trg_IN, Condition(function IN_Conds))
call TriggerAddAction(gg_trg_IN, function IN_Acts)
endfunction
Any suggestions why it doesn't work? Or I am using it incorrectly? (or just tell me the stupid mistake I've probably made)