Jump to content

Recommended Posts

Posted

Hi all, this is my first MOOSE 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 

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

 

What would be the correct line 3?

1: local group = GROUP:FindByName('Aerial-1')
2: local waypoints = group:GetWayPoints() 
3: waypoints[1].speed = 450 
4: local task = group:TaskRoute(waypoints) 
5: group:Activate() 

 

If I delete line 3, all works well so MOOSE 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

I've tried group.SetSpeed() before Activate() and after, with true and false for Keep but SetSpeed() doesn't make any change.

I've tried

waypoints[1].speed = 450

and

waypoints.points[1].speed = 450

but those two lines always fail.  The error message says they are nil.

The documentation for GetWayPoints() says nil could be returned but that there are waypoints.  Obviously that group has waypoints defined in my mission editor.

 

Any other ideas how I can obtain the non-nil waypoints for my 'Aerial-1' group?

  • Recently Browsing   0 members

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