Jump to content

mist.teleportToPoint + getSurfaceType?


EasyEB

Recommended Posts

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

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 ServerScripting 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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...