Name | Type | is_array | initial_value |
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
library PathingColor requires PathingLib
/*
Pathing Color v1.5
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Pathing may generate color based on their characteristics.
If the pathing is not walkable, it will have red color. If
the pathing is not buildable, it will have blue color. And
if the pathing is not flyable, it will have green color.
The rests are just combinations between these colors.
Here is the summary to ease everything: (o = yes, x = no)
Color Buildable Walkable Flyable Red Green Blue
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
White x x x 255 255 255
Magenta x x o 255 0 255
Cyan x o x 0 255 255
Blue x o o 0 0 255
Yellow o x x 255 255 0
Red o x o 255 0 0
Green o o x 0 255 0
Black o o o 0 0 0
(You can check your pathing map by pressing 'p' at terrain editor)
API
¯¯¯
| function GetTerrainPathingColor takes real x, real y returns integer
(Constants)
| PATHING_COLOR_WHITE
| PATHING_COLOR_MAGENTA
| PATHING_COLOR_CYAN
| PATHING_COLOR_BLUE
| PATHING_COLOR_YELLOW
| PATHING_COLOR_RED
| PATHING_COLOR_GREEN
| PATHING_COLOR_BLACK
*/
globals
constant integer PATHING_COLOR_WHITE = 0
constant integer PATHING_COLOR_MAGENTA = 1
constant integer PATHING_COLOR_CYAN = 2
constant integer PATHING_COLOR_BLUE = 3
constant integer PATHING_COLOR_YELLOW = 4
constant integer PATHING_COLOR_RED = 5
constant integer PATHING_COLOR_GREEN = 6
constant integer PATHING_COLOR_BLACK = 7
endglobals
function GetTerrainPathingColor takes real x, real y returns integer
local integer color = 0
if IsTerrainFlyable(x, y) then
set color = color + 1
endif
if IsTerrainWalkable(x, y) then
set color = color + 2
endif
if IsTerrainBuildable(x, y) then
set color = color + 4
endif
return color
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope test initializer onInit
globals
private string array PathingColor
endglobals
private function display takes nothing returns nothing
local real x = GetUnitX(gg_unit_hfoo_0001)
local real y = GetUnitY(gg_unit_hfoo_0001)
call ClearTextMessages()
// Get pathing color
call BJDebugMsg(PathingColor[GetTerrainPathingColor(x, y)] + "Pathing Color at (" + R2S(x) + ", " + R2S(y) + ")|r")
// Check is x, y flyable
if IsTerrainFlyable(x, y) then
call BJDebugMsg("Flyable: true")
else
call BJDebugMsg("Flyable: false")
endif
// Check is x, y walkable
if IsTerrainWalkable(x, y) then
call BJDebugMsg("Walkable: true")
else
call BJDebugMsg("Walkable: false")
endif
// Check is x, y buildable
if IsTerrainBuildable(x, y) then
call BJDebugMsg("Buildable: true")
else
call BJDebugMsg("Buildable: false")
endif
endfunction
private function onInit takes nothing returns nothing
//call FogEnable(false)
//call FogMaskEnable(false)
call TimerStart(CreateTimer(), 0.03125, true, function display)
set PathingColor[PATHING_COLOR_BLACK] = "|CFF000000"
set PathingColor[PATHING_COLOR_BLUE] = "|CFF0000FF"
set PathingColor[PATHING_COLOR_RED] = "|CFFFF0000"
set PathingColor[PATHING_COLOR_MAGENTA] = "|CFFFF00FF"
set PathingColor[PATHING_COLOR_GREEN] = "|CFF00FF00"
set PathingColor[PATHING_COLOR_CYAN] = "|CFF00FFFF"
set PathingColor[PATHING_COLOR_YELLOW] = "|CFFFFFF00"
set PathingColor[PATHING_COLOR_WHITE] = "|CFFFFFFFF"
endfunction
endscope