Hi, i just browsed through some tutorials and decided I was ready to make my own crappy spell. However, it won't work. What did I do wrong?
apart from the answer, constructive critisism would be nice (like i even have to ask for it here)
JASS:
function SummonSpell_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A001'
endfunction
function SummonSpell_Actions takes nothing returns nothing
local unit temp //the target
local location target_loc = GetUnitLoc(temp) //the target location
local integer i = 0 //my loop integer
local group enemies = CreateGroup() //the selected group in range
local unit caster = GetTriggerUnit() //the caster, of course
local location start_position = GetUnitLoc( caster ) //obviously the caster location
local unit S_created //My Summoned Unit
call GroupEnumUnitsInRangeOfLoc(enemies, start_position, 1000.0, null)
loop
exitwhen i > 10
set temp = FirstOfGroup(enemies)
if IsUnitEnemy(temp, GetTriggerPlayer()) then
call SetUnitFacingToFaceLocTimed(caster, target_loc, 0.20)
set S_created = CreateUnitAtLoc(GetTriggerPlayer() , GetUnitTypeId(temp), target_loc, 0.00)
call SetUnitTimeScale(S_created, 25.0)
call SetUnitVertexColor(S_created, 255, 0, 0, 30)
call SetUnitAnimation( caster, "attack" )
set i = i - 1
endif
call GroupRemoveUnit(enemies, temp)
endloop
endfunction
function InitTrig_SummonSpell takes nothing returns nothing
set gg_trg_SummonSpell = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_SummonSpell, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_SummonSpell, Condition(function SummonSpell_Condition))
call TriggerAddAction(gg_trg_SummonSpell, function SummonSpell_Actions)
endfunction