Hey guys! I only just started learning JASS following some tutorials on this site (probs to all the creators).
Now I am trying to create a custom spell, it is supposed to be a howl that decreases armor, movement speed and attack speed of all enemy units in a certain radius around the caster. My approach was to create the spell "Intimidating Howl" that spawns a dummy at the caster's location, which is then equipped with two custom spells that I created, based on faeriefire (to reduce the armor) and slow (to reduce movement and attack speed). I am trying to let the dummy cast both these spells on all enemy units around him.
Now the problem is, that they only get cast on a single target, unless I insert a
after the spell order. That however delays the spells, I would like them to be simultaneously cast on all targets. How can I fix my problems? The code is as follows:
Now I am trying to create a custom spell, it is supposed to be a howl that decreases armor, movement speed and attack speed of all enemy units in a certain radius around the caster. My approach was to create the spell "Intimidating Howl" that spawns a dummy at the caster's location, which is then equipped with two custom spells that I created, based on faeriefire (to reduce the armor) and slow (to reduce movement and attack speed). I am trying to let the dummy cast both these spells on all enemy units around him.
Now the problem is, that they only get cast on a single target, unless I insert a
Code:
call TriggerSleepAction(0.1)
Code:
function WolfIntimidatingHowl_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A004'
endfunction
function WolfIntimidatingHowl_Actions takes nothing returns nothing
//call BJDebugMsg("Entered Howl Actions")
local unit caster = GetSpellAbilityUnit()
local group targets = CreateGroup()
local unit current_target
local location caster_location = GetUnitLoc(caster)
local unit dummy
local real radius = 600.0
local effect castEffect
set castEffect = AddSpecialEffectLoc("Abilities\\Spells\\Other\\HowlOfTerror\\HowlCaster.mdl", caster_location)
call GroupEnumUnitsInRangeOfLoc(targets, caster_location, radius, null)
set dummy = CreateUnitAtLoc(GetOwningPlayer(caster), 'h000', caster_location, 0.)
call UnitAddAbility(dummy, 'A002')
call UnitAddAbility(dummy, 'A003')
loop
set current_target = FirstOfGroup(targets)
exitwhen current_target == null
if IsUnitEnemy(current_target, GetOwningPlayer(caster)) then
call IssueTargetOrder(dummy, "faeriefire", current_target)
call TriggerSleepAction(0.0001)
call IssueTargetOrder(dummy, "slow", current_target)
call TriggerSleepAction(0.0001)
endif
call GroupRemoveUnit(targets, current_target)
endloop
call DestroyEffect(castEffect)
call RemoveLocation(caster_location)
call DestroyGroup(targets)
call RemoveUnit(dummy)
set castEffect = null
set caster = null
set targets = null
set current_target = null
set caster_location = null
set dummy = null
endfunction
function InitTrig_WolfIntimidatingHowl takes nothing returns nothing
set gg_trg_WolfIntimidatingHowl = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_WolfIntimidatingHowl, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_WolfIntimidatingHowl, Condition(function WolfIntimidatingHowl_Conditions))
call TriggerAddAction(gg_trg_WolfIntimidatingHowl, function WolfIntimidatingHowl_Actions)
endfunction