EasyEB Posted February 22, 2017 Share Posted February 22, 2017 Greetings! So I have a little problem. I use mist.teleportToPoint to teleport friendly ground units to a point on a radius around an enemy group. Sometimes that makes them end up on top of a mountain peak or some such so they are stuck there. I was wondering if it is possible to make a command that first finds a random point in a radius around the enemy group, and from that finds the closest point that is a road, and then places the friendly ground units on that point. What I'm using now is mist.teleportToPoint({groupName="Friend", point=mist.getLeadPos('Enemy'), action="teleport", radius=9418, innerRadius=7408}) Link to comment Share on other sites More sharing options...
Grimes Posted February 23, 2017 Share Posted February 23, 2017 There is no scripting function to just get the nearest point to a road, yet. However you'd kinda just have to brute force it by generating a random point or just drawing a line in a given direction and checking if it is on a road or not. There could be the possibility that a road simply isn't inside the area to randomly choose it. Alternatively you could simply check the terrain height of a given point and then check a few points around that new point to compare the height differences to see if it is flat enough. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum Link to comment Share on other sites More sharing options...
EasyEB Posted February 23, 2017 Author Share Posted February 23, 2017 I think maybe the second option might be the best way to do it. They do not have to be on a road, just on a surface that they can drive on (and away from). I'll look into it, thanks! Link to comment Share on other sites More sharing options...
Recommended Posts