- Joined
- Nov 13, 2006
- Messages
- 1,814
Question is the different in speed is noticeable between i use for a buff a timer and a periodic trigger or in same trigger i use loop/wait 1 sec for check allways the buffed units hp?
so i talk about this:
so i talk about this:
JASS:
function Trig_Aoe_Amplify_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A004'
endfunction
function Trig_Aoe_Amplify_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit pu
local unit array ua
local integer bdur = 15
local integer a = 0
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local group gr = CreateGroup()
local string s = "Abilities\\Spells\\NightElf\\BattleRoar\\RoarCaster.mdl"
local string s1 = "Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeDamageTarget.mdl"
local effect f = AddSpecialEffectTarget(s, u, "overhead")
local effect array df
local player p = GetOwningPlayer(u)
local integer i = 0
local integer d
call GroupEnumUnitsInRange(gr, x, y, 250.00, null)
loop
set pu = FirstOfGroup(gr)
exitwhen (pu==null)
if ((IsUnitEnemy(pu, GetTriggerPlayer())) and (GetUnitState(pu, ConvertUnitState(0)) > 0)) then
set df[i] = AddSpecialEffectTarget(s1, pu, "overhead")
set ua[i] = pu
set i = i + 1
endif
call GroupRemoveUnit(gr, pu)
endloop
call DestroyEffect(f)
//looping part
set d = i
loop
exitwhen (a==bdur)
call TriggerSleepAction(1)
loop
exitwhen (i==d)
if GetUnitState(ua[i], ConvertUnitState(0))<=0 then
call DestroyEffect(df[i])
set df[i] = null
set ua[i] = null
endif
set i = i + 1
endloop
set i = 0
set a = a + 1
endloop
//loop end
loop
exitwhen (i==d)
if (ua[i]!=null) then
call DestroyEffect(df[i])
set df[i] = null
set ua[i] = null
endif
set i = i + 1
endloop
call DestroyGroup(gr)
set f = null
set s = null
set u = null
set gr = null
set p = null
set s1 = null
endfunction
//===========================================================================
function InitTrig_Aoe_amplify_damage takes nothing returns nothing
set gg_trg_Aoe_amplify_damage = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Aoe_amplify_damage, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Aoe_amplify_damage, Condition( function Trig_Aoe_Amplify_Conditions ) )
call TriggerAddAction( gg_trg_Aoe_amplify_damage, function Trig_Aoe_Amplify_Actions )
endfunction