MASS EDIT:
Hi. So basicly I'm writing a collision check which uses GroupEnumUnitsInRange() with a filterfunc. Here is my filter:
Now the math denotes that unless the filter unit is between the 2 values it won't be added to the group. Later I count the units in the group and if it's greater than 0 then I register a collision EXCEPT that for some reason this filterfunc always returns true.
What have I missed?
Thankyou in advance and ofcourse rep if you are deserving.
I attached the map incase it helps. Beware! It is in a very early stage.
Please, any ideas why this filterfun returns true when it shouldn't?
Hi. So basicly I'm writing a collision check which uses GroupEnumUnitsInRange() with a filterfunc. Here is my filter:
JASS:
function Filter takes nothing returns boolean
local unit u = GetFilterUnit() // unit in area
local unit ut = udg_u[udg_i] // subject
local real yu = GetUnitFlyHeight(u)
local real yut = GetUnitFlyHeight(ut)
local real utp = yu + udg_yv[udg_i] + udg_ya // projected fly height
local boolean a = GetOwningPlayer(u) == Player(11)
local boolean b = yu >= yut and yu <= utp
local boolean c = yu <= yut and yu >= utp
local boolean d = b == true or c == true
local boolean e = d == true and a == true
set u = null
set ut = null
return e
endfunction
Now the math denotes that unless the filter unit is between the 2 values it won't be added to the group. Later I count the units in the group and if it's greater than 0 then I register a collision EXCEPT that for some reason this filterfunc always returns true.
What have I missed?
Thankyou in advance and ofcourse rep if you are deserving.
I attached the map incase it helps. Beware! It is in a very early stage.
Please, any ideas why this filterfun returns true when it shouldn't?
Attachments
Last edited by a moderator: