Jump to content

(MIST) how to modify the speed of a waypoint before spawning a new group?


Recommended Posts

Posted

Hi, 

This is my fist script, can you please assist on how to fix it?    I just need to modify the speed of the initial waypoint right before spawning a new group for the first time, but the script fails in line 3 specifying that points is a nil value.  (attempting to index field 'points' (a nil value).  

Apparently, I have my documentation wrong about the route table.  

 

What would be the correct line 3?

1: local groupName = 'Aerial-1'
2: local groupData = mist.getGroupData(groupName, true)
3: groupData.route.points[1].speed = 436
4: mist.dynAdd(groupData)

 

If I delete line 3, all works well so MIST is working just fine.

 

Thank you,

P.S.

If you are wondering why I need to do this is because I am tired of fixing the initial speed of that group manually every time I want to play with a different aircraft in the mission editor.  The speed is critical for my formation flying stuff and the mission editor changes that speed when I select a different aircraft in the ME.  Obviously once I got this script right, I am going to use it with many other Groups in my mission.

 

Posted

Thank you @kira_mikamy

Unfortunately, it doesn't work because the aircraft is not flying in line #3.  If I place it in line #5 then is too late, because the difference might be too big so we wont start in a good position for the initial formation task.

Any other suggestion?  Remember, I just need to change the speed of the first waypoint before spawning a group.

kind regards

Posted

@ralch unfrotunally, i didnt know other way to modify the speed of a single waypoint trough script, the only one i know is the one ive already post.

BUT. if you dont mind to have a lot of different aircraft to play on, isnt a way to create a group for each one with only the first wp speed changed? maybe calling it trough menu and not trigger

 

Posted

getGroupData with a route flag shortens the returned route table and cuts out the points entry. This ought to work. 

groupData.route[1].speed

Also a speed of 436 is about 850 knots because that value is in meters per second. 

mist.dynAdd is overloaded to convert it to route.points needed by the game if the route table entry passed lacks a points. 

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

  • Recently Browsing   0 members

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