- Joined
- Jul 9, 2008
- Messages
- 253
I'm making a spell called Static Disruption, based on thunder clap and all enemy units that are in 600 range should get Static Disruption Debuff (based on cripple).
The problem is that when I use the spell it sometimes works but sometimes it doesn't and I have no idea why it does that...
Could someone help me?
The problem is that when I use the spell it sometimes works but sometimes it doesn't and I have no idea why it does that...
Could someone help me?
JASS:
function Trig_Static_Disruption_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A009' ) ) then
return false
endif
return true
endfunction
function Trig_Static_Disruption_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local location loc = GetUnitLoc(caster)
local group g = GetUnitsInRangeOfLocAll(600, loc)
local unit u
local unit dumb
loop
set u = FirstOfGroup(g)
exitwhen u==null
if IsUnitEnemy(u, GetOwningPlayer(caster))==true then
call GroupRemoveUnit(g,u)
set dumb = CreateUnitAtLoc(GetOwningPlayer(caster), 'h00B', GetUnitLoc(u), 0.00)
call IssueTargetOrderBJ(dumb, "frostarmor" , u)
set dumb = null
endif
endloop
call TriggerSleepAction(0.5)
call RemoveLocation(loc)
call DestroyGroup(g)
call RemoveUnit(dumb)
set dumb = null
set g = null
set u = null
set caster = null
endfunction
//===========================================================================
function InitTrig_Static_Disruption takes nothing returns nothing
set gg_trg_Static_Disruption = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Static_Disruption, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Static_Disruption, Condition( function Trig_Static_Disruption_Conditions ) )
call TriggerAddAction( gg_trg_Static_Disruption, function Trig_Static_Disruption_Actions )
endfunction