- Joined
- Sep 25, 2013
- Messages
- 6
Help !!!
My spell Ice Strike attempt to deal damage to unit within 300 range of caster after 0.5sec of cast.
But there is a problem that i cant call ForGroupBJ/ForGroup actions while using timer to wait.
I wan to know why and how to fix it
please help
My spell Ice Strike attempt to deal damage to unit within 300 range of caster after 0.5sec of cast.
But there is a problem that i cant call ForGroupBJ/ForGroup actions while using timer to wait.
JASS:
scope IceStrike initializer Init
globals
private real damage
private timer dtimer
private real period = 0.5
endglobals
private function GroupActions takes nothing returns nothing
// Break point
call BJDebugMsg("!!")
if ( IsUnitDeadBJ(GetEnumUnit()) == FALSE ) then
if ( IsUnitType(GetEnumUnit(), UNIT_TYPE_MAGIC_IMMUNE) == FALSE) then
if ( IsUnitType(GetEnumUnit(), UNIT_TYPE_STRUCTURE) == FALSE ) then
if ( IsUnitAlly(GetEnumUnit(), GetOwningPlayer(GetSpellAbilityUnit())) == FALSE) then
call UnitDamageTargetBJ( GetSpellAbilityUnit(), GetEnumUnit(), damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC )
call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
endif
endif
endif
endif
endfunction
private function timeOut takes nothing returns nothing
local location tempLoc =GetUnitLoc(GetSpellAbilityUnit())
local group tempGroup =GetUnitsInRangeOfLocAll(300,tempLoc)
set damage = ( I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetSpellAbilityUnit())) * 50.00 ) + I2R(GetHeroStatBJ(bj_HEROSTAT_INT, GetSpellAbilityUnit(), true))
call ForGroupBJ( tempGroup, function GroupActions )
call DestroyGroup(tempGroup)
call RemoveLocation(tempLoc)
call DestroyTimer(dtimer)
endfunction
private function Actions takes nothing returns nothing
set dtimer = CreateTimer()
call TimerStart(dtimer, period, false, function timeOut)
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
call RegisterSpellEffectEvent('A00D', function Actions )
set t = null
endfunction
endscope
I wan to know why and how to fix it
please help