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

Making a flying unit land only in adecuate terrain.

Status
Not open for further replies.
Level 3
Joined
Dec 12, 2018
Messages
28
So, I made a unit that can transform into a flying mode and a land mode (kinda the terran vikings from Starcraft 2). No problem with it, except, when it tries to land over water or other impassable terrain, it gets stuck in mid air and can't move anymore until I force it to use the ability again a get into fliying mode.

Is there a way to make the ability only usable over passable terrain?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Does Druid of the Talon have this issue when morphing between Crow and Druid form? If not then maybe using that transform ability would help. If you already are then check the unit properties in case it is unit related field that has to be turned on so it performs placement checks.

If this ability has to be triggered, then you can perform some pathing checks on the ground below the unit before transforming the unit type. The pathing check function only considers the static pathing map (generated by World Editor from terrain and doodads) and not the result of destructables or building units. A more expensive custom pathing check function that does factor in destructables and building units can be made by using dummy units with the desired pathing properties and seeing if they are placed correctly.
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
A more expensive custom pathing check function that does factor in destructables and building units can be made by using dummy units with the desired pathing properties and seeing if they are placed correctly.

one easy way to do this that I have used is with items. just create an item on that location and then check the distance between the item and the unit. if the unit is too far from the item - the ability doesn't go through and the player gets an error message.

obviously using raven form is way cleaner if you can though like DSG wrote...
 
Level 3
Joined
Dec 12, 2018
Messages
28
Oh, bless my stupidity, I didn't think of druid of the talon when I created the ability. Since this is for a hero unit, I by went using the Robo-gobling ability and, of course, it doesn't check terrain. Thanks.
 
Status
Not open for further replies.
Top