• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Help with jass (condition)

Status
Not open for further replies.
Level 11
Joined
May 31, 2008
Messages
698
JASS:
function PushCond takes nothing returns boolean
    local real ex = GetUnitX(GetFilterUnit())
    local real ey = GetUnitY(GetFilterUnit())
    local real a = bj_RADTODEG * Atan2(ey - y, ex - x)
    local real pap = anglePusher + 45
    local real pam = anglePusher - 45
    set anglePushed = a
    return true
    if (pusher != GetFilterUnit()) and (IsUnitInGroup(pusher, pushGroup) == false) and ((a > pam) and (a < pap)) then 
        return true
    else
        return false
    endif
endfunction

Okay, so this seems to be a problem in my code. I narrowed it down by testing like this:
This worked:
JASS:
    call SetUnitPosition(pusher, 0, 0)
call GroupEnumUnitsInRange(units, x, y, r, Condition(function PushCond))

But this didnt:
JASS:
    call GroupEnumUnitsInRange(units, x, y, r, Condition(function PushCond))
    call SetUnitPosition(pusher, 0, 0)

So im pretty sure i made a mistake in the condition and my code wont go past it for some reason
How can i fix it?

And what im trying to do is make it so when a unit runs into another unit, it will push it forward

Edit:
Actually, even when i delete everything in the condition or do "call ForGroup(units, function PushSetup)" with PushSetup having nothing in it, it still doesnt move the units if its after i call one of the group functions :(
Maybe im just missing something? lol i havent done jass in a while


This is solved!
EDIT AGAIN:
Okay i think i solved this on my own lol
in globals I did
JASS:
group units
instead of
JASS:
group units = CreateGroup()

lol i feel so dumb

SOLVED!
 
Status
Not open for further replies.
Top