• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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