I have just created one of my first spells, i tried to remove all leaks but since its my first spell i don't know what leaks and what not. I also don't know if the following way is the best way to play a sound:
This is my trigger from my spell:
In short , the unit with Ether Pulse ability has a 10% chance on attack to create an ether pulse at target location, banishing all enemies in 300 range of target.
Thanks , if you take time and reply
(+ rep ofc)
JASS:
call PlaySoundAtPointBJ( gg_snd_detonate, 100, targetLoc, 0 )
call KillSoundWhenDone( GetLastPlayedSound())
This is my trigger from my spell:
JASS:
function Ether_Pulse_Conditions takes nothing returns boolean
return (( GetUnitAbilityLevelSwapped('A008', GetAttacker()) == 1 ) and ( GetRandomInt(1, 100) <= 10 ))
endfunction
function banishPickedUnit takes nothing returns nothing
local unit pickedUnit = GetEnumUnit()
local unit dummy = CreateUnitAtLoc( Player(0), 'h009', GetUnitLoc(pickedUnit), 270 )
call UnitAddAbility( dummy, 'A00P' )
call IssueTargetOrder( dummy, "banish", pickedUnit )
endfunction
function isGoodUnit takes nothing returns boolean
local unit pickedUnit = GetFilterUnit()
local player owner = GetOwningPlayer(pickedUnit)
return (( owner == Player(10) ) or (owner == Player(11)))
endfunction
function Trig_Ether_Pulse_Actions takes nothing returns nothing
local unit target = GetTriggerUnit()
local location targetLoc = GetUnitLoc(target)
local effect explode = AddSpecialEffectLoc("Units\\NightElf\\Wisp\\WispExplode.mdl", targetLoc)
local group targets = GetUnitsInRangeOfLocMatching(300, targetLoc, Condition(function isGoodUnit))
call ForGroup(targets, function banishPickedUnit)
call DestroyGroup(targets)
call DestroyEffect( explode )
call PlaySoundAtPointBJ( gg_snd_detonate, 100, targetLoc, 0 )
call KillSoundWhenDone( GetLastPlayedSound())
call RemoveLocation( targetLoc )
set target = null
endfunction
//===========================================================================
function InitTrig_Ether_Pulse takes nothing returns nothing
local trigger gg_trg_Ether_Pulse = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ether_Pulse, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Ether_Pulse, Condition( function Ether_Pulse_Conditions ) )
call TriggerAddAction( gg_trg_Ether_Pulse, function Trig_Ether_Pulse_Actions )
set gg_trg_Ether_Pulse = null
endfunction
Thanks , if you take time and reply
