function Trig_CtD_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00N'
endfunction
function Trig_CtD_Func1 takes nothing returns boolean
local unit a = GetTriggerUnit()
return GetBooleanAnd((UnitHasBuffBJ(GetFilterUnit(), 'B002') == true), (IsUnitAliveBJ(a) == true))
endfunction
function Trig_CtD_Func2 takes nothing returns nothing
local unit a = GetTriggerUnit()
local unit b = GetEnumUnit()
local lightning light
call AddLightningLoc( "AFOD", GetUnitLoc(a), GetUnitLoc(b) )
set light = GetLastCreatedLightningBJ()
call UnitDamageTargetBJ( a, b, 350.00, ATTACK_TYPE_NORMAL,
DAMAGE_TYPE_DEATH )
call DestroyLightning(light)
endfunction
function Trig_CtD_Actions takes nothing returns nothing
local unit a = GetTriggerUnit()
local integer loopv = 0
local group temp
if ( GetUnitAbilityLevel( a, 'A00N') == 1 ) the
set loopv = 1
loop
exitwhen loopv > 10
if ( IsUnitAliveBJ(a) == false ) then
set loopv = 10
else
set temp = GetRandomSubGroup(1, GetUnitsInRangeOfLocMatching(800.00, GetUnitLoc(a), Condition(function Trig_CtD_Func1) ) )
call ForGroup( temp, function Trig_CtD_Func2 )
endif
endloop
else
if ( GetUnitAbilityLevel( a, 'A00N') == 1 ) then
set loopv = 1
loop
exitwhen loopv > 20
if ( IsUnitAliveBJ(a) == false ) then
set loopv = 10
else
set temp = GetRandomSubGroup(1, GetUnitsInRangeOfLocMatching(800.00, GetUnitLoc(a), Condition(function Trig_CtD_Func1) ) )
call ForGroup( temp, function Trig_CtD_Func2 )
endif
endloop
else
if ( GetUnitAbilityLevel( a, 'A00N') == 1 ) then
set loopv = 1
loop
exitwhen loopv > 30
if ( IsUnitAliveBJ(a) == false ) then
set loopv = 10
else
set temp = GetRandomSubGroup(1, GetUnitsInRangeOfLocMatching(800.00, GetUnitLoc(a), Condition(function Trig_CtD_Func1) ) )
call ForGroup( temp, function Trig_CtD_Func2 )
endif
endloop
endif
endif
endif
endfunction
function InitTrig_CtD takes nothing returns nothing
set gg_trg_CtD = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_CtD, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_CtD, Condition( function Trig_CtD_Conditions ) )
call TriggerAddAction( gg_trg_CtD, function Trig_CtD_Actions )
endfunction
Leaks 2 locationscall AddLightningLoc( "AFOD", GetUnitLoc(a), GetUnitLoc(b) )
Leaks 1 location, 1 group and 1 Condition Functionset temp = GetRandomSubGroup(1, GetUnitsInRangeOfLocMatching(800.00, GetUnitLoc(a), Condition(function Trig_CtD_Func1) ) )
function Trig_CtD_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00N'
endfunction
function Trig_CtD_Func1 takes nothing returns boolean
return GetBooleanAnd((UnitHasBuffBJ(GetFilterUnit(), 'B002') == true), (IsUnitAliveBJ(udg_Caster_Unit) == true))
endfunction
function Trig_CtD_Func2 takes nothing returns nothing
local unit tmp = GetEnumUnit()
local unit q = GetSpellAbilityUnit()
local lightning A
call AddLightning("AFOD", True, GetX(q), GetY(a), GetX(tmp), GetY(tmp)
set A = GetLastCreatedLightningBJ()
call UnitDamageTargetBJ( q, tmp, 350.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DEATH )
call DestroyLightning(A)
endfunction
function Trig_CtD_Actions takes nothing returns nothing
local unit a = GetSpellAbilityUnit()
local integer loopv = 0
local group temp
set udg_Caster_Unit = GetSpellAbilityUnit()
if ( GetUnitAbilityLevel( a, 'A00N') == 1 ) then
set loopv = 1
loop
exitwhen loopv > 10
if ( IsUnitAliveBJ(a) == false ) then
set loopv = 10
else
set temp = GetRandomSubGroup(1, GetUnitsInRangeOfLocMatching(800.00, GetUnitLoc(a), Condition(function Trig_CtD_Func1) ) )
call ForGroup( temp, function Trig_CtD_Func2 )
set loopv = loopv + 1
endif
endloop
else
if ( GetUnitAbilityLevel( a, 'A00N') == 1 ) then
set loopv = 1
loop
exitwhen loopv > 20
if ( IsUnitAliveBJ(a) == false ) then
set loopv = 10
else
set temp = GetRandomSubGroup(1, GetUnitsInRangeOfLocMatching(800.00, GetUnitLoc(a), Condition(function Trig_CtD_Func1) ) )
call ForGroup( temp, function Trig_CtD_Func2 )
set loopv = loopv + 1
endif
endloop
else
if ( GetUnitAbilityLevel( a, 'A00N') == 1 ) then
set loopv = 1
loop
exitwhen loopv > 30
if ( IsUnitAliveBJ(a) == false ) then
set loopv = 10
else
set temp = GetRandomSubGroup(1, GetUnitsInRangeOfLocMatching(800.00, GetUnitLoc(a), Condition(function Trig_CtD_Func1) ) )
call ForGroup( temp, function Trig_CtD_Func2 )
set loopv = loopv + 1
endif
endloop
endif
endif
endif
endfunction
//===========================================================================
function InitTrig_CtD takes nothing returns nothing
set gg_trg_CtD = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_CtD, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_CtD, Condition( function Trig_CtD_Conditions ) )
call TriggerAddAction( gg_trg_CtD, function Trig_CtD_Actions )
endfunction
Could be replaced by making a local unit.set udg_Caster_Unit = GetSpellAbilityUnit()
thats the way im trying to learn jass, by experimating etc. and i dont think this statment helps in any wayPlease learn jass before attempting something like this, you might find that helps.