Hello, this is my first spell after reading some JASS tuts but it wont work at all. What am I doing wrong?
The point of the spell is to get the units in range and summon a unit that is the same type as the picked unit in range (dont know if i worded that right).
But the spell is almost completely unresponsive.
The point of the spell is to get the units in range and summon a unit that is the same type as the picked unit in range (dont know if i worded that right).
But the spell is almost completely unresponsive.
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
Last edited: