Well, im not so good jasser, so im asking you to help me. This spells summons x units and then it should order them to attack target of ability being cast and get removed after x time, though they dont get removed, they dont even attack the target, just random units.
JASS:
function Trig_Ancestral_Call_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00G'
endfunction
function Trig_Ancestral_Call_Actions takes nothing returns nothing
local unit a = GetSpellAbilityUnit()
local group g
local integer i=0
local unit pickedunit
set g = CreateGroup()
loop
set i = i + 1
exitwhen i > GetUnitAbilityLevelSwapped('A00G', a)
call GroupAddUnit(g, CreateUnit(GetOwningPlayer(a) , 'oshm', GetUnitX(a) , GetUnitY(a) , 0))
call IssueTargetOrder( GetLastCreatedUnit(), "attack", GetSpellTargetUnit() )
endloop
call PolledWait(0.50)
loop
exitwhen FirstOfGroup(g) == null
set pickedunit = FirstOfGroup(g)
call RemoveUnit(pickedunit)
call GroupRemoveUnit(g, pickedunit)
set pickedunit=null
endloop
endfunction
//===========================================================================
function InitTrig_Ancestral_Call takes nothing returns nothing
set gg_trg_Ancestral_Call = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ancestral_Call, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Ancestral_Call, Condition( function Trig_Ancestral_Call_Conditions ) )
call TriggerAddAction( gg_trg_Ancestral_Call, function Trig_Ancestral_Call_Actions )
endfunction