Snippet IsPositionPathable

Andrewgosu

The Silent Pandaren Helper
Reaction score
716

Cohadar

master of fugue
Reaction score
209
Will this return false if there is some unit on a normally pathable location?
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
Perhaps group all units in a certain radius around the x,y coordinates and set off their collision? And then set it on after for sure. Since there are no waits it shouldn't be a problem at all or?
 

emjlr3

Change can be a good thing
Reaction score
395
looks neat, but i do think it could bug if there is a unit there already, but then, i guess it would not be pathable then either :p
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
So far it works as designed (please, prove me wrong. I know it can be done).

A tree, doodad or a unit, not to mention a cliff, is in the way - BOOM!

False.
 

emjlr3

Change can be a good thing
Reaction score
395
what unit is 'hfoo'?
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
Just a regular footman, though, I can be replaced with anything.

The check is instant, so the "dummy" unit is never seen.
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
So far it works as designed (please, prove me wrong. I know it can be done).

A tree, doodad or a unit, not to mention a cliff, is in the way - BOOM!

False.

Hmmm but still... most spells or whatever don't care if a UNIT is blocking the way, therefore people must add some stuff to avoid it. Idea behind is fine though and since it seems to work (did you test?) why not :s
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
Why not make a test map that proved everything that is stucking in the way return false?
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
The test maps shows that the function will return false, if a unit, destructible or a cliff is on the way.

It worked...
 

Attachments

  • IsPositionPathable_Andrewgosu_2008.w3x
    10.2 KB · Views: 320

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
http://www.wc3jass.com/viewtopic.php?t=2374

Read the comments on that system.

If a unit is created in a region that is unpathable due to doodads, it will stil be created there as a stuck unit. Creating a second unit on top of the first and checking whether the X and Y are the same as unit 1 fixes this. (Since then it would indeed be a "stuck" loacation since one unit got created ontop of another one, which normally can't happen)


Vexorian uses items with an enum, here's why:
If the reason the test item wasn't in the right spot is because there's an item already there, then the terrain is pathable.

This will solve the "pathable, but another unit was in the way..." issue
 

emjlr3

Change can be a good thing
Reaction score
395
if a unit is in the way its not pathable is it?, in which case, you could check to see if its a unit in that loc, and return a boolean
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
What if you want to use a custom blink, surely you'd want the unit to actually blink, but instead of landing ontop of the other unit, you'd be landing next to it...
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
On top of the unit sounds worse than next to it.

I am sure this snippet(*) works 99 times out of 100, when used on a normal map, not some kind of monstrosity with no pathable places at all.


(*)Yes, a snippet.

Not an overly complicated system.
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
JASS:
library PathingFuncs initializer init
    globals
        private constant real ItemSafeX = 0. //This is the X coordinate of a point that nobody can get to on your map.
        private constant real ItemSafeY = 0. //This is the Y coordinate of the same point. It's to keep from having hidden
        private item I                       //item errors, such as comps picking them up, etc.
        private unit U
    endglobals

    function IsPointPathable takes real x, real y, boolean evalunits returns boolean
        local boolean b
        if(evalunits)then
            call ShowUnit(U,true)
            call SetUnitPosition(U,x,y)
            set b=GetUnitX(U)==x and GetUnitY(U)==y
            call ShowUnit(U,false)
        else
            call SetItemVisible(I,true)
            call SetItemPosition(I,x,y)
            set b=GetItemX(I)==x and GetItemY(I)==y
            call SetItemPosition(I,ItemSafeX,ItemSafeY)
            call SetItemVisible(I,false)
        endif
        return b
    endfunction
    
    private function init takes nothing returns nothing
        set I=CreateItem('ward',ItemSafeX,ItemSafeY)
        call SetItemInvulnerable(I,true)
        call SetItemVisible(I,false)
        set U=CreateUnit(Player(15),'hfoo',ItemSafeX,ItemSafeY,0.)
        call SetUnitInvulnerable(U,true)
        call ShowUnit(U,false)
    endfunction
endlibrary
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
I've made my own stuff yesterday because I needed something that doesn't count orgranic units [btw, how is the unit state orgranic/living (no structure^^) called in JASS? I didn't figure it out and took mechanic == false :O].

So I groupenum units in a certain range of the targeted point and turn off their collision and afterwards turn it on again.
An other problem was that the reals were always slightly different so that the function returned false always. Hence I converted the reals to integers and back again, which worked.
Dunno if i needn't do this with items though :S

This is what fit my purposes ;S
JASS:
library Pathability

function FiltLiving takes nothing returns boolean
    return IsUnitType(GetFilterUnit(),UNIT_TYPE_MECHANICAL) == false
endfunction

function PathOff takes nothing returns nothing
    call SetUnitPathing(GetEnumUnit(),false)
endfunction

function PathOn takes nothing returns nothing
    call SetUnitPathing(GetEnumUnit(),true)
endfunction

function IsPositionPathable takes real x, real y, integer radius returns boolean // radius to define the AOE around the location
local boolean flag                                                               // in which the units collision shall be turned off
local real xnew  = I2R(R2I(x))
local real ynew = I2R(R2I(y))
local group g = CreateGroup()
local unit tester
    call GroupEnumUnitsInRange(g,x,y,radius,Filter(function FiltLiving))
    call ForGroup(g, function PathOff)
    set tester = CreateUnit(Player(15), 'hmtm', xnew, ynew, 0)
    set flag = (GetUnitX(tester) == xnew) and (GetUnitY(tester) == ynew)
    call RemoveUnit(tester)
    call ForGroup(g, function PathOn)
    call DestroyGroup(g)
    set g = null
    set tester = null
    return flag
endfunction

endlibrary
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
  • The Helper The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top