- Joined
- Sep 3, 2006
- Messages
- 940
I'm making an AoE spell that pushes all units within range of the caster away. I think this function should do the trick, but nothing happens. Nothing at all.
PS: "SPELL2_ID = A001"
What could be wrong with it?
JASS:
function QuakeFunction takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t
local real x1 = GetUnitX(c)
local real y1 = GetUnitY(c)
local real x2 = GetUnitX(t)
local real y2 = GetUnitY(t)
local location pc = GetUnitLoc(c)
local location pt = GetUnitLoc(t)
local real dist = 300
local real angle = Atan2(y2 - y1, x2 - x1)
local real dur = 1
local real radius = 100
local integer effects = 0
local string effectmdl = ""
local string effectpoint = ""
local group g = GetUnitsInRangeOfLocAll((150 * GetUnitAbilityLevelSwapped(SPELL2_ID, c)), pc)
call GroupRemoveUnit(g, c)
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = CountUnitsInGroup(GetUnitsInRangeOfLocAll(300.00, pc)) - 1
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set bj_forLoopAIndex = bj_forLoopAIndex + 1
set t = GroupPickRandomUnit(g)
//Knockback Effect
call KnockbackEx(t, dist, angle, dur, radius, effects, effectmdl, effectpoint)
call GroupRemoveUnit(g, t)
endloop
//Leak Fixes
set c = null
set t = null
set pc = null
set pt = null
endfunction
PS: "SPELL2_ID = A001"
What could be wrong with it?