- Joined
- Aug 30, 2009
- Messages
- 114
Hi there, I need some help understanding why is this causing lag when multiple enemy units are targeted...
Everything works fine, Infernals with stacking Permanent Immolation aura, but when I come across many enemy units, it lags!!!
I've downloaded many maps that uses global grouping like I did, and none of them lag...
Can anyone tell me if I'm doing something wrong? Or just give me some solution? Please, don't give the solution to the spell itself, there are many different ways I could be using to create a stacking permanent immolation, but what I want is to UNDERSTAND why is it lagging and how can I fix it!!!
I heard about aura struct, that it could be able to target many units I want at once without lagging, is that right? And what is the difference between it and what I'm doing?
Thank you.
JASS:
scope RainOfChaos initializer Init
private function Cond1 takes nothing returns boolean
return(GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0 and GetUnitAbilityLevel(GetFilterUnit(), 'Aloc') == 0 and GetUnitAbilityLevel(GetFilterUnit(), 'B012') > 0)
endfunction
private function Cond2 takes nothing returns boolean
return(GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0 and GetUnitAbilityLevel(GetFilterUnit(), 'Aloc') == 0 and IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetEnumUnit())) and GetUnitAbilityLevel(GetFilterUnit(), 'A044') > 0)
endfunction
private function GroupAct takes nothing returns nothing
local unit U = GetEnumUnit()
local location L = GetUnitLoc(U)
local group G = CreateGroup()
local unit T
local real Dmg = 30.00
local effect Fx
call GroupEnumUnitsInRangeOfLoc(G, L, 600.00, Condition(function Cond2))
set T = FirstOfGroup(G)
if T != null then
set Dmg = Dmg * CountUnitsInGroup(G)
set Fx = AddSpecialEffectTarget("Abilities\\Spells\\NightElf\\Immolation\\ImmolationDamage.mdl", U, "head")
call UnitDamageTargetEx(T, U, Dmg, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_SPELL, false)
call DestroyEffect(Fx)
endif
set T = null
call DestroyGroup(G)
call RemoveLocation(L)
set U = null
endfunction
private function Actions takes nothing returns nothing
local group Gr = CreateGroup()
call GroupEnumUnitsInRect(Gr, GetPlayableMapRect(), Condition(function Cond1))
call ForGroup(Gr, function GroupAct)
call DestroyGroup(Gr)
endfunction
////////////////////////////////////////////////////////////////////////////////////////////
private function LearnAct takes nothing returns nothing
local timer T = CreateTimer()
call TimerStart(T, 1.00, true, function Actions)
set T = null
call DestroyTrigger(GetTriggeringTrigger())
endfunction
private function LearnCond takes nothing returns boolean
return GetLearnedSkill() == 'A03H'
endfunction
private function Init takes nothing returns nothing
local trigger T = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(T, EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition(T, Condition(function LearnCond))
call TriggerAddAction(T, function LearnAct)
set T = null
endfunction
////////////////////////////////////////////////////////////////////////////////////////////
endscope
Everything works fine, Infernals with stacking Permanent Immolation aura, but when I come across many enemy units, it lags!!!
I've downloaded many maps that uses global grouping like I did, and none of them lag...
Can anyone tell me if I'm doing something wrong? Or just give me some solution? Please, don't give the solution to the spell itself, there are many different ways I could be using to create a stacking permanent immolation, but what I want is to UNDERSTAND why is it lagging and how can I fix it!!!
I heard about aura struct, that it could be able to target many units I want at once without lagging, is that right? And what is the difference between it and what I'm doing?
Thank you.