(4 ratings)
library PathingLib
// Object generator
//! external ObjectMerger w3u hgry hPLF unsf "(PathingLib) FlyChecker" unam "" umdl ".mdl" ubdg 0 uabi "Aloc" uble 0 ulum 0 upoi 0 uico "" umxp 0 umxr 0 ussc 0 ushu "" ugol 0 uaen "" udea "" umvt "fly" usnd "" ufle 0 ufoo 0 uspe 1 uhom 1 urac "unknown" usid 0 usin 0 upgr "" uhot "" utip "" utub ""
//! external ObjectMerger w3u hfoo hPLW unsf "(PathingLib) WalkChecker" unam "" umdl ".mdl" ubdg 0 uabi "Aloc" uble 0 ulum 0 upoi 0 uico "" umxp 0 umxr 0 ussc 0 ushu "" ugol 0 uaen "" udea "" umvt "foot" ucol 0 usnd "" ufle 0 ufoo 0 uspe 1 uhom 1 urac "unknown" usid 0 usin 0 upgr "" uhot "" utip "" utub ""
//! external ObjectMerger w3u hhou hPLB unsf "(PathingLib) BuildChecker" unam "" umdl ".mdl" ubdg 1 uabi "Aloc" upat "" ulum 0 upoi 0 uubs "" uble 0 ushb "" uico "" ugol 0 ufma 0 umxp 0 ubsl "" umxr 0 ussc 0 ushu "" uaen "" udea "" umvt "" ucol 0 usnd "" ufle 0 ufoo 0 uspe 1 uhom 1 urac "unknown" usid 0 usin 0 upgr "" uhot "" utip "" utub ""
//! external ObjectMerger w3u hpea hPLP unsf "(PathingLib) PathChecker" unam "" umdl ".mdl" ubdg 0 uabi "Aloc" uble 0 ubui "hPLF,hPLW,hPLB" ulum 0 upoi 0 uico "" umxp 0 umxr 0 ussc 0 ushu "" ugol 0 uaen "" udea "" umvt "foot" ucol 0 usnd "" ufle 0 ufoo 0 uspe 1 uhom 1 urac "unknown" usid 0 usin 0 upgr "" uhot "" utip "" utub ""
// Configuration
globals
private constant integer PATH_CHECKER = 'hPLP'
private constant integer FLY_CHECKER = 'hPLF'
private constant integer WALK_CHECKER = 'hPLW'
private constant integer BUILD_CHECKER = 'hPLB'
private constant player DUMMY_PLAYER = Player(15)
endglobals
/*
Pathing Library v1.6
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Description
¯¯¯¯¯¯¯¯¯¯¯
Allows you to detect all pathability types:
walkablility, flyability, and buildability.
Warning!
Please keep informed that this system is more sensitive than
any other walkability checker systems out there, as it also
detects pathing map generated by normal units as well.
API
¯¯¯
| function IsTerrainFlyable takes real x, real y returns boolean
| function IsTerrainWalkable takes real x, real y returns boolean
| function IsTerrainBuildable takes real x, real y returns boolean
How to import
¯¯¯¯¯¯¯¯¯¯¯¯¯
- Copy Fly, Walk, Build, and Path Checker at object editor (Unit).
- Make sure Path Checker is able to build Fly, Walk, and Build Checker
(at object editor>unit>Path Checker>"Techtree - Structures built")
- Configure this system correctly.
Link: hiveworkshop.com/forums/spells-569/pathing-type-v1-2-a-263230/
*/
globals
private unit PathChecker
endglobals
function IsTerrainFlyable takes real x, real y returns boolean
return IssueBuildOrderById(PathChecker, FLY_CHECKER, x, y)
endfunction
function IsTerrainWalkable takes real x, real y returns boolean
return IssueBuildOrderById(PathChecker, WALK_CHECKER, x, y)
endfunction
function IsTerrainBuildable takes real x, real y returns boolean
return IssueBuildOrderById(PathChecker, BUILD_CHECKER, x, y)
endfunction
private module Init
private static method onInit takes nothing returns nothing
call init()
endmethod
endmodule
private struct InitStruct extends array
private static method init takes nothing returns nothing
set PathChecker = CreateUnit(DUMMY_PLAYER, PATH_CHECKER, 0, 0, 0)
call UnitRemoveAbility(PathChecker, 'Amov')
call ShowUnit(PathChecker, false)
if GetLocalPlayer() == DUMMY_PLAYER then
call FogEnable(false)
endif
endmethod
implement Init
endstruct
endlibrary
UNUSED_PLAYER
is not the best name in my eyes.What did I just saw ?
Hey Quilnez, this seems to be a great system - thanks for this.
group enum units in the place that the tile is unwalkable, that will give you exact unit, if any(if none, its some kind of destructable)
function GetTerrainPathingColor takes real x, real y returns integer
library PathingLib
// Configuration
globals
private constant integer PATH_CHECKER = 'h000'
private constant integer FLY_CHECKER = 'h001'
private constant integer WALK_CHECKER = 'h002'
private constant integer BUILD_CHECKER = 'h003'
private constant player DUMMY_PLAYER = Player(15)
endglobals
/*
Pathing Library v1.4
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
by: Quilnez aka Dalvengyr
Description
¯¯¯¯¯¯¯¯¯¯¯
This library allows you to detect all pathability types:
walkablility, flyability, and buildability.
Warning!
Please keep informed that this system is more sensitive than
any other walkability checker systems out there, as it also
detects pathing map generated by normal units as well.
(You can check your pathing map by pressing 'p' at terrain editor.)
API
¯¯¯
// this is difficult to read with the description coming before the function
// normally the functions are listed with tabbed descriptions. This is common in
// all forms of professional documentation.
1. Used for checking certain point's flyability
| function IsTerrainFlyable takes real x, real y returns boolean
2. Used for checking certain point's walkability.
| function IsTerrainWalkable takes real x, real y returns boolean
3. Used for checking certain point's buildability.
| function IsTerrainBuildable takes real x, real y returns boolean
How to import
¯¯¯¯¯¯¯¯¯¯¯¯¯
- Copy Fly, Walk, Build, and Path Checker (units) at object editor.
- Make sure Path Checker is able to build Fly, Walk, and Build Checker
(at object editor>unit>Path Checker>"Techtree - Structures built")
- Configure this system (available above).
Credits
¯¯¯¯¯¯¯
- PurgeandFire for pathability checking method.
- TheHelper.net for complete pathing types tutorial.
Link
¯¯¯¯
hiveworkshop.com/forums/spells-569/pathing-type-v1-2-a-263230/
*/
globals
// should be pathChecker
private unit PathChecker
endglobals
function IsTerrainFlyable takes real x, real y returns boolean
return IssueBuildOrderById(PathChecker, FLY_CHECKER, x, y)
endfunction
function IsTerrainWalkable takes real x, real y returns boolean
return IssueBuildOrderById(PathChecker, WALK_CHECKER, x, y)
endfunction
function IsTerrainBuildable takes real x, real y returns boolean
return IssueBuildOrderById(PathChecker, BUILD_CHECKER, x, y)
endfunction
// Init library here if this is ugly -> github.com/nestharus/JASS/blob/master/jass/Systems/Init/script.j
private module Init
private static method onInit takes nothing returns nothing
call init()
endmethod
endmodule
private struct InitStruct extends array
private static method init takes nothing returns nothing
// should disable whatever Unit Indexing library before creating this unit
set PathChecker = CreateUnit(DUMMY_PLAYER, PATH_CHECKER, 0, 0, 0)
call UnitRemoveAbility(PathChecker, 'Amov')
call ShowUnit(PathChecker, false)
// is this line necessary? I really don't know.
if GetLocalPlayer() == DUMMY_PLAYER then
call FogEnable(false)
endif
endmethod
implement Init
endstruct
endlibrary
Quite inappropriate.while I dont take your opinion out, you are almost like Nazi. "Making it the standard"
How sensitive is IsTerrainWalkable? For better understanding the word sensitive is used
to describe a true positive result.
In other words, what is the closest point to an unwalkable point returning IsWalkable?
If I remember correctly the minimum collision size was something like 8.
Let's say (0,0) is not walkable. Will IsTerrainWalkable(1, 0) return true or false?
Or is the closest point (9, 0)?
Yeah, it detects pathing map generated by normal units as well, unlike PnF's. That's why I call it "sensitive". I couldn't use this in my spell either because of that.![]()
Suggestion: Maybe removing the collisions of all units in the search area and then setting it back would work?
Someone else uses the Blink ability.
private module Init
private static method onInit takes nothing returns nothing
call init()
endmethod
endmodule
private struct InitStruct extends array
private static method init takes nothing returns nothing
set PathChecker = CreateUnit(DUMMY_PLAYER, PATH_CHECKER, 0, 0, 0)
call UnitRemoveAbility(PathChecker, 'Amov')
call ShowUnit(PathChecker, false)
if GetLocalPlayer() == DUMMY_PLAYER then
call FogEnable(false)
endif
endmethod
implement Init
endstruct
What exactly was the issue with the library initializer btw? The new solution seems super convoluted and I don't see the point in it.
private static method onInit
) and then all its children's struct initializers.Also, any ideas on how to fix the unit sensitivity problem? You lib is the only one I've seen so far that takes destructables into account, but this thing also reacting to units makes it kinda unusable for missile or knockback systems.
// Object generator
//! external ObjectMerger w3u hgry hPLF unsf "(PathingLib) FlyChecker" unam "" umdl ".mdl" ubdg 0 uabi "Aloc" uble 0 ulum 0 upoi 0 uico "" umxp 0 umxr 0 ussc 0 ushu "" ugol 0 uaen "" udea "" umvt "fly" usnd "" ufle 0 ufoo 0 uspe 1 uhom 1 urac "unknown" usid 0 usin 0 upgr "" uhot "" utip "" utub ""
//! external ObjectMerger w3u hfoo hPLW unsf "(PathingLib) WalkChecker" unam "" umdl ".mdl" ubdg 0 uabi "Aloc" uble 0 ulum 0 upoi 0 uico "" umxp 0 umxr 0 ussc 0 ushu "" ugol 0 uaen "" udea "" umvt "foot" ucol 0 usnd "" ufle 0 ufoo 0 uspe 1 uhom 1 urac "unknown" usid 0 usin 0 upgr "" uhot "" utip "" utub ""
//! external ObjectMerger w3u hhou hPLB unsf "(PathingLib) BuildChecker" unam "" umdl ".mdl" ubdg 1 uabi "Aloc" upat "" ulum 0 upoi 0 uubs "" uble 0 ushb "" uico "" ugol 0 ufma 0 umxp 0 ubsl "" umxr 0 ussc 0 ushu "" uaen "" udea "" umvt "" ucol 0 usnd "" ufle 0 ufoo 0 uspe 1 uhom 1 urac "unknown" usid 0 usin 0 upgr "" uhot "" utip "" utub ""
//! external ObjectMerger w3u hpea hPLP unsf "(PathingLib) PathChecker" unam "" umdl ".mdl" ubdg 0 uabi "Aloc" uble 0 ubui "hPLF,hPLW,hPLB" ulum 0 upoi 0 uico "" umxp 0 umxr 0 ussc 0 ushu "" ugol 0 uaen "" udea "" umvt "foot" ucol 0 usnd "" ufle 0 ufoo 0 uspe 1 uhom 1 urac "unknown" usid 0 usin 0 upgr "" uhot "" utip "" utub ""
Oh, I see. Thx you. But since his demo map already has modified object editor with units named FlyChecker; WalkChecker and etc. I suggest I can easily remove those lines from library, copy and paste his units from Object Editor, and that's it, I just copied them and it should work fine?There is zero good reason to be on patch 1.26 any more. Please update your game; it's literally free.
This is old code that can no longer run in the modern WE because //! external calls are now deprecated. Those lines create units in the Object Editor. You can do what they do manually by going word-by-word and matching up what that means you should change. Things always come in pairs just like when editing spell data with triggers:
See how you can walk through the list? You just need to recreate them all yourself as they are specified by the OM calls. Press Ctrl + D while in the Object Editor to see each field by its raw name rather than the verbose names for each field (unam vs "Unit Name").
- ObjectMerger w3u ---> OM is making a unit
- hgrp hPLF ---> based on unit 'hgrp' it has the new custom rawcode 'hPLF'
- unsf "(PathingLib) FlyChecker" ---> it has that as a suffix
- unam "" ---> the field unam (name) has the value "" (empty string)
- umdl ".mdl" ---> it has a model file of ".mdl"
loop
set X = GetRandomReal(GetRectMinX(bj_mapInitialPlayableArea), GetRectMaxX(bj_mapInitialPlayableArea))
set Y = GetRandomReal(GetRectMinY(bj_mapInitialPlayableArea), GetRectMaxY(bj_mapInitialPlayableArea))
exitwhen IsTerrainWalkable(X, Y)
endloop