Is there a way to detect

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
Is there a way to detect if a unit cannot be created\reach on\to a certain location?
example: a wall in the way,water,some unwalkable terrain and etc'.
thanks in advance :)
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
what about checking if a wall\unit\destructible\doodad is ditrupting?
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
You can't check if it is water either afaik.

Yes, but you can check the surface under it...


I have this crazy idea, ludicrous.

Hear me out...quietly.


When a unit is created onto a position, which is blocked, it gets moved to the nearest unblocked position...

JASS:
function IsPositionPathable takes real x, real y returns boolean
    local unit test = CreateUnit(Player(15), 'hfoo', x, y, 0)
    if (GetUnitX(test) == x) and (GetUnitY(test) == y) then
        call RemoveUnit(test)
        set test = null       
        return true
    endif
    call RemoveUnit(test)
    set test = null
    return false
endfunction


It's crazy enough to work!
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
Andrew that's actually a good way thanks again i shall try it out and i will see the results of it :)
+Rep for all the helpers :p
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
k i tried it now i even added a few more thing such as unit with locust and such:
JASS:
function IsPositionPathable takes real x, real y returns boolean
    local boolean flag
    local unit u
    set u = CreateUnit(Player(15), 'n000', x, y, 0)
    call SetUnitX(u,x)
    call SetUnitY(u,y)
    set flag = (GetUnitX(u) == x) and (GetUnitY(u) == y)
    call RemoveUnit(u)
    return flag
endfunction

it works about the parts it shouldn't be working but at the parts where it should work it's not always working for some reason....
got any clue what might be wrong?
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
The fact you are using 'Locust', "SetUnitX" and "SetUnitX" functions?

"SetUnitX"
and "SetUnitX" ignore pathing. You do not want that.

Just use the function I posted, unaltered.
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
without the SetUnitX it works even worse i tried it before - that's why i added it
also i could try set location functions
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
sorry for the double post but something is wrong with the system:
it works only on some of the things - for example: on gates and barrels it worked but the tree didn't work for this check....
anyway to solve this one?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top