- Joined
- Sep 9, 2009
- Messages
- 658
Okay, when it comes to auras, I know using a system would be easier but I just wanted to try this out. Anyway, am I doing this right? I'm checking if the unit has the buff before it gets the aura's effects. But since the unit can't be checked if it's no longer within the range of the aura, I gave the unit group check a bigger range than the AoE of the aura.
I also want some comments on the start up. With the way its coded right now, every time I learn or level up the skill, a new timer is created right? Is there a better way to do that?
I also want some comments on the start up. With the way its coded right now, every time I learn or level up the skill, a new timer is created right? Is there a better way to do that?
JASS:
globals
unit array Hero
integer AuraCount = 0
group AuraGroup = CreateGroup()
endglobals
function Arcane_Aura_Actions takes nothing returns nothing
local integer i = 0
local unit u
local real x
local real y
loop
exitwhen i == AuraCount
set x = GetUnitX(Hero[AuraCount])
set y = GetUnitY(Hero[AuraCount])
call GroupEnumUnitsInRange(AuraGroup, x, y, 2000, null)
loop
set u = FirstOfGroup(AuraGroup)
exitwhen u == null
if GetUnitAbilityLevel(u, 'B000') > 0 then
call UnitAddAbility(u, 'A000')
else
call UnitRemoveAbility(u, 'A000')
endif
call GroupRemoveUnit(AuraGroup, u)
endloop
set i = i + 1
endloop
endfunction
function Arcane_Aura_Learn takes nothing returns nothing
local timer t = CreateTimer()
set AuraCount = AuraCount + 1
set Hero[AuraCount] = GetTriggerUnit()
call TimerStart(t, 1, true, function Arcane_Aura_Actions)
set t = null
endfunction
function Trig_Arcane_Aura_Conditions takes nothing returns boolean
if GetLearnedSkill() == 'A001' then
call Arcane_Aura_Learn()
call BJDebugMsg("Working!")
endif
return false
endfunction
//===========================================================================
function InitTrig_Arcane_Aura takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( t, Condition( function Trig_Arcane_Aura_Conditions ) )
set t = null
endfunction