Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
since there isnt jump system that checks for terrain pathability i decided to edit the one by paladon.i alreday managed to make it so before spell is casted the game will check if targeted point is walkable but next step i need is to check if point that 0.03 triger moves unit to is walkable
i found the 0.03 trigger the problem is i dont know how to make this all work with the current existing conditions because the one i have is customs cript. the spell should also end instantly with all leaks cleared if its not walkable @Uncle can you take a look if u have time
the first part before spell is casted i did like that
Make a boolean variable, name it "walkable" for example.
Then do a custom script like:
set udg_walkable = IsTerrainWalkable(GetLocationX(udg_myLoc), GetLocationY(myLoc))
then you can just check if walkable is true in gui.
Create an Item and store it in an Item variable called PathingChecker. Make the item Invulnerable and Hidden.
Then create a Script and paste this code into it:
vJASS:
function IsTerrainWalkable takes real x, real y returns boolean
local real dX
local real dY
call SetItemVisible(udg_PathingChecker, true)
call SetItemPosition(udg_PathingChecker, x, y)
set dX = GetItemX(udg_PathingChecker)
set dY = GetItemY(udg_PathingChecker)
call SetItemVisible(udg_PathingChecker, false)
// adjust 10 to modify the distance that's considered pathable
return (x - dX) * (x - dX) + (y - dY) * (y - dY) < 10 * 10
endfunction
function IsTerrainWalkableLoc takes location l returns boolean
local real x = GetLocationX(l)
local real y = GetLocationY(l)
local real dX
local real dY
call SetItemVisible(udg_PathingChecker, true)
call SetItemPosition(udg_PathingChecker, x, y)
set dX = GetItemX(udg_PathingChecker)
set dY = GetItemY(udg_PathingChecker)
call SetItemVisible(udg_PathingChecker, false)
// adjust 10 to modify the distance that's considered pathable
return (x - dX) * (x - dX) + (y - dY) * (y - dY) < 10 * 10
endfunction
This checks for Buildings, Doodads, Cliffs, Boundaries, etc. and will return True or False depending on whether the terrain is walkable or not.
How to use it in GUI:
Set Variable TempPoint = (Position of (Triggering unit))
Custom script: set udg_WalkableBoolean = IsTerrainWalkableLoc(udg_TempPoint)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
WalkableBoolean Equal to True
Then - Actions
-------- The terrain is walkable --------
Else - Actions
-------- The terrain is unwalkable --------
WalkableBoolean is a Boolean variable that you need to create. You can name it whatever you want, just make sure to update it's name in the Custom script if you change it.
Create an Item and store it in an Item variable called PathingChecker. Make the item Invulnerable and Hidden.
Then create a Script and paste this code into it:
vJASS:
function IsTerrainWalkable takes real x, real y returns boolean
local real dX
local real dY
SetItemVisible(udg_PathingChecker, true)
SetItemPosition(udg_PathingChecker, x, y)
dX = GetItemX(udg_PathingChecker)
dY = GetItemY(udg_PathingChecker)
SetItemVisible(udg_PathingChecker, false)
// adjust 10 to modify the distance that's considered pathable
return (x - dX) * (x - dX) + (y - dY) * (y - dY) < 10 * 10;
endfunction
function IsTerrainWalkableLoc takes location l returns boolean
local real x = GetLocationX(l)
local real y = GetLocationY(l)
local real dX
local real dY
SetItemVisible(udg_PathingChecker, true)
SetItemPosition(udg_PathingChecker, x, y)
dX = GetItemX(udg_PathingChecker)
dY = GetItemY(udg_PathingChecker)
SetItemVisible(udg_PathingChecker, false)
// adjust 10 to modify the distance that's considered pathable
return (x - dX) * (x - dX) + (y - dY) * (y - dY) < 10 * 10;
endfunction
This checks for Buildings, Doodads, Cliffs, Boundaries, etc. and will return True or False depending on whether the terrain is walkable or not.
How to use it in GUI:
Set Variable TempPoint = (Position of (Triggering unit))
Custom script: set udg_WalkableBoolean = IsTerrainWalkableLoc(udg_TempPoint)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
WalkableBoolean Equal to True
Then - Actions
-------- The terrain is walkable --------
Else - Actions
-------- The terrain is unwalkable --------
WalkableBoolean is a Boolean variable that you need to create. You can name it whatever you want, just make sure to update it's name in the Custom script if you change it.
can this walkability trigger be used by multiple spells and features at same time if it shares one item and one boolean variable? also does it matter if item is spawned or preplaced
Create an Item and store it in an Item variable called PathingChecker. Make the item Invulnerable and Hidden.
Then create a Script and paste this code into it:
vJASS:
function IsTerrainWalkable takes real x, real y returns boolean
local real dX
local real dY
SetItemVisible(udg_PathingChecker, true)
SetItemPosition(udg_PathingChecker, x, y)
dX = GetItemX(udg_PathingChecker)
dY = GetItemY(udg_PathingChecker)
SetItemVisible(udg_PathingChecker, false)
// adjust 10 to modify the distance that's considered pathable
return (x - dX) * (x - dX) + (y - dY) * (y - dY) < 10 * 10;
endfunction
function IsTerrainWalkableLoc takes location l returns boolean
local real x = GetLocationX(l)
local real y = GetLocationY(l)
local real dX
local real dY
SetItemVisible(udg_PathingChecker, true)
SetItemPosition(udg_PathingChecker, x, y)
dX = GetItemX(udg_PathingChecker)
dY = GetItemY(udg_PathingChecker)
SetItemVisible(udg_PathingChecker, false)
// adjust 10 to modify the distance that's considered pathable
return (x - dX) * (x - dX) + (y - dY) * (y - dY) < 10 * 10;
endfunction
This checks for Buildings, Doodads, Cliffs, Boundaries, etc. and will return True or False depending on whether the terrain is walkable or not.
How to use it in GUI:
Set Variable TempPoint = (Position of (Triggering unit))
Custom script: set udg_WalkableBoolean = IsTerrainWalkableLoc(udg_TempPoint)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
WalkableBoolean Equal to True
Then - Actions
-------- The terrain is walkable --------
Else - Actions
-------- The terrain is unwalkable --------
WalkableBoolean is a Boolean variable that you need to create. You can name it whatever you want, just make sure to update it's name in the Custom script if you change it.
\
also i did like you said but theres issue my unit can jumpinto places with low colission that normally he wouldnt be able to walk into so i came to conclussion the colission checking of item must be bigger. however its impossible to increase item colission as far as i know. i modyfited myself your function and replaced it with dummy unit but then unit cannot jump at all even if i set dummy colission to 1
function IsTerrainWalkable takes real x, real y returns boolean
local real dX
local real dY
call SetUnitPosition(udg_PathingChecker, x, y)
set dX = GetUnitX(udg_PathingChecker)
set dY = GetUnitY(udg_PathingChecker)
// adjust 10 to modify the distance that's considered pathable
return (x - dX) * (x - dX) + (y - dY) * (y - dY) < 10 * 10
endfunction
function IsTerrainWalkableLoc takes location l returns boolean
local real x = GetLocationX(l)
local real y = GetLocationY(l)
local real dX
local real dY
call SetUnitPosition(udg_PathingChecker, x, y)
set dX = GetUnitX(udg_PathingChecker)
set dY = GetUnitY(udg_PathingChecker)
// adjust 10 to modify the distance that's considered pathable
return (x - dX) * (x - dX) + (y - dY) * (y - dY) < 10 * 10
endfunction
I took the code from some old post a while back (there's like 20 different pathing checkers on Hive) so I'm not 100% sure.
What I do know is that there's no way to get the Collision Size of a unit and that's definitely not being done here.
The 10 is just some value that the creator went with. Try messing around with it, like using 5 or 20.
Edit: Also, make sure that the Point that you provide is where the unit is going to move, not where it is currently. You're testing the pathing of it's destination!
I took the code from some old post a while back (there's like 20 different pathing checkers on Hive) so I'm not 100% sure.
What I do know is that there's no way to get the Collision Size of a unit and that's definitely not being done here.
The 10 is just some value that the creator went with. Try messing around with it, like using 5 or 20.
Edit: Also, make sure that the Point that you provide is where the unit is going to move, not where it is currently. You're testing the pathing of it's destination!
Those gaps don't have any pathing so if you're testing the pathing there it's going to be considered walkable.
The way the code works is it moves the PathingChecker item to the Point that you provide. If the Point is Unpathable because something is in the way then the Item will get pushed to the nearest Pathable point. That's just how Units/Items work in Warcraft 3, for example, if you spawn a ground Unit on top of a building it will spawn next to the building instead. After that process is finished the code will check the distance between the Point and where the Item currently is. If the item moved a certain distance away then we know that the Point that you tried moving it to was Unpathable (something blocked it). Lastly, it returns TRUE if the item didn't move much and FALSE if the item moved too much, which tells us whether or not it was Pathable/Unpathable.
What I think you may want is some sort of advanced code that tests multiple points at once.
But you should show your trigger so I can see how you're using the system because there's a chance that you're making a mistake somewhere.
Here's something I came up with which might help. It's like IsTerrainWalkableLoc() but tests 3 Points instead of 1:
vJASS:
function IsPathingBlocked takes location l, real angle, real offset returns boolean
// adjust 10 to modify the distance that's considered pathable
local boolean success = false
local real x = GetLocationX(l)
local real y = GetLocationY(l)
local real x2
local real y2
local real dX
local real dY
call SetItemVisible(udg_PathingChecker, true)
// test first point
call SetItemPosition(udg_PathingChecker, x, y)
set dX = GetItemX(udg_PathingChecker)
set dY = GetItemY(udg_PathingChecker)
set success = (x - dX) * (x - dX) + (y - dY) * (y - dY) < 10 * 10
if success == false then
call SetItemVisible(udg_PathingChecker, false)
return false
endif
// test second point
set x2 = x + (offset * Cos(bj_DEGTORAD * (angle + 90.0)))
set y2 = y + (offset * Sin(bj_DEGTORAD * (angle + 90.0)))
call SetItemPosition(udg_PathingChecker, x2, y2)
set dX = GetItemX(udg_PathingChecker)
set dY = GetItemY(udg_PathingChecker)
set success = (x2 - dX) * (x2 - dX) + (y2 - dY) * (y2 - dY) < 10 * 10
if success == false then
call SetItemVisible(udg_PathingChecker, false)
return false
endif
// test third point
set x2 = x + (offset * Cos(bj_DEGTORAD * (angle - 90.0)))
set y2 = y + (offset * Sin(bj_DEGTORAD * (angle - 90.0)))
call SetItemPosition(udg_PathingChecker, x2, y2)
set dX = GetItemX(udg_PathingChecker)
set dY = GetItemY(udg_PathingChecker)
set success = (x2 - dX) * (x2 - dX) + (y2 - dY) * (y2 - dY) < 10 * 10
if success == false then
call SetItemVisible(udg_PathingChecker, false)
return false
endif
// if we made it this far then the point is pathable
call SetItemVisible(udg_PathingChecker, false)
return true
endfunction
This is how you'd use it in the Jump trigger:
Custom script: set udg_WalkableBoolean = IsPathingBlocked(udg_JD_TempPoint[2], udg_JD_Angle[udg_JD_Integers[3]], 64)
64 is the Offset. Lowering it will make the "collision size" smaller. Increasing it will do the opposite.
Here's something I came up with which might help. It's like IsTerrainWalkableLoc() but tests 3 Points instead of 1:
vJASS:
function IsPathingBlocked takes location l, real angle, real offset returns boolean
// adjust 10 to modify the distance that's considered pathable
local boolean success = false
local real x = GetLocationX(l)
local real y = GetLocationY(l)
local real x2
local real y2
local real dX
local real dY
call SetItemVisible(udg_PathingChecker, true)
// test first point
call SetItemPosition(udg_PathingChecker, x, y)
set dX = GetItemX(udg_PathingChecker)
set dY = GetItemY(udg_PathingChecker)
set success = (x - dX) * (x - dX) + (y - dY) * (y - dY) < 10 * 10
if success == false then
call SetItemVisible(udg_PathingChecker, false)
return false
endif
// test second point
set x2 = x + (offset * Cos(bj_DEGTORAD * (angle + 90.0)))
set y2 = y + (offset * Sin(bj_DEGTORAD * (angle + 90.0)))
call SetItemPosition(udg_PathingChecker, x2, y2)
set dX = GetItemX(udg_PathingChecker)
set dY = GetItemY(udg_PathingChecker)
set success = (x2 - dX) * (x2 - dX) + (y2 - dY) * (y2 - dY) < 10 * 10
if success == false then
call SetItemVisible(udg_PathingChecker, false)
return false
endif
// test third point
set x2 = x + (offset * Cos(bj_DEGTORAD * (angle - 90.0)))
set y2 = y + (offset * Sin(bj_DEGTORAD * (angle - 90.0)))
call SetItemPosition(udg_PathingChecker, x2, y2)
set dX = GetItemX(udg_PathingChecker)
set dY = GetItemY(udg_PathingChecker)
set success = (x2 - dX) * (x2 - dX) + (y2 - dY) * (y2 - dY) < 10 * 10
if success == false then
call SetItemVisible(udg_PathingChecker, false)
return false
endif
// if we made it this far then the point is pathable
call SetItemVisible(udg_PathingChecker, false)
return true
endfunction
This is how you'd use it in the Jump trigger:
Custom script: set udg_WalkableBoolean = IsPathingBlocked(udg_JD_TempPoint[2], udg_JD_Angle[udg_JD_Integers[3]], 64)
64 is the Offset. Lowering it will make the "collision size" smaller. Increasing it will do the opposite.
thanks, one last question i hope. some people said this system sucks. can u see anything wrong at it? as long as it doesnt make lags or memory leaks or errors i would say its fine
thanks, one last question i hope. some people said this system sucks. can u see anything wrong at it? as long as it doesnt make lags or memory leaks or errors i would say its fine
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.