Jump to content

Recommended Posts

Posted

I'm wondering if there is a lua function that can return group's next way point.

 

What I'm trying to achieve is:

 

I have a script that adds randomization to a group path, so every time a group is under a fire it would move randomly within certain distance. Then as soon as the fire is cleared the group suppose to continue on it is original path (waypoints in ME). What I'm able to do is to use MIST getGroupRoute - that gives me the original path, and I can send that group to the last point of that path, but that is not exactly what I want. If I could figure the next waypoint it would be ideal.

i5-9600K@4.8GHz 32Gb DDR4 rtx5070ti Quest Pro Warthog on Virpil base

Posted

There are two ways to go about it.

 

1. Constantly check an area around the next waypoint coordinates and when a unit reaches that area you can iterate a saved value that designates which WP the group was last in.

 

2. You can add a do script() command to each waypoint where it can call a function on waypoint arrival that sets which WP it is on.

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

Posted (edited)
There are two ways to go about it.

 

1. Constantly check an area around the next waypoint coordinates and when a unit reaches that area you can iterate a saved value that designates which WP the group was last in.

 

2. You can add a do script() command to each waypoint where it can call a function on waypoint arrival that sets which WP it is on.

 

What I do is: from a script I add id='Script' command to each WP which sets a flag with a value equal to a WP number. That needs to be called just once at mission start. Then whenever I have to figure a next waypoint I just do getUserFlag() and here we go - now I know where to send a group.

 

for i=1, #route do

local task = {

id = 'WrappedAction',

params = {

action = {

id = 'Script',

params = {

command = 'trigger.action.setUserFlag("'..groupName..'_WPFlag",'..i..')'

},

},

},

}

route.task = task

trigger.action.outText("Flag command is added for a wp "..i, 5)

end

 

(Hey Grimes, by the way, it would be great to see this kind of logic as a part of MIST)

Edited by sea2sky

i5-9600K@4.8GHz 32Gb DDR4 rtx5070ti Quest Pro Warthog on Virpil base

  • Recently Browsing   0 members

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