• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Knockback detects pathing?

Status
Not open for further replies.
Level 6
Joined
Dec 29, 2013
Messages
152
Hello I wanted to ask how to trigger a knockback so it detects pathingblockers/ trees/ pathed objects and then stops.
I need it for an arena fight.. right now enemies can just be knockbacked trough the whole walls ._.
Isn't there a function detecting pathing?
 
Well, there is a jass function which is REALLY easy to use which can detect if a point is unpathable. The library by Rising Dusk is extended to also check if there is a unit or other object currently occupying the space of the point.

There is no sin in not using it and instead just going with the jass function in the actions part of the trigger:

  • Custom script: if IsTerrainPathable(udg_x, udg_y, PATHING_TYPE_WALKABILITY) then
Put your actions inside, and then:

  • Custom script: endif
This assumes you have two global real variables named "x" and y" which you need to set to your point beforehand. If you want to use the library, which most would recommend, just create a trigger, convert it to custom text and delete everything in it, then paste the code in the link that Mr_Bean posted. Then you use the same custom script except with "IsTerrainWalkable(udg_x, udg_y)".
 
Level 12
Joined
Oct 16, 2010
Messages
680
the GUI function Unit - move unit instantly is minds pathability. I assume in game its like the unit starts vigling a bit when hits something then suddenly "jumps" over it.

you need to refresh the actual position of the unit in every period when you try to move it
if you do it well (and there are no such big distances between periods) it should slide along walls and trees and such.

but the clearest way is still to trigger the pathing check for yourself or use a premade one like the one mentioned above.
 
Since you want to detect pathing blockers and trees, Fingolfin's method won't suffice.

As Lender said, GUI's move unit detects pathability, but it issues a stop order (as such it will interrupt animations and orders). If that is okay, then use that to move the unit.

Otherwise, here is a GUI-friendly version of Rising Dusk's system:
http://www.hiveworkshop.com/forums/spells-569/check-walkability-239115/

Just check the demo triggers for an example on its usage. In your knockback triggers, you can simply check if the point is pathable before moving the unit. If it isn't pathable, you can simply end the knockback effect.
 
Status
Not open for further replies.
Top