I've been thinking of ways to make a certain Lua ai smarter - like not send ground units to conquer sectors that are either inaccessible to them, or obstructed by difficult terrain.
The obvious way to do that would be to make it check the path length to a candidate sector for the ground units, but the only way to do this that i found, seems to fetch the Path UserData Object, get a whole list of waypoints, and then manually calculate distances.
Is there perhaps anything easier?
Find a path length by Lua
Moderator: Moderators
Re: Find a path length by Lua
Easier... Can't you fit the math to calculate length from the path it returns into a piece of code that's shorter than my post?
- Tribulexrenamed
- Posts: 775
- Joined: 22 Apr 2008, 19:06
Re: Find a path length by Lua
Pythagoras has been around for a while, no?
Re: Find a path length by Lua
Äh, i probably should have written "faster". Anyway, if the obvious way is the only one, then the only way is the obvious one.Easier... Can't you fit the math to calculate length from the path it returns into a piece of code that's shorter than my post?