• 🏆 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!

How to make a unit's autopathing go straight to the target destination and ignore objects in the way?

Status
Not open for further replies.
Level 7
Joined
Mar 16, 2014
Messages
152
I have a unit with collision off. When I tell it to go somewhere, I want the unit to go directly to that point in a straight line. However, the game's pathing will treat the unit as a normal unit and have it go around obstacles. To make the unit go through obstacles, I have to annoyingly spam right click inside of the object to do so. What solutions are there?
 
Level 7
Joined
Mar 16, 2014
Messages
152
Give it the ability "Ghost (Visible)" and see if that changes the behavior. I presume it's already a flying unit?
The effect would be fairly simple with a flying unit, but I want the unit to be targetable by spells as a ground unit, get hit by impale/entangle/etc.

So to answer the question, I can't make it a flying unit.
 
Level 7
Joined
Mar 16, 2014
Messages
152
Make it flying and modify its Combat - Targeted as... field to be a ground unit
I have tried this. This makes it hit like a ground unit for autoattacks only. Spells still treat it as a flying unit. I also tried making every spell in the game be able to hit flying units, but no, some spells like entangle and impale are hard coded to be unable to hit flying units.
 
Level 39
Joined
Feb 27, 2007
Messages
5,019
What sort of 'obstacles' are you referring to? If you really want beeline movement you could make the unit unable to move and then move it rapidly with a periodic trigger/timer whenever it's ordered to go move somewhere. That would be weird it it's a combat unit, though.
 
Level 7
Joined
Mar 16, 2014
Messages
152
What sort of 'obstacles' are you referring to? If you really want beeline movement you could make the unit unable to move and then move it rapidly with a periodic trigger/timer whenever it's ordered to go move somewhere. That would be weird it it's a combat unit, though.
I want it go over terrain/doodads/ground pathing blockers. It's a hero with a temporary ""flying transformation.""

I simulate it being a real flying unit by giving it no collision, then spawning a dummy flying unit where it is every 0.03 seconds, and if it's further than X away from it, moving it to where the flying unit is. This prevents it from going out of bounds or past flying pathing blockers. This dummy system works to enable the unit to fly for the most part, but for Warcraft 3autopathing the game still thinks it's a ground unit and will awkwardly go around things unless you get overly finnicky with the orders to the unit.
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,019
I don't think this is possible without breaking targeting for those few spells. What you want is to have a ground unit that uses the pathfinding rules for flying units. There is no way to assign that property to that unit within the game code; such a thing would be in the realm of a memory hack probably. Your options are:
  1. Actually make the second form flying, use 'targeted as' to get close, and then manually code replacements for any relevant spells.
  2. Manually move the unit with triggers when it's given a move order targeting a point while transformed.
  3. Accept the weird autopathing implications and make it explicitly clear to the player that they should spam click to traverse obstacles more efficiently.
 
Status
Not open for further replies.
Top