• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[JASS] What is wrong with this [JASS] function (different one :P)?

Status
Not open for further replies.
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.
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?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Because it makes a group that you do not destroy?

You add code to display text at certain parts of your script. If the code does not display, then that part is not working (it does not run that code), if they all do display, you know you are not doing something right with certain parts of the script.
 
Status
Not open for further replies.
Top